Reworked piecewise polynomial implementation in Sequence to use scipy's PPoly #140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 to
calculate_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)