-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added gradient spectrum calculations #170
Added gradient spectrum calculations #170
Conversation
…ectrum`) - Added `asc_to_acoustic_resonances` function to get acoustic resonance ranges from Siemens asc files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I am missing appropriate example data, I was not able to check if the code works as expected and especially if the results fit to the Matlab results. Would be nice if you could check this on your own and confirm that it's true.
Maybe you can even add a figure of the comparison to this PR.
Having (some) tests would ofc also be nice, but due to the fact that most of the code is currently untested, this is probably nothing I can ask for 😀
Still, I added some comments that might help to improve the code style and the compatibility with (future) type checkers.
- Minor beauty fixes and type hints - Renamed 'sos' to 'rss' - Renamed `spectrogram_sos` to `spectrogram_rss`
- Changed `time_range` type hint to `Union` to be compatible with older python versions - Changed initialization of `spectrogram_rss` from `0` to `np.array(0)`
This PR adds the gradient spectrum calculation as available in MATLAB Pulseq: https://github.com/pulseq/pulseq/blob/master/matlab/demoUnsorted/gradSpectrum.m
The implementation provides a fair number of parameters to control how the calculation is actually done (as we're not entirely sure what is the best way to go about this). The defaults should be sufficient to avoid peaks in the spectrum at the acoustic resonances of your scanner (and avoid damaging the gradient coils).
Basic usage (will plot the spectrums and also return them):
Or including plotting the acoustic resonance ranges from a Siemens .asc file: