SequenceModule#
- class pypulseqpp.sequences.SequenceModule[source]#
Bases:
ABCA reusable block layout with named, mutable event templates.
Subclasses assign
self.seqand add blocks ininit_module. Events are published from constructor locals ontoeventsand onto the module itself. Repeated references are deduplicated by identity: one distinct object becomes a scalar event, several become a list in first-seen order. Explicit register calls preserve the supplied structure, including one-element lists.- Parameters:
*args – Forwarded to init_module.
**kwargs – Forwarded to init_module.
- Attributes:
events (types.SimpleNamespace) – Published events. Use this namespace when a name conflicts with a module attribute; publication warns about conflicts.
center (float) – Timing reference in seconds from the module start, set by the subclass: typically an RF centre or an echo.
Notes
blocks retains the original event objects for replay. Mutating those objects does not rewrite the stored sequence used for analysis. Only calculate_kspace, check_timing, test_report and waveforms_and_times are forwarded to seq.
Examples
A subclass assigns
seqand adds its blocks; the constructor’s locals are published under their own names and onevents:>>> import pypulseqpp as pp >>> import pypulseqpp.sequences as design >>> class OneTrapezoid(design.SequenceModule): ... def init_module(self, system): ... self.seq = pp.Sequence(system=system) ... gx = pp.make_trapezoid("x", area=500, system=system) ... self.seq.add_block(gx) ... self.center = 0.5 * pp.calc_duration(gx) >>> module = OneTrapezoid(pp.Opts()) >>> module.gx.channel, len(module.blocks) ('x', 1) >>> module.gx is module.events.gx True
Methods
Build the module's block layout; implemented by the subclass. |
|
Publish events from the caller's locals and register keyword aliases. |
|
Publish named events without requiring prior block registration. |
Attributes
Return block tuples in play order, retaining the original event objects. |
|
Duration of the module in seconds. |
|
Sequence holding the module's construction-time block layout. |