MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / _calcPlotPoints

Method _calcPlotPoints

graphs/data/base/graph.py:174–201  ·  view source on GitHub ↗
(self, mainInput, miscInputs, xSpec, ySpec, src, tgt)

Source from the content-addressed store, hash-verified

172
173 # Calculation stuff
174 def _calcPlotPoints(self, mainInput, miscInputs, xSpec, ySpec, src, tgt):
175 mainParamRange = self._normalizeMain(mainInput=mainInput, src=src, tgt=tgt)
176 miscParams = self._normalizeMisc(miscInputs=miscInputs, src=src, tgt=tgt)
177 mainParamRange = self._limitMain(mainParamRange=mainParamRange, src=src, tgt=tgt)
178 miscParams = self._limitMisc(miscParams=miscParams, src=src, tgt=tgt)
179 xs, ys = self._getPlotPoints(
180 xRange=mainParamRange[1], miscParams=miscParams,
181 xSpec=xSpec, ySpec=ySpec, src=src, tgt=tgt)
182 ys = self._denormalizeValues(values=ys, axisSpec=ySpec, src=src, tgt=tgt)
183 # Sometimes x denormalizer may fail (e.g. during conversion of 0 ship speed to %).
184 # If both inputs and outputs are in %, do some extra processing to at least have
185 # proper graph which shows the same value over whole specified relative parameter
186 # range
187 try:
188 xs = self._denormalizeValues(values=xs, axisSpec=xSpec, src=src, tgt=tgt)
189 except ZeroDivisionError:
190 if mainInput.unit == xSpec.unit == '%' and len(set(floatUnerr(y) for y in ys)) == 1:
191 xs = [min(mainInput.value), max(mainInput.value)]
192 ys = [ys[0], ys[0]]
193 else:
194 raise
195 else:
196 # Same for NaN which means we tried to denormalize infinity values, which might be the
197 # case for the ideal target profile with infinite signature radius
198 if mainInput.unit == xSpec.unit == '%' and all(math.isnan(x) for x in xs):
199 xs = [min(mainInput.value), max(mainInput.value)]
200 ys = [ys[0], ys[0]]
201 return xs, ys
202
203 def _calcPoint(self, x, miscInputs, xSpec, ySpec, src, tgt):
204 x = self._normalizeValue(value=x, axisSpec=xSpec, src=src, tgt=tgt)

Callers 1

getPlotPointsMethod · 0.95

Calls 7

_normalizeMainMethod · 0.95
_normalizeMiscMethod · 0.95
_limitMainMethod · 0.95
_limitMiscMethod · 0.95
_getPlotPointsMethod · 0.95
_denormalizeValuesMethod · 0.95
floatUnerrFunction · 0.90

Tested by

no test coverage detected