Closed FrankZijlstra closed 8 months ago
Thanks for this! I spent a little time on the calculate k-space function but could not get the Scipy version to behave as expected. I ended up translating the MATLAB function to make it work, but that ended up being slow. Glad you got this to work!
This implements
calculate_kspacePP
using scipy'sPPoly
object, which behaves very similar to the Matlab implementation. This is obviously much cleaner, and also much faster. A helper functionget_gradients
is also available to immediately get access to the waveforms inPPoly
format. I renamed the function tocalculate_kspace
, because this function was no longer functional, and not intended to be used anymore anyway. I added a deprecation warning forcalculate_kspacePP
, but this function could also just be removed altogether. This also resolves #107.Furthermore, I split
waveforms_and_times
into three functions:waveforms
,adc_times
, andrf_times
. This allows efficient access to for example only the excitation times (e.g. when only calculating TE/TR).waveforms_and_times
remains compatible with the previous implementation, butrf_times
returns excitation/refocusing times and frequency/phase in separate arrays (instead of the non-intuitivetfp_
variables).Further small changes:
tc
incalculate_kspace
(especially in sequences with ramp-sampling)block_durations
in Sequence to be a dictionary, to avoid potential issues when using non-incremental block IDs (previous code assumed this was the case)waveforms_export
(though this function seems a bit superfluous with the other ways to access this information)