Re-enable mobility graph
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
import math
|
||||
|
||||
from .base import SmoothGraph
|
||||
|
||||
|
||||
class FitSpeedVsTimeGraph(SmoothGraph):
|
||||
|
||||
def getYForX(self, fit, extraData, time):
|
||||
maxSpeed = fit.ship.getModifiedItemAttr('maxVelocity')
|
||||
mass = fit.ship.getModifiedItemAttr('mass')
|
||||
agility = fit.ship.getModifiedItemAttr('agility')
|
||||
# https://wiki.eveuniversity.org/Acceleration#Mathematics_and_formulae
|
||||
speed = maxSpeed * (1 - math.exp((-time * 1000000) / (agility * mass)))
|
||||
return speed
|
||||
@@ -6,6 +6,6 @@ from gui.builtinGraphs import ( # noqa: E402,F401
|
||||
# fitShieldAmountVsTime,
|
||||
# fitCapRegenVsCapPerc,
|
||||
# fitCapAmountVsTime,
|
||||
# fitMobilityVsTime,
|
||||
fitMobility,
|
||||
fitWarpTime
|
||||
)
|
||||
|
||||
@@ -28,14 +28,14 @@ Input = namedtuple('Input', ('handle', 'unit', 'label', 'iconID', 'defaultValue'
|
||||
VectorDef = namedtuple('VectorDef', ('lengthHandle', 'lengthUnit', 'angleHandle', 'angleUnit', 'label'))
|
||||
|
||||
|
||||
class Graph(metaclass=ABCMeta):
|
||||
class FitGraph(metaclass=ABCMeta):
|
||||
|
||||
# UI stuff
|
||||
views = []
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
Graph.views.append(cls)
|
||||
FitGraph.views.append(cls)
|
||||
|
||||
def __init__(self):
|
||||
self._plotCache = {}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
from eos.graph.fitCapAmountVsTime import FitCapAmountVsTimeGraph as EosGraph
|
||||
from .base import Graph, XDef, YDef
|
||||
from .base import FitGraph, XDef, YDef
|
||||
|
||||
|
||||
class FitCapAmountVsTimeGraph(Graph):
|
||||
class FitCapAmountVsTimeGraph(FitGraph):
|
||||
|
||||
name = 'Cap Amount vs Time'
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
from eos.graph.fitCapRegenVsCapPerc import FitCapRegenVsCapPercGraph as EosGraph
|
||||
from .base import Graph, XDef, YDef
|
||||
from .base import FitGraph, XDef, YDef
|
||||
|
||||
|
||||
class FitCapRegenVsCapPercGraph(Graph):
|
||||
class FitCapRegenVsCapPercGraph(FitGraph):
|
||||
|
||||
name = 'Cap Regen vs Cap Amount'
|
||||
|
||||
|
||||
@@ -20,17 +20,13 @@
|
||||
|
||||
import math
|
||||
|
||||
from eos.graph.fitDpsVsRange import FitDpsVsRangeGraph as EosGraph
|
||||
from .base import Graph, XDef, YDef, Input, VectorDef
|
||||
from .base import FitGraph, XDef, YDef, Input, VectorDef
|
||||
|
||||
|
||||
class FitDamageStatsGraph(Graph):
|
||||
class FitDamageStatsGraph(FitGraph):
|
||||
|
||||
name = 'Damage Stats'
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(EosGraph())
|
||||
|
||||
@property
|
||||
def xDefs(self):
|
||||
return [
|
||||
|
||||
@@ -22,10 +22,10 @@ from collections import OrderedDict
|
||||
|
||||
from eos.graph.fitDmgVsTime import FitDmgVsTimeGraph as EosGraphDmg
|
||||
from eos.graph.fitDpsVsTime import FitDpsVsTimeGraph as EosGraphDps
|
||||
from .base import Graph, XDef, YDef
|
||||
from .base import FitGraph, XDef, YDef
|
||||
|
||||
|
||||
class FitDmgVsTimeGraph(Graph):
|
||||
class FitDmgVsTimeGraph(FitGraph):
|
||||
|
||||
name = 'Damage vs Time'
|
||||
|
||||
|
||||
90
gui/builtinGraphs/fitMobility.py
Normal file
90
gui/builtinGraphs/fitMobility.py
Normal file
@@ -0,0 +1,90 @@
|
||||
# =============================================================================
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
|
||||
import math
|
||||
|
||||
from .base import FitGraph, XDef, YDef, Input
|
||||
|
||||
|
||||
class FitMobilityVsTimeGraph(FitGraph):
|
||||
|
||||
name = 'Mobility'
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
# UI stuff
|
||||
@property
|
||||
def xDefs(self):
|
||||
return [XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))]
|
||||
|
||||
@property
|
||||
def yDefs(self):
|
||||
return [
|
||||
YDef(handle='speed', unit='m/s', label='Speed'),
|
||||
YDef(handle='distance', unit='km', label='Distance')]
|
||||
|
||||
@property
|
||||
def inputs(self):
|
||||
return [Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30), mainOnly=False)]
|
||||
|
||||
@property
|
||||
def xDef(self):
|
||||
return XDef(inputDefault='0-80', inputLabel='Time (seconds)', inputIconID=1392, axisLabel='Time, s')
|
||||
|
||||
# Calculation stuff
|
||||
_denormalizers = {
|
||||
('distance', 'km'): lambda v, fit, tgt: v / 1000}
|
||||
|
||||
def _time2speed(self, mainInput, miscInputs, fit, tgt):
|
||||
xs = []
|
||||
ys = []
|
||||
maxSpeed = fit.ship.getModifiedItemAttr('maxVelocity')
|
||||
mass = fit.ship.getModifiedItemAttr('mass')
|
||||
agility = fit.ship.getModifiedItemAttr('agility')
|
||||
for time in self._iterLinear(mainInput[1]):
|
||||
# https://wiki.eveuniversity.org/Acceleration#Mathematics_and_formulae
|
||||
speed = maxSpeed * (1 - math.exp((-time * 1000000) / (agility * mass)))
|
||||
xs.append(time)
|
||||
ys.append(speed)
|
||||
return xs, ys
|
||||
|
||||
def _time2distance(self, mainInput, miscInputs, fit, tgt):
|
||||
xs = []
|
||||
ys = []
|
||||
maxSpeed = fit.ship.getModifiedItemAttr('maxVelocity')
|
||||
mass = fit.ship.getModifiedItemAttr('mass')
|
||||
agility = fit.ship.getModifiedItemAttr('agility')
|
||||
for time in self._iterLinear(mainInput[1]):
|
||||
# Definite integral of:
|
||||
# https://wiki.eveuniversity.org/Acceleration#Mathematics_and_formulae
|
||||
distance_t = maxSpeed * time + (maxSpeed * agility * mass * math.exp((-time * 1000000) / (agility * mass)) / 1000000)
|
||||
distance_0 = maxSpeed * 0 + (maxSpeed * agility * mass * math.exp((-0 * 1000000) / (agility * mass)) / 1000000)
|
||||
distance = distance_t - distance_0
|
||||
xs.append(time)
|
||||
ys.append(distance)
|
||||
return xs, ys
|
||||
|
||||
_getters = {
|
||||
('time', 'speed'): _time2speed,
|
||||
('time', 'distance'): _time2distance}
|
||||
|
||||
|
||||
FitMobilityVsTimeGraph.register()
|
||||
@@ -1,48 +0,0 @@
|
||||
# =============================================================================
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from eos.graph.fitDistanceVsTime import FitDistanceVsTimeGraph as EosGraphDistance
|
||||
from eos.graph.fitSpeedVsTime import FitSpeedVsTimeGraph as EosGraphSpeed
|
||||
from .base import Graph, XDef, YDef
|
||||
|
||||
|
||||
class FitMobilityVsTimeGraph(Graph):
|
||||
|
||||
name = 'Mobility vs Time'
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.eosGraphSpeed = EosGraphSpeed()
|
||||
self.eosGraphDistance = EosGraphDistance()
|
||||
|
||||
@property
|
||||
def xDef(self):
|
||||
return XDef(inputDefault='0-80', inputLabel='Time (seconds)', inputIconID=1392, axisLabel='Time, s')
|
||||
|
||||
@property
|
||||
def yDefs(self):
|
||||
return OrderedDict([
|
||||
('speed', YDef(switchLabel='Speed', axisLabel='Speed, m/s', eosGraph='eosGraphSpeed')),
|
||||
('distance', YDef(switchLabel='Distance', axisLabel='Distance, m', eosGraph='eosGraphDistance'))])
|
||||
|
||||
|
||||
FitMobilityVsTimeGraph.register()
|
||||
@@ -22,10 +22,10 @@ from collections import OrderedDict
|
||||
|
||||
import gui.mainFrame
|
||||
from eos.graph.fitShieldAmountVsTime import FitShieldAmountVsTimeGraph as EosGraph
|
||||
from .base import Graph, XDef, YDef
|
||||
from .base import FitGraph, XDef, YDef
|
||||
|
||||
|
||||
class FitShieldAmountVsTimeGraph(Graph):
|
||||
class FitShieldAmountVsTimeGraph(FitGraph):
|
||||
|
||||
name = 'Shield Amount vs Time'
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ from collections import OrderedDict
|
||||
|
||||
import gui.mainFrame
|
||||
from eos.graph.fitShieldRegenVsShieldPerc import FitShieldRegenVsShieldPercGraph as EosGraph
|
||||
from .base import Graph, XDef, YDef
|
||||
from .base import FitGraph, XDef, YDef
|
||||
|
||||
|
||||
class FitShieldRegenVsShieldPercGraph(Graph):
|
||||
class FitShieldRegenVsShieldPercGraph(FitGraph):
|
||||
|
||||
name = 'Shield Regen vs Shield Amount'
|
||||
|
||||
|
||||
@@ -21,19 +21,16 @@
|
||||
import math
|
||||
|
||||
from eos.const import FittingModuleState
|
||||
from .base import Graph, XDef, YDef, Input
|
||||
from .base import FitGraph, XDef, YDef, Input
|
||||
|
||||
|
||||
AU_METERS = 149597870700
|
||||
|
||||
|
||||
class FitWarpTimeGraph(Graph):
|
||||
class FitWarpTimeGraph(FitGraph):
|
||||
|
||||
name = 'Warp Time'
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
# UI stuff
|
||||
@property
|
||||
def xDefs(self):
|
||||
|
||||
@@ -30,7 +30,7 @@ import gui.display
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.builtinGraphs.base import Graph
|
||||
from gui.builtinGraphs.base import FitGraph
|
||||
from .panel import GraphControlPanel
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class GraphFrame(wx.Frame):
|
||||
self.SetSizer(mainSizer)
|
||||
|
||||
# Setup - graph selector
|
||||
for view in Graph.views:
|
||||
for view in FitGraph.views:
|
||||
self.graphSelection.Append(view.name, view())
|
||||
self.graphSelection.SetSelection(0)
|
||||
self.ctrlPanel.updateControls(layout=False)
|
||||
|
||||
Reference in New Issue
Block a user