SequenceDescription#

class blochsim.SequenceDescription[source]#

Bases: object

Event stream and RF resources of one repetition of a sequence.

The ratio crusher_dephasing_rad / voxel_size_m sets the b-factor diffusion is damped by and the phase each dephasing order acquires under flow; a zero dephasing leaves both out. voxel_size_m also sets the distance a moving spin crosses, which washes out the voxel; None declares no voxel, so spin velocity has no effect.

subsequence_index#

Index of this subsequence within a multi-part acquisition.

Type:

int

tr_duration_us#

Duration of one playing of the stream, in microseconds.

Type:

float or torch.Tensor

events#

Events in play order.

Type:

tuple of SequenceEvent

rf_definitions#

{id: RfDefinition} for the pulses the RF events name.

Type:

dict

shim_definitions#

{id: ShimDefinition} for the shims the RF events name.

Type:

dict

crusher_dephasing_rad#

Dephasing wound across one voxel by the unbalanced gradient, in radians.

Type:

float

voxel_size_m#

Voxel length the dephasing is wound across, in metres.

Type:

float, default=None

rf_raster_time_s#

Dwell the RF shapes are sampled on, in seconds. Pulses are integrated against it.

Type:

float

Methods

from_operators

Build a description by laying operators out end to end.

from_pulseq

Read one repetition of a Pulseq sequence.

plot

Plot the events: RF as stems of height equal to the flip, ADC as markers.

classmethod from_operators()[source]#

Build a description by laying operators out end to end.

Parameters:
  • *parts (Operator or tuple) – Operators in play order, or (offset_s, operator) pairs.

  • rf_definitions (mapping, default=None) – {id: RfDefinition}. One ideal pulse under id 0 when not given.

  • shim_definitions (mapping, default=None) – {id: ShimDefinition}.

  • subsequence_index (int, default=0) – Index of the subsequence within a scan.

  • crusher_dephasing_rad (float, default=0.0) – Dephasing of one crusher across a voxel, in radians. Diffusion and flow are zero without it.

  • voxel_size_m (float, default=None) – Voxel length the dephasing is wound across, in metres.

  • start_s (float or torch.Tensor, default=0.0) – Start time of the first operator, in seconds.

Returns:

Lasting as long as the operators laid out end to end.

Return type:

SequenceDescription

classmethod from_pulseq()[source]#

Read one repetition of a Pulseq sequence.

Parameters:
  • source (str, Path or sequence) – A .seq file, or an in-memory pypulseq or pypulseqpp Sequence.

  • **settings – tr_index, subsequence_index, crusher_dephasing_rad and voxel_size_m, as for read_pulseq_description: tr_index is the repetition to read, in whole TRSize windows.

Returns:

One repetition, with events in microseconds from the start of the repetition.

Return type:

SequenceDescription

Raises:

ValueError – If the file declares no TRSize, tr_index is out of range, or the repetitions differ and none was named.

plot()[source]#

Plot the events: RF as stems of height equal to the flip, ADC as markers.

Parameters:
  • axis (matplotlib.axes.Axes, default=None) – Axes to draw on; a new figure when not given.

  • upto_s (float, default=None) – Plot events up to this time, in seconds.

Returns:

The axes drawn on; time in ms against flip angle in degrees.

Return type:

matplotlib.axes.Axes

Raises:

ImportError – If matplotlib is not installed.

property adc_events#

Return ADC events in state-machine order.