Add optional duration parameter to make_extended_trapezoid_area#351
Conversation
…al input parameter. This is so that extended trapezoids for a given duration, area and gradient start and end points can be created. If no duration is provided, or if duration <=0, the existing minimum duration search is performed.
schuenke
left a comment
There was a problem hiding this comment.
I will have a look at the exact changes later. Unfortunately, the changes are not tracked as say are supposed to be.
However, it would definitely be good to have tests for this new feature.
|
I will open a PR to fix this automatically, but for future commits here and other repositories, I highly recommend to switch your git configuration to use Unix style instead of Windows style line endings. As far as I know, you should be able to do so using: For the moment, to see the code changes ignoring whitespaces / line endings, just use this link: |
|
Hi Patrick. I will add some tests, as you asked. In terms of the line endings, I hadn't realised they would be crlf. I was making these changes on macOS so assumed it would be lf by default. Sorry about that. |
Well.... I was wrong. This isn't a EOL issue, but just a confusing diff output due to the additional indentation. Sorry for the confusion. |
Still, I think #354 is not bad to have anyway :) |
…_area - Add duration parameter to make_extended_trapezoid_area function - Add max_grad and max_slew optional parameters to match other gradient functions - Fix test_make_extended_trapezoid_area_recreate area calculation bug (which one test to fail) - Add tests for duration functionality - Add test for invalid duration error handling
|
Hi Patrick and Matteo, I've added the requested changes and unit tests. I don't understand why some sequence code test failed or why my changes would have caused the reported changes. Are these changes caused by some other commits that have since been merged in? |
|
I just re-run the tests in #353, which is up to date and all tests pass there. So the breaking changes are from this PR. See my comment above for the potential source of error. |
…em.max_slew * 0.99 behaviour to match other gradient functions such as make_trapezoid. 1) Saved new versions of tests/expected_output/write_epi_se_rs.seq and tests/expected_output/write_mprage.seq to account for new max_grad and max_slew behaviour. 2) Updated tests/test_make_extended_trapezoid_area.py to remove system.max_grad * 0.99 behaviour. 3) Removed test_zoo_random in tests/test_make_extended_trapezoid_area.py. 4) Removed assert g.tt.shape[0] <= g_arb.tt.shape[0] and assert g.waveform.shape[0] <= g_arb.waveform.shape[0] checks because this fails when a simple short triangular gradient is passed into points_to_waveform (i.e. when convert_to_arbitrary = True) because points_to_waveform will compress this to 2 points at the centre of the gradient raster periods, rather than 3 points (which is output when convert_to_arbitrary = False). These checks failed with (0, 100000, 1) from the test zoo, for example.
|
Hi @schuenke and @mcencini, could you approve the additional changes I made? In particular, the code no longer uses 99% of max_grad or max_slew, bringing it inline with other pypulseq code, with the corresponding seq file unit test being updated accordingly. Additionally, the input parameter ordering has been returned to the original order to preserve previous behavior, with the new input parameters added at the end. |
Modified make_extended_trapezoid_area to take duration as an optional input parameter. This is so that extended trapezoids for a given duration, area and gradient start and end points can be created. If no duration is provided, or if duration <=0, the existing minimum duration search is performed.