From 8332ccaa7a79c740c3baf63b366bf71bd771ed2f Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 17 Aug 2019 00:29:13 +0300 Subject: [PATCH] Add RR graph stub --- graphs/data/__init__.py | 1 + graphs/data/fitCapRegen/graph.py | 9 ++---- graphs/data/fitDamageStats/graph.py | 2 +- graphs/data/fitMobility/__init__.py | 4 +-- graphs/data/fitMobility/graph.py | 11 +++---- graphs/data/fitRemoteReps/__init__.py | 24 +++++++++++++++ graphs/data/fitRemoteReps/getter.py | 22 ++++++++++++++ graphs/data/fitRemoteReps/graph.py | 44 +++++++++++++++++++++++++++ graphs/data/fitShieldRegen/graph.py | 3 +- graphs/data/fitWarpTime/graph.py | 9 ++---- 10 files changed, 105 insertions(+), 24 deletions(-) create mode 100644 graphs/data/fitRemoteReps/__init__.py create mode 100644 graphs/data/fitRemoteReps/getter.py create mode 100644 graphs/data/fitRemoteReps/graph.py diff --git a/graphs/data/__init__.py b/graphs/data/__init__.py index d02a48e9b..94d5d30e3 100644 --- a/graphs/data/__init__.py +++ b/graphs/data/__init__.py @@ -20,6 +20,7 @@ from . import fitDamageStats from . import fitEwarStats +from . import fitRemoteReps from . import fitShieldRegen from . import fitCapRegen from . import fitMobility diff --git a/graphs/data/fitCapRegen/graph.py b/graphs/data/fitCapRegen/graph.py index 2774a8c49..387a238a2 100644 --- a/graphs/data/fitCapRegen/graph.py +++ b/graphs/data/fitCapRegen/graph.py @@ -40,14 +40,11 @@ class FitCapRegenGraph(FitGraph): srcExtraCols = ('CapAmount', 'CapTime') # Calculation stuff - _normalizers = { - ('capAmount', '%'): lambda v, src, tgt: v / 100 * src.item.ship.getModifiedItemAttr('capacitorCapacity')} - _limiters = { - 'capAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('capacitorCapacity'))} + _normalizers = {('capAmount', '%'): lambda v, src, tgt: v / 100 * src.item.ship.getModifiedItemAttr('capacitorCapacity')} + _limiters = {'capAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('capacitorCapacity'))} _getters = { ('time', 'capAmount'): Time2CapAmountGetter, ('time', 'capRegen'): Time2CapRegenGetter, ('capAmount', 'capAmount'): CapAmount2CapAmountGetter, ('capAmount', 'capRegen'): CapAmount2CapRegenGetter} - _denormalizers = { - ('capAmount', '%'): lambda v, src, tgt: v * 100 / src.item.ship.getModifiedItemAttr('capacitorCapacity')} + _denormalizers = {('capAmount', '%'): lambda v, src, tgt: v * 100 / src.item.ship.getModifiedItemAttr('capacitorCapacity')} diff --git a/graphs/data/fitDamageStats/graph.py b/graphs/data/fitDamageStats/graph.py index a12372808..ed7bbeead 100644 --- a/graphs/data/fitDamageStats/graph.py +++ b/graphs/data/fitDamageStats/graph.py @@ -60,7 +60,7 @@ class FitDamageStatsGraph(FitGraph): XDef(handle='tgtSigRad', unit='m', label='Target signature radius', mainInput=('tgtSigRad', '%')), XDef(handle='tgtSigRad', unit='%', label='Target signature radius', mainInput=('tgtSigRad', '%'))] inputs = [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=None, defaultRange=(0, 80), secondaryTooltip='When set, uses exact attacker\'s damage stats of at a given time\nWhen not set, uses attacker\'s damage stats as shown in stats panel of main window'), + Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=None, defaultRange=(0, 80), secondaryTooltip='When set, uses attacker\'s exact damage stats at a given time\nWhen not set, uses attacker\'s damage stats as shown in stats panel of main window'), Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=None, defaultRange=(0, 100), mainTooltip='Distance between the attacker and the target, as seen in overview (surface-to-surface)', secondaryTooltip='Distance between the attacker and the target, as seen in overview (surface-to-surface)\nWhen set, places the target that far away from the attacker\nWhen not set, attacker\'s weapons always hit the target'), Input(handle='tgtSpeed', unit='%', label='Target speed', iconID=1389, defaultValue=100, defaultRange=(0, 100)), Input(handle='tgtSigRad', unit='%', label='Target signature', iconID=1390, defaultValue=100, defaultRange=(100, 200), mainOnly=True)] diff --git a/graphs/data/fitMobility/__init__.py b/graphs/data/fitMobility/__init__.py index b5544d5a5..93526e621 100644 --- a/graphs/data/fitMobility/__init__.py +++ b/graphs/data/fitMobility/__init__.py @@ -18,7 +18,7 @@ # ============================================================================= -from .graph import FitMobilityVsTimeGraph +from .graph import FitMobilityGraph -FitMobilityVsTimeGraph.register() +FitMobilityGraph.register() diff --git a/graphs/data/fitMobility/graph.py b/graphs/data/fitMobility/graph.py index 9d243cddd..c92dcfa11 100644 --- a/graphs/data/fitMobility/graph.py +++ b/graphs/data/fitMobility/graph.py @@ -22,23 +22,20 @@ from graphs.data.base import FitGraph, XDef, YDef, Input from .getter import Time2SpeedGetter, Time2DistanceGetter -class FitMobilityVsTimeGraph(FitGraph): +class FitMobilityGraph(FitGraph): # UI stuff internalName = 'mobilityGraph' name = 'Mobility' - xDefs = [ - XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))] + xDefs = [XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))] yDefs = [ YDef(handle='speed', unit='m/s', label='Speed'), YDef(handle='distance', unit='km', label='Distance')] - inputs = [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30))] + inputs = [Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30))] srcExtraCols = ('Speed', 'Agility') # Calculation stuff _getters = { ('time', 'speed'): Time2SpeedGetter, ('time', 'distance'): Time2DistanceGetter} - _denormalizers = { - ('distance', 'km'): lambda v, src, tgt: v / 1000} + _denormalizers = {('distance', 'km'): lambda v, src, tgt: v / 1000} diff --git a/graphs/data/fitRemoteReps/__init__.py b/graphs/data/fitRemoteReps/__init__.py new file mode 100644 index 000000000..36faf70d8 --- /dev/null +++ b/graphs/data/fitRemoteReps/__init__.py @@ -0,0 +1,24 @@ +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +# ============================================================================= + + +from .graph import FitRemoteRepsGraph + + +FitRemoteRepsGraph.register() diff --git a/graphs/data/fitRemoteReps/getter.py b/graphs/data/fitRemoteReps/getter.py new file mode 100644 index 000000000..c5015c81f --- /dev/null +++ b/graphs/data/fitRemoteReps/getter.py @@ -0,0 +1,22 @@ +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +# ============================================================================= + + +from graphs.data.base import SmoothPointGetter + diff --git a/graphs/data/fitRemoteReps/graph.py b/graphs/data/fitRemoteReps/graph.py new file mode 100644 index 000000000..3f26a0d40 --- /dev/null +++ b/graphs/data/fitRemoteReps/graph.py @@ -0,0 +1,44 @@ +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +# ============================================================================= + + +from graphs.data.base import FitGraph, XDef, YDef, Input + + +class FitRemoteRepsGraph(FitGraph): + + # UI stuff + internalName = 'remoteRepsGraph' + name = 'Remote Repairs' + xDefs = [ + XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km')), + XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))] + yDefs = [ + YDef(handle='rps', unit='HP/s', label='Repair speed'), + YDef(handle='total', unit='HP', label='Total repaired')] + inputs = [ + Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=None, defaultRange=(0, 80), secondaryTooltip='When set, uses repairing ship\'s exact RR stats at a given time\nWhen not set, uses attacker\'s RR stats as shown in stats panel of main window'), + Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=None, defaultRange=(0, 100), mainTooltip='Distance between the repairing ship and the target, as seen in overview (surface-to-surface)', secondaryTooltip='Distance between the repairing ship and the target, as seen in overview (surface-to-surface)')] + srcExtraCols = () + + # Calculation stuff + _normalizers = {('distance', 'km'): lambda v, src, tgt: None if v is None else v * 1000} + _limiters = {'time': lambda src, tgt: (0, 2500)} + _getters = {} + _denormalizers = {('distance', 'km'): lambda v, src, tgt: None if v is None else v / 1000} diff --git a/graphs/data/fitShieldRegen/graph.py b/graphs/data/fitShieldRegen/graph.py index c5bb9945c..a538e629b 100644 --- a/graphs/data/fitShieldRegen/graph.py +++ b/graphs/data/fitShieldRegen/graph.py @@ -54,8 +54,7 @@ class FitShieldRegenGraph(FitGraph): ('shieldAmount', '%'): lambda v, src, tgt: v / 100 * src.item.ship.getModifiedItemAttr('shieldCapacity'), # Needed only for "x mark" support, to convert EHP x into normalized value ('shieldAmount', 'EHP'): lambda v, src, tgt: v / src.item.damagePattern.effectivify(src.item, 1, 'shield')} - _limiters = { - 'shieldAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('shieldCapacity'))} + _limiters = {'shieldAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('shieldCapacity'))} _getters = { ('time', 'shieldAmount'): Time2ShieldAmountGetter, ('time', 'shieldRegen'): Time2ShieldRegenGetter, diff --git a/graphs/data/fitWarpTime/graph.py b/graphs/data/fitWarpTime/graph.py index 169e07102..32f362e85 100644 --- a/graphs/data/fitWarpTime/graph.py +++ b/graphs/data/fitWarpTime/graph.py @@ -42,8 +42,7 @@ class FitWarpTimeGraph(FitGraph): xDefs = [ XDef(handle='distance', unit='AU', label='Distance', mainInput=('distance', 'AU')), XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km'))] - yDefs = [ - YDef(handle='time', unit='s', label='Warp time')] + yDefs = [YDef(handle='time', unit='s', label='Warp time')] inputs = [ Input(handle='distance', unit='AU', label='Distance', iconID=1391, defaultValue=20, defaultRange=(0, 50)), Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=1000, defaultRange=(150, 5000))] @@ -53,10 +52,8 @@ class FitWarpTimeGraph(FitGraph): _normalizers = { ('distance', 'AU'): lambda v, src, tgt: v * AU_METERS, ('distance', 'km'): lambda v, src, tgt: v * 1000} - _limiters = { - 'distance': lambda src, tgt: (0, src.item.maxWarpDistance * AU_METERS)} - _getters = { - ('distance', 'time'): Distance2TimeGetter} + _limiters = {'distance': lambda src, tgt: (0, src.item.maxWarpDistance * AU_METERS)} + _getters = {('distance', 'time'): Distance2TimeGetter} _denormalizers = { ('distance', 'AU'): lambda v, src, tgt: v / AU_METERS, ('distance', 'km'): lambda v, src, tgt: v / 1000}