k-wave-python
k-wave-python copied to clipboard
Reduce memory usage in FFTs
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.fftinstead ofscipy.fftpackornumpy.fftas this does not automatically cast to double precision - ensure that
get_winandextract_amp_phasekeep 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.
For context: https://stackoverflow.com/questions/30826224/how-to-get-complex64-output-from-numpy-fft