imr-framework / pypulseq

Pulseq in Python
https://pypulseq.readthedocs.io
GNU Affero General Public License v3.0
125 stars 67 forks source link

Adjust eps value (floating point precision) #193

Closed schuenke closed 3 months ago

schuenke commented 3 months ago

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 of 1.0. However, we ofen store larger values (we decided 1e6 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.