Sequence#
- class pypulseqpp.Sequence[source]#
A Pulseq sequence containing events, blocks and definitions.
- Parameters:
- Attributes:
system (Opts | None, default=None) – The limits the sequence was constructed with.
num_blocks (int) – Number of blocks; equivalent to
len(seq).block_durations (MutableMapping[int, float]) – Duration of each block in seconds, keyed by 1-based block index. Assigning an entry changes the stored block duration.
block_events (dict[int, NDArray[np.int32]]) – Event IDs of each block, keyed by 1-based block index: delay, RF, gx, gy, gz, ADC and extension. The delay column is zero for Pulseq 1.5. Reading it allocates a dictionary for all blocks.
definitions (dict[str, Any]) – The definitions written to the [DEFINITIONS] section.
grad_raster_time (float) – Gradient raster in seconds.
rf_raster_time (float) – RF raster in seconds.
adc_raster_time (float) – ADC dwell raster in seconds.
block_duration_raster (float) – Block duration raster in seconds; every block duration is a whole number of these.
version_major (int) – Major version of the Pulseq format the sequence is held as. A file older than 1.5 is converted as it is read, so this is the format of the sequence in memory, not the version its file declared.
version_minor (int) – Minor version of the format the sequence is held as.
version_revision (int) – Revision of the format the sequence is held as.
signature_type (str | None) – Hash algorithm of the signature carried by the last file written, or by the last binary file read:
'md5', or None when it had none.signature_file (str | None) – Format that file was written in,
'text'or'bin'.signature_value (str | None) – The signature itself.
Examples
>>> import pypulseqpp as pp >>> seq = pp.Sequence(pp.Opts()) >>> seq.add_block(pp.make_trapezoid("x", area=1000, duration=2e-3)) 1 >>> seq.add_block(pp.make_delay(1e-3)) 2 >>> seq.num_blocks, round(seq.duration()[0], 6) (2, 0.003)
Blocks#
Append one block playing |
|
Write |
|
Decode a block by its 1-based index. |
|
Return the 1-based index of the block containing time |
|
Merge identical library rows and renumber the references to them. |
Definitions and labels#
Record |
|
Return the value recorded for |
|
Copy every definition from |
|
Evaluate running label values in block order. |
|
Append a block setting TRID to the number assigned to |
|
Return the TRID number assigned to |
Soft delays#
Set each named soft delay to the value given. |
|
Return each soft delay's default value. |
Reading and writing#
Replace this sequence with the one in |
|
Write Pulseq text and record its signature metadata. |
|
Write Pulseq binary, with float32 shape samples. |
|
Write Pulseq 1.4.1 text, for an interpreter predating Pulseq 1.5. |
|
Return the block table and every library, as a Pulseq file of the sequence holds them. |
Waveforms and k-space#
Return gradient corners as time (s) over amplitude (Hz/m), per axis. |
|
Return the gradient waveforms, the RF pulse timing and the ADC sampling. |
|
Return physical-axis gradient splines in Hz/m over seconds. |
|
Integrate physical-axis gradients with excitation resets and refocusing. |
|
Return the k-space location of each ADC sample, in 1/m. |
|
Return ADC sample times (s) and per-window frequency (Hz) and phase (rad). |
|
Return RF pulse centre times with their frequency and phase offsets. |
|
Return total duration, block count and per-event block counts. |
Checks and reports#
Check timing, gradient continuity and the stored total duration. |
|
Return sequence timing, encoding and gradient statistics, formatted as text. |
|
Return timing, encoding and gradient statistics. |
|
Return the RF's mean power, peak power, RMS amplitude and energy. |
|
Return the flip angle of each RF event of the library, in degrees. |
|
Return the transmit channels each RF event of the library holds. |
Gradient edits#
Negate the amplitude of every gradient on |
|
Scale the amplitude of every gradient on |
Plotting#
Open the sequence in the SeqEyes viewer. |
|
Draw a publication-style diagram of one repetition, using mrsd. |