Return input data in InputData objects for easier access

This commit is contained in:
DarkPhoenix
2019-06-27 18:52:23 +03:00
parent 1e760b2111
commit ef81f9c830
3 changed files with 55 additions and 47 deletions

View File

@@ -82,11 +82,10 @@ class Graph(metaclass=ABCMeta):
def redrawOnEffectiveChange(self):
return False
def getPlotPoints(self, fit, extraData, xRange, xAmount, yType):
def getPlotPoints(self, mainInput, miscInputs, xSpec, ySpec, fit, tgt=None):
try:
plotData = self._cache[fit.ID][yType]
plotData = self._cache[fit.ID][ySpec]
except KeyError:
xRange = self.parseRange(xRange)
extraData = {k: float(v) if v else None for k, v in extraData.items()}
graph = getattr(self, self.yDefs[yType].eosGraph, None)
plotData = graph.getPlotPoints(fit, extraData, xRange, xAmount)
@@ -94,23 +93,12 @@ class Graph(metaclass=ABCMeta):
fitCache[yType] = plotData
return plotData
def parseRange(self, string):
m = re.match('\s*(?P<first>\d+(\.\d+)?)\s*(-\s*(?P<second>\d+(\.\d+)?))?', string)
if m is None:
return (0, 0)
first = float(m.group('first'))
second = m.group('second')
second = float(second) if second is not None else 0
low = min(first, second)
high = max(first, second)
return (low, high)
def clearCache(self, key=None):
if key is None:
self._cache.clear()
elif key in self._cache:
del self._cache[key]
for yDef in self.yDefs.values():
for yDef in self.yDefs:
getattr(self, yDef.eosGraph).clearCache(key=key)