natekupp / ffx

Fast Function Extraction
http://trent.st/ffx
Other
80 stars 93 forks source link

Prevent a ValueError if the input variable has constant value #33

Closed yslai closed 3 years ago

yslai commented 6 years ago

Currently, input variables with a constant value will abort with ValueError: arange: cannot compute length, due to numpy.arange() cannot handling ranges with zero length. This modification adjusts the range min/max such there is a small offset.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.4%) to 76.852% when pulling 0984d2774daf7941d680e17d90b1860db9fa1d7c on yslai:master into 77cc110960828dcf66e0462170319bc69a8ce34c on natekupp:master.

natekupp commented 6 years ago

@jmmcd mind taking a look?

yslai commented 6 years ago

The previous PR did not properly handle magnitudes far away from 1. This revised version dynamically sets rangex according to the floating point property. Also, minx and maxx are now scaled to properly recover len(thrs) == ss.num_thrs_per_var + 1 further down in the code.

pizzooid commented 5 years ago

In #36 (detail) i also had to include a fix for this issue but i think that @jmmcd is right a new threshold for a variable with a constant value is unnecessary and should call continue.

natekupp commented 3 years ago

closing this as stale, but please re-open if this is still an issue