Adjust eps value (floating point precision) #193
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #129 with @FrankZijlstra and @btasdelen and many other issues/slack chats etc., the current value for the floating point precision
np.finfo(np.float64).eps
is only valid at the exact value of1.0
. However, we ofen store larger values (we decided1e6
is a reasonable upper limit for times, grad/rf amplitudes etc), leading to way worse precisions.I added a comment describing how we pick the new value of
eps = 1e-9
now and left the full calculation. Maybe one of both can be removed, but IMO you can never have to much documentation 😄In the future, we might want to define different eps values for times, gradients, rf pulses etc, but I think this value should actually cover everything without beeing to inaccurate.