self.info = info
self._rescale = rescale
if rescale == True:
- self._data_scale_factor = data.std()
+ for x in [data.std(), data.max()-data.min(), abs(data.max()), 1.0]:
+ if x != 0:
+ self._data_scale_factor = x
+ break
else:
self._data_scale_factor = 1.0
if self._rescale == True:
params = [p*s for p,s in zip(params, self._param_scale_factors)]
residual = self._data - self.model(params)
- if self._rescale == True or False:
+ if self._rescale == True:
residual /= self._data_scale_factor
return residual