diff --git a/gui/builtinGraphs/base/__init__.py b/gui/builtinGraphs/base/__init__.py
new file mode 100644
index 000000000..2d670876d
--- /dev/null
+++ b/gui/builtinGraphs/base/__init__.py
@@ -0,0 +1,26 @@
+# =============================================================================
+# 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 .cache import FitDataCache
+from .defs import XDef, YDef, VectorDef, Input
+from .getter import PointGetter, SmoothPointGetter
+from .graph import FitGraph
+
+# noinspection PyUnresolvedReferences
+from gui.builtinGraphs import *
diff --git a/gui/builtinGraphs/base/cache.py b/gui/builtinGraphs/base/cache.py
new file mode 100644
index 000000000..f2880fff4
--- /dev/null
+++ b/gui/builtinGraphs/base/cache.py
@@ -0,0 +1,31 @@
+# =============================================================================
+# 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 .
+# =============================================================================
+
+
+class FitDataCache:
+
+ def __init__(self):
+ self._data = {}
+
+ def clearForFit(self, fitID):
+ if fitID in self._data:
+ del self._data[fitID]
+
+ def clearAll(self):
+ self._data.clear()
diff --git a/gui/builtinGraphs/base/defs.py b/gui/builtinGraphs/base/defs.py
new file mode 100644
index 000000000..f04a85f9e
--- /dev/null
+++ b/gui/builtinGraphs/base/defs.py
@@ -0,0 +1,40 @@
+# =============================================================================
+# 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 collections import namedtuple
+
+
+YDef = namedtuple('YDef', ('handle', 'unit', 'label'))
+XDef = namedtuple('XDef', ('handle', 'unit', 'label', 'mainInput'))
+VectorDef = namedtuple('VectorDef', ('lengthHandle', 'lengthUnit', 'angleHandle', 'angleUnit', 'label'))
+
+
+class Input:
+
+ def __init__(self, handle, unit, label, iconID, defaultValue, defaultRange, mainOnly=False, mainTooltip=None, secondaryTooltip=None):
+ self.handle = handle
+ self.unit = unit
+ self.label = label
+ self.iconID = iconID
+ self.defaultValue = defaultValue
+ self.defaultRange = defaultRange
+ self.mainOnly = mainOnly
+ self.mainTooltip = mainTooltip
+ self.secondaryTooltip = secondaryTooltip
diff --git a/gui/builtinGraphs/base/getter.py b/gui/builtinGraphs/base/getter.py
new file mode 100644
index 000000000..153661044
--- /dev/null
+++ b/gui/builtinGraphs/base/getter.py
@@ -0,0 +1,82 @@
+# =============================================================================
+# 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 .
+# =============================================================================
+
+
+import math
+from abc import ABCMeta, abstractmethod
+
+
+class PointGetter(metaclass=ABCMeta):
+
+ def __init__(self, graph):
+ self.graph = graph
+
+ @abstractmethod
+ def getRange(self, mainParamRange, miscParams, fit, tgt):
+ raise NotImplementedError
+
+ @abstractmethod
+ def getPoint(self, mainParamRange, miscParams, fit, tgt):
+ raise NotImplementedError
+
+
+class SmoothPointGetter(PointGetter, metaclass=ABCMeta):
+
+ def __init__(self, graph, baseResolution=200):
+ super().__init__(graph)
+ self._baseResolution = baseResolution
+
+ def getRange(self, mainParamRange, miscParams, fit, tgt):
+ xs = []
+ ys = []
+ commonData = self._getCommonData(miscParams=miscParams, fit=fit, tgt=tgt)
+ for x in self._iterLinear(mainParamRange[1]):
+ y = self._calculatePoint(x=x, miscParams=miscParams, fit=fit, tgt=tgt, commonData=commonData)
+ xs.append(x)
+ ys.append(y)
+ return xs, ys
+
+ def getPoint(self, mainParam, miscParams, fit, tgt):
+ commonData = self._getCommonData(miscParams=miscParams, fit=fit, tgt=tgt)
+ x = mainParam[1]
+ y = self._calculatePoint(x=x, miscParams=miscParams, fit=fit, tgt=tgt, commonData=commonData)
+ return x, y
+
+ def _iterLinear(self, valRange):
+ rangeLow = min(valRange)
+ rangeHigh = max(valRange)
+ # Resolution defines amount of ranges between points here,
+ # not amount of points
+ step = (rangeHigh - rangeLow) / self._baseResolution
+ if step == 0 or math.isnan(step):
+ yield rangeLow
+ else:
+ current = rangeLow
+ # Take extra half step to make sure end of range is always included
+ # despite any possible float errors
+ while current <= (rangeHigh + step / 2):
+ yield current
+ current += step
+
+ def _getCommonData(self, miscParams, fit, tgt):
+ return {}
+
+ @abstractmethod
+ def _calculatePoint(self, x, miscParams, fit, tgt, commonData):
+ raise NotImplementedError
diff --git a/gui/builtinGraphs/base.py b/gui/builtinGraphs/base/graph.py
similarity index 73%
rename from gui/builtinGraphs/base.py
rename to gui/builtinGraphs/base/graph.py
index 9bd8434c9..26d17e05f 100644
--- a/gui/builtinGraphs/base.py
+++ b/gui/builtinGraphs/base/graph.py
@@ -20,7 +20,7 @@
import math
from abc import ABCMeta, abstractmethod
-from collections import OrderedDict, namedtuple
+from collections import OrderedDict
from eos.saveddata.fit import Fit
from eos.saveddata.targetProfile import TargetProfile
@@ -28,25 +28,6 @@ from eos.utils.float import floatUnerr
from service.const import GraphCacheCleanupReason
-YDef = namedtuple('YDef', ('handle', 'unit', 'label'))
-XDef = namedtuple('XDef', ('handle', 'unit', 'label', 'mainInput'))
-VectorDef = namedtuple('VectorDef', ('lengthHandle', 'lengthUnit', 'angleHandle', 'angleUnit', 'label'))
-
-
-class Input:
-
- def __init__(self, handle, unit, label, iconID, defaultValue, defaultRange, mainOnly=False, mainTooltip=None, secondaryTooltip=None):
- self.handle = handle
- self.unit = unit
- self.label = label
- self.iconID = iconID
- self.defaultValue = defaultValue
- self.defaultRange = defaultRange
- self.mainOnly = mainOnly
- self.mainTooltip = mainTooltip
- self.secondaryTooltip = secondaryTooltip
-
-
class FitGraph(metaclass=ABCMeta):
# UI stuff
@@ -247,80 +228,3 @@ class FitGraph(metaclass=ABCMeta):
denormalizer = self._denormalizers[key]
values = [denormalizer(v, fit, tgt) for v in values]
return values
-
-
-class PointGetter(metaclass=ABCMeta):
-
- def __init__(self, graph):
- self.graph = graph
-
- @abstractmethod
- def getRange(self, mainParamRange, miscParams, fit, tgt):
- raise NotImplementedError
-
- @abstractmethod
- def getPoint(self, mainParamRange, miscParams, fit, tgt):
- raise NotImplementedError
-
-
-class SmoothPointGetter(PointGetter, metaclass=ABCMeta):
-
- def __init__(self, graph, baseResolution=200):
- super().__init__(graph)
- self._baseResolution = baseResolution
-
- def getRange(self, mainParamRange, miscParams, fit, tgt):
- xs = []
- ys = []
- commonData = self._getCommonData(miscParams=miscParams, fit=fit, tgt=tgt)
- for x in self._iterLinear(mainParamRange[1]):
- y = self._calculatePoint(x=x, miscParams=miscParams, fit=fit, tgt=tgt, commonData=commonData)
- xs.append(x)
- ys.append(y)
- return xs, ys
-
- def getPoint(self, mainParam, miscParams, fit, tgt):
- commonData = self._getCommonData(miscParams=miscParams, fit=fit, tgt=tgt)
- x = mainParam[1]
- y = self._calculatePoint(x=x, miscParams=miscParams, fit=fit, tgt=tgt, commonData=commonData)
- return x, y
-
- def _iterLinear(self, valRange):
- rangeLow = min(valRange)
- rangeHigh = max(valRange)
- # Resolution defines amount of ranges between points here,
- # not amount of points
- step = (rangeHigh - rangeLow) / self._baseResolution
- if step == 0 or math.isnan(step):
- yield rangeLow
- else:
- current = rangeLow
- # Take extra half step to make sure end of range is always included
- # despite any possible float errors
- while current <= (rangeHigh + step / 2):
- yield current
- current += step
-
- def _getCommonData(self, miscParams, fit, tgt):
- return {}
-
- @abstractmethod
- def _calculatePoint(self, x, miscParams, fit, tgt, commonData):
- raise NotImplementedError
-
-
-class FitDataCache:
-
- def __init__(self):
- self._data = {}
-
- def clearForFit(self, fitID):
- if fitID in self._data:
- del self._data[fitID]
-
- def clearAll(self):
- self._data.clear()
-
-
-# noinspection PyUnresolvedReferences
-from gui.builtinGraphs import *