k-wave-python icon indicating copy to clipboard operation
k-wave-python copied to clipboard

Reduce memory usage in FFTs

Open djps opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. Post-processing currently always auto-casts to double precision for methods that use scipy.fftpack, e.g. extract_amp_and_phase. This can lead to OOM needless errors e.g. there have been cases where the simulation has run, but I have been unable to take the Fourier transform as I run out of memory.

Describe the solution you'd like

  • use scipy.fft instead of scipy.fftpack or numpy.fft as this does not automatically cast to double precision
  • ensure that get_win and extract_amp_phase keep the same precision as the data which is supplied.

Describe alternatives you've considered The new numpy 2.0 will have this capability, as it also upcasts, see issue.

djps avatar Mar 19 '24 19:03 djps

For context: https://stackoverflow.com/questions/30826224/how-to-get-complex64-output-from-numpy-fft

waltsims avatar Mar 19 '24 20:03 waltsims