Denormalize infinity sig as special case, very much like 0 sig

This commit is contained in:
DarkPhoenix
2019-07-26 12:46:40 +03:00
parent ae8fb25d3f
commit a5b22aa112

View File

@@ -18,6 +18,7 @@
# =============================================================================
import math
from abc import ABCMeta, abstractmethod
from collections import OrderedDict, namedtuple
@@ -151,6 +152,11 @@ class FitGraph(metaclass=ABCMeta):
ys = [ys[0], ys[0]]
else:
raise
# Same for NaN which means we tried to denormalize infinity values, which might be the
# case for the ideal target profile with infinite signature radius
if mainInput.unit == xSpec.unit == '%' and all(math.isnan(x) for x in xs):
xs = [min(mainInput.value), max(mainInput.value)]
ys = [ys[0], ys[0]]
return xs, ys
_normalizers = {}
@@ -225,7 +231,7 @@ class FitGraph(metaclass=ABCMeta):
rangeHigh = max(valRange)
# Amount is amount of ranges between points here, not amount of points
step = (rangeHigh - rangeLow) / segments
if step == 0:
if step == 0 or math.isnan(step):
yield rangeLow
else:
current = rangeLow