SequenceApp#
- class pypulseqpp.sequences.SequenceApp[source]#
Bases:
ABCA complete sequence, designed from a prescription and played one repetition at a time.
Constructing an application designs it:
init_sequencereceives the prescription and builds the events and the sampling order. Nothing is played untildesign(), which starts a newseq, runsloop()– the scan loop, callingkernel()once per repetition – and thenfinalize(). Calling the application plays one kernel call, so a single repetition or a chunk of the scan is written the same way the whole scan is.Construction therefore checks a prescription:
init_sequenceraises when the prescription cannot be designed. It records the values the design chooses or adjusts withresolve(), and the scan time asduration, so thatresolvedandscan_time()are available without playing the loop.Class attributes are the settings a user does not prescribe. A subclass that changes one, and nothing else, is the same sequence under a different setting:
class GentleGre2D(Gre2DApp): MAX_SLEW = 120.0
- Attributes:
MAX_GRAD, MAX_SLEW (float) – Gradient (mT/m) and slew (T/m/s) ceilings the sequence is held under, together with what
systemreports. Every concrete application sets both; there is no default.system (pypulseqpp.Opts) – The limits the sequence was designed under.
seq (pypulseqpp.Sequence) – What has been played so far.
Examples
A subclass states its ceilings, designs from the prescription in
init_sequence, plays the scan inloopand records the definitions a reconstruction reads infinalize:>>> import pypulseqpp as pp >>> import pypulseqpp.sequences as design >>> class HardPulseTrain(design.SequenceApp): ... MAX_GRAD = 40.0 ... MAX_SLEW = 150.0 ... NAME = "hard_pulse_train" ... def init_sequence(self, n_lines: int = 4): ... self.excitation = design.NonSelectiveExcitation(self.system, 10.0, 0.5e-3) ... self.n_lines = n_lines ... def loop(self): ... for line in range(self.n_lines): ... self.kernel(line) ... def kernel(self, line): ... self.seq.add_block(self.excitation.rf, *self.labels(LIN=line)) ... def finalize(self): ... self.seq.set_definition("Name", self.NAME) >>> seq = HardPulseTrain(n_lines=4).design() >>> seq.num_blocks, seq.get_definition("Name") (4, 'hard_pulse_train')
Methods
Build the whole scan, or the named prescan, into a new |
|
Complete |
|
Design the events and the sampling order from the prescription. |
|
Add the blocks of one repetition to |
|
Return the label events that set each label to its new value. |
|
Run the whole scan, calling |
|
Return each parameter of |
|
Return the prescans played before this sequence, as the loops that play them. |
|
Return the prescription |
|
Record the value a prescribed parameter took in the design. |
|
Write every label's next value as a SET, regardless of what was written before. |
|
Return the time the whole chain of prescans and main sequence plays, in seconds. |
|
Design and write the chain of prescans and the main sequence. |
Attributes
Written as the |
|
Time the whole chain of prescans and main sequence plays, in seconds, when |
|
Module-level entry point of a concrete sequence implementation. |
|
The prescription as designed, by parameter name, in each parameter's prescribed unit. |
|