Skip to content

Adds the option to calculate sequence waveforms by multiple processes#152

Draft
schote wants to merge 14 commits into
mainfrom
parallel-sequence-calculation
Draft

Adds the option to calculate sequence waveforms by multiple processes#152
schote wants to merge 14 commits into
mainfrom
parallel-sequence-calculation

Conversation

@schote
Copy link
Copy Markdown
Owner

@schote schote commented Feb 8, 2026

  • Splits waveform calculation and sequence provider into two modules
  • Adds two-staged sequence calculation: After sequence was initialized, digital control signals are added sequentially (fast). In a second step the heavy computation of all the waveforms is done. This can be done sequentially or by using multiple processes.
  • Uses np.memmap to store the calculated sequence waveforms

To do:

  • Compare np.memmap and shared memory

@schote schote self-assigned this Feb 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 8, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/console
   __init__.py10190%11
src/console/interfaces
   acquisition_data.py1232580%96–99, 110–111, 129–130, 145–148, 158–159, 188–189, 193–199, 215–216, 227, 231, 249
   acquisition_parameter.py107694%126, 147–148, 163, 178, 213
   device_configuration.py55296%61, 67
   dimensions.py962574%45–46, 67–68, 71, 74, 78–80, 89, 95, 101, 107, 113–115, 125–127, 137–139, 149–151
   rx_data.py861879%77–81, 89, 101, 105, 107, 122, 130–135, 143, 151, 154, 157
src/console/pulseq_interpreter
   _block_calculator_backup.py81810%3–266
   block_calculator.py1131190%49, 51, 59, 92, 111, 123, 129–130, 239–241
   sequence_provider.py2208362%84, 141, 164, 174–178, 180–181, 187–190, 206–209, 212, 236–238, 294–336, 352–354, 358–360, 366–367, 409, 412–421, 426–430, 435–438, 446–447, 449–450, 455, 457–458, 465, 469
src/console/spcm_control
   abstract_device.py79790%2–149
   acquisition_control.py1481480%3–362
   rx_device.py2092090%2–493
   tx_device.py1691690%3–431
src/console/spcm_control/spcm
   pyspcm.py1611610%3–295
   tools.py54540%3–128
src/console/utilities
   json_encoder.py8362%22–24
   load_configuration.py20670%18–20, 28–30
   plot.py531670%31–32, 80–98
src/console/utilities/data
   mrd_helper.py43881%37, 43, 49, 52, 60, 63, 68, 71
   write_acquisition_to_mrd.py49590%43–44, 68, 86, 91
src/console/utilities/sequences/calibration
   fid_tx_adjust.py22195%66
   se_tx_adjust.py29293%62–64
src/console/utilities/sequences/spectrometry
   fid.py13130%2–74
   se_spectrum.py26292%53, 109
src/console/utilities/sequences/tse
   tse_3d.py2427569%110–111, 113–114, 116–117, 124–125, 127–129, 131–134, 145–148, 153–156, 163–174, 191, 213–220, 226, 257, 320–337, 344–345, 412, 415–427, 535–546
TOTAL5474120378% 

Tests Skipped Failures Errors Time
180 0 💤 0 ❌ 1 🔥 46.114s ⏱️

@schote
Copy link
Copy Markdown
Owner Author

schote commented Feb 9, 2026

@Toreil I noticed that the adc dead times in the adc_library and the adc event returned by get_block do not necessarily align. I think I would rather trust the dead time defined in the adc_block. See imr-framework/pypulseq#365

@schote schote force-pushed the parallel-sequence-calculation branch from e53e4f0 to 06b36b4 Compare February 25, 2026 16:44
@schote
Copy link
Copy Markdown
Owner Author

schote commented Feb 25, 2026

A quick measure of sequence calculation time over number of processes shows the expected behavior:
image

Code snippet:

exec_times = []
processes = [1, 2, 4, 8, 16]
for num_proc in processes:
    with AcquisitionControlManager() as m:
        start_time = time.time()
        m.acquisition.set_sequence(sequence=seq, parameter=console.parameter, num_processes=num_proc)
        exec_times.append(time.time() - start_time)

@schote
Copy link
Copy Markdown
Owner Author

schote commented Feb 25, 2026

This PR already contains #159 and #160. Therefore, these PRs should be merged first.

schote added 13 commits March 17, 2026 12:51
commit 4ca009c
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 18 11:35:33 2026 +0100

    Fix sequence provider, rely on block definition instead of rf_library when calculating rf

commit 0efcdb2
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 18 10:42:31 2026 +0100

    Use seq.system in sequence construction

commit 0882cc0
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 18 10:38:09 2026 +0100

    Update system argument in se und fid sequence

commit cf4f855
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 18 10:29:29 2026 +0100

    Return sequence system by acquisition control

commit e51c7f1
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 18 10:29:17 2026 +0100

    Add optional system to se sequence
commit b216fd8
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 25 16:21:05 2026 +0100

    Fix: Added super init before copying sequence

commit 61eceea
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 25 15:58:43 2026 +0100

    Added docstring

commit 10f0640
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 25 13:32:57 2026 +0100

    Added sequence provider test with real sequence

commit a013df1
Author: David Schote <david.schote@ptb.de>
Date:   Wed Feb 25 13:25:28 2026 +0100

    Added delay to adc for test blocks

commit 2355e53
Author: David Schote <david.schote@ptb.de>
Date:   Mon Feb 23 15:22:03 2026 +0100

    Fixed tests

commit 58d74cf
Author: David Schote <david.schote@ptb.de>
Date:   Mon Feb 23 10:52:38 2026 +0100

    Adjusted sequence testing

commit a40eaeb
Author: David Schote <david.schote@ptb.de>
Date:   Fri Feb 20 15:51:05 2026 +0100

    Adjusted tests

commit 8bf2bca
Author: David Schote <david.schote@ptb.de>
Date:   Fri Feb 20 15:50:58 2026 +0100

    Return pypulseq opts from device config

commit 0fdd95b
Author: David Schote <david.schote@ptb.de>
Date:   Fri Feb 20 15:50:40 2026 +0100

    Revision of sequence provider from/to pypulseq methods
@schote schote force-pushed the parallel-sequence-calculation branch from de3cac4 to 7f5e34f Compare March 17, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant