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 the constructor’s 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.register()preserves 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 (s) from the module start, set by the subclass: typically an RF centre or an echo.
Notes
blocksretains the original event objects for replay. Mutating those objects does not rewrite the stored sequence used for analysis. Of the sequence’s methods, onlycalculate_kspace,check_timing,paper_plot,test_reportandwaveforms_and_timesare forwarded toseq.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, whether or not they were added to a block. |
Attributes
Block tuples in play order, holding the original event objects. |
|
Duration of the module (s). |
|
Sequence holding the module's construction-time block layout. |