SequenceLibraries

SequenceLibraries#

class pypulseqpp.io.SequenceLibraries[source]#

Bases: object

A sequence’s block table and every library it holds, as read-only arrays.

Each table is a section of a Pulseq file of the sequence, with the file’s columns in the file’s order and without its id column. Times are in seconds; every other column is in the file’s unit. Ids are 1-based and 0 names no event: row i holds id i + 1, except in the two gradient tables, which share one numbering and list the id each row holds. Columns holding ids hold whole numbers.

Attributes:
  • layout (int) – The layout of these tables, 1 for the one described here. It rises when a table gains, loses or reorders a column, or a column changes unit.

  • block_durations (NDArray[np.float64]) – (N,): each block’s duration.

  • blocks (NDArray[np.int32]) – (N, 6): each block’s RF, gx, gy, gz, ADC and extension ids.

  • rf (NDArray[np.float64]) – (R, 10): amplitude in Hz; the magnitude, phase and time shape ids, 0 for a time shape on the RF raster; centre; delay; frequency ppm offset in ppm; phase ppm offset in rad/MHz; frequency offset in Hz; phase offset in rad.

  • rf_use (tuple[str, …]) – Per RF id, the event’s use: 'excitation', 'refocusing', 'inversion', 'saturation', 'preparation', 'other' or 'undefined'.

  • trapezoid_ids (NDArray[np.int32]) – (T,): the gradient id each row of trapezoids holds.

  • trapezoids (NDArray[np.float64]) – (T, 5): amplitude in Hz/m; rise, flat and fall times; delay.

  • arbitrary_gradient_ids (NDArray[np.int32]) – (A,): the gradient id each row of arbitrary_gradients holds.

  • arbitrary_gradients (NDArray[np.float64]) – (A, 6): amplitude, first and last values in Hz/m; the waveform shape id; the time shape id, 0 for samples at the centres of the gradient raster and -1 for samples every half raster; delay.

  • adc (NDArray[np.float64]) – (D, 8): sample count; dwell; delay; frequency ppm offset in ppm; phase ppm offset in rad/MHz; frequency offset in Hz; phase offset in rad; the phase-modulation shape id, 0 for none.

  • shapes (tuple[Shape, …]) – By shape id. An RF magnitude is normalised to its peak, an RF phase is in cycles, a gradient waveform is normalised to its amplitude, a time shape counts rasters and a phase modulation is in rad.

  • extensions (NDArray[np.int32]) – (E, 3): each link’s extension type id, the id of the row it names in that type’s table, and the id of the next link, 0 ending the chain.

  • extension_types (dict[str, int]) – The type id of each extension the sequence numbers, by name.

  • triggers (NDArray[np.float64]) – (G, 4): control code, 1 for an output and 2 for an input; channel code; delay; duration.

  • rotations (NDArray[np.float64]) – (Q, 4): a unit quaternion, scalar first.

  • label_set_values, label_inc_values (NDArray[np.int32]) – (L,): the value each row sets its label to or increments it by.

  • label_set_labels, label_inc_labels (tuple[str, …]) – The label each row names.

  • rf_shims (tuple[NDArray[np.float64], …]) – Per row, one magnitude and one phase in rad for each transmit channel, alternating.

  • soft_delays (NDArray[np.float64]) – (S, 3): the delay’s number, offset and factor.

  • soft_delay_hints (tuple[str, …]) – The hint each soft-delay row names.

Attributes