Skip to content

[v1.5.x] Refactor set_block() and get_block() functions#341

Open
mcencini wants to merge 13 commits into
imr-framework:masterfrom
mcencini:v1.5.1-gradcheck
Open

[v1.5.x] Refactor set_block() and get_block() functions#341
mcencini wants to merge 13 commits into
imr-framework:masterfrom
mcencini:v1.5.1-gradcheck

Conversation

@mcencini

@mcencini mcencini commented Jan 14, 2026

Copy link
Copy Markdown
Collaborator

This PR refactors set_block() and get_block() to align with upstream MATLAB repository and enable inclusion of new extensions. Specifically:

  1. set_block(): gradient continuity check is moved to a separate function to improve readability and aligned to upstream MATLAB repository to enable rotation extension aware gradient continuity check.
  2. get_block() : function is refactored to aligned with upstream MATLAB repository and enable addition of rotation and rf shim extensions.

All changes are purely internal and do not impact current functionality / API; also, this can fit 1.5.0 version as it does not depend on interpreter support.

@mcencini mcencini mentioned this pull request Jan 14, 2026
8 tasks
@github-actions

github-actions Bot commented Jan 14, 2026

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
/home/runner/.local/lib/python3.12/site-packages/pypulseq
   add_gradients.py1376056%44, 52, 58, 61, 75–86, 92, 125–128, 135–136, 155, 162, 167–263
   add_ramps.py36360%1–92
   align.py35489%41, 45, 69, 73
   calc_duration.py33294%43, 50
   calc_ramp.py2202162%48–359
   calc_rf_bandwidth.py372824%45–81, 85–89
   check_timing.py962970%78, 82, 107, 180, 199, 232, 239, 249–293
   compress_shape.py30197%28
   convert.py40880%42, 48, 66, 72–73, 82, 88–89
   event_lib.py961485%6–9, 48–51, 70–71, 205–210
   make_adc.py981486%77, 80, 90–94, 97, 146, 149, 153, 159, 163, 202, 204, 206, 214
   make_adiabatic_pulse.py1323970%208–212, 232–236, 244–245, 268, 274, 343–362, 466–475, 513–521
   make_arbitrary_grad.py531572%71, 74, 77, 80, 96–98, 107, 109, 117–121, 130
   make_arbitrary_rf.py756316%95–179
   make_block_pulse.py48394%121–125, 128
   make_delay.py9189%27
   make_digital_output_pulse.py16288%42, 50
   make_extended_trapezoid.py561279%67, 70, 76, 82, 85, 88, 91, 94, 116, 134, 136, 139
   make_extended_trapezoid_area.py104496%68, 71, 261, 264
   make_gauss_pulse.py732073%142–146, 149–173, 180, 183
   make_label.py22482%64, 66, 68, 75
   make_sigpy_pulse.py1193075%12–13, 122, 125, 129, 166–170, 174, 177–178, 181–182, 197, 204, 209, 221, 224, 249–259, 273, 276, 306–316
   make_sinc_pulse.py701086%104, 110, 138–142, 146, 149–150, 153–154, 176
   make_soft_delay.py26292%107, 125
   make_trapezoid.py111794%177, 190, 196, 214, 232, 237, 255
   make_trigger.py16288%47, 55
   opts.py66986%78, 83, 102, 142, 166–170
   points_to_waveform.py9189%27
   rotate.py691480%15, 55, 66–69, 85–90, 112, 119–120
   scale_grad.py30197%65
   sigpy_pulse_opts.py26773%34–41
   split_gradient.py393121%46–103
   split_gradient_at.py702761%63–90, 110, 114, 118–120, 154–156
   traj_to_grad.py13931%26–40
/home/runner/.local/lib/python3.12/site-packages/pypulseq/SAR
   SAR_calc.py5180%9
/home/runner/.local/lib/python3.12/site-packages/pypulseq/Sequence
   block.py4526187%64, 67, 75, 81, 96, 104, 110, 121, 124, 127, 135, 140, 149, 160, 168, 208, 210, 214, 329, 333, 336, 357, 372, 382, 393, 402, 432–440, 447, 460, 471, 480–484, 502, 534–541, 558, 568, 594, 632, 650, 653, 671, 685, 712, 791, 828, 852
   calc_grad_spectrum.py81766%68–190
   calc_pns.py403122%45–96
   ext_grad_check.py75988%55, 60, 174–181
   ext_test_report.py1671193%79, 156, 167–168, 337–343
   install.py754244%31, 52, 69, 71, 112–131, 148, 181–184, 200–212, 254–278
   parula.py4250%19–86
   read_seq.py4003990%44–45, 110, 117, 130, 133–134, 138, 184, 228, 401, 422–439, 502, 505, 590, 614, 654, 685, 701–705, 712, 823, 834
   sequence.py64013379%10–13, 107–117, 138–151, 205, 270–273, 320, 364, 440, 467–472, 509, 537–540, 631, 659–668, 680, 702, 743–746, 775, 801–807, 842, 853–854, 860, 871, 877, 879, 887, 920–928, 1060, 1158, 1164, 1167, 1170, 1207, 1332–1345, 1403, 1425–1427, 1448, 1511, 1519, 1617, 1628–1641, 1710–1711, 1722–1740, 1764, 1794–1802, 1838, 1852–1862
   write_seq.py362798%45, 77–79, 313, 347–349, 499
/home/runner/.local/lib/python3.12/site-packages/pypulseq/utils
   cumsum.py14193%17
   paper_plot.py63588%49–132
   safe_pns_prediction.py12611310%50–87, 102–189, 197–214, 222, 244–250, 279–286, 310–336, 344–383, 396–411, 415
   seq_plot.py40718654%22, 106, 138–139, 159, 176–178, 183–225, 235–242, 249–314, 318–324, 328–336, 359, 361, 363, 390–412, 457–458, 461–464, 487–496, 508, 525–535, 544–546, 565–567, 569–570, 572–573, 657–658, 674–691, 739–743
   tracing.py16662%33–34, 42, 54–55, 75
/home/runner/.local/lib/python3.12/site-packages/pypulseq/utils/siemens
   asc_to_hw.py58539%21–28, 48–106
   readasc.py59788%103–104, 110–111, 122–124
TOTAL5260156170% 

Tests Skipped Failures Errors Time
1288 24 💤 0 ❌ 0 🔥 3m 47s ⏱️

@mcencini mcencini changed the title [v1.5.1] Refactor gradient continuity check [v1.5.x] Refactor set_block() and get_block() functions Jan 14, 2026
@mcencini mcencini requested a review from schuenke February 11, 2026 09:55
mcencini added a commit to mcencini/pypulseq that referenced this pull request Feb 27, 2026
Removed handling for 'rf_shim' event type in set_block() - will re-add after merging imr-framework#341
@schuenke schuenke self-assigned this May 7, 2026
@schuenke

schuenke commented May 7, 2026

Copy link
Copy Markdown
Collaborator

I am currently reviewing this. Are you fine with me commiting changes directly or would you prefer comments only?

@mcencini

mcencini commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

Hi Patrick, of course I am fine, and thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants