Closed Crm1024 closed 1 year ago
@Crm1024 thank you for opening this issue. Indeed arange
is not suggested for non-integer steps. Your suggestion looks ok. Will you prepare a PR or should I take care of this?
@jankoslavic can you please take care of this. I have not used GitHub before and are not familiar with how to create a PR.
@Crm1024 done with PR: https://github.com/ladisk/pyuff/pull/76
Would you need this to be pushed to pypi or can we wait a little?
PS: I have added another PR and will not push it to pypi. you can upgrade:)
Thank you for the quick response. It works perfectly now.
When calculating the x-axis for dataset 58, a bug exists if the abscissa is evenly spaced. For some combinations of parameters, a floating-point error is induced. The current code:
dset['x'] = np.arange(min_val, min_val + n_val * d, d)
fails if:min_val = 2.5e1 n_val = 101 d = 0.1
The returned array (deset['x']
) has a length of 102, not 101 as it should have.A more robust algorithm is something like:
dset['x'] = min_val + np.arange(n_val) * d
(0.1 can't be represented exactly as a float.
101*0.1 = 10.100000000000001
meaningarange
will create values up to and including 35.1, rather than excluding 35.1)