SequencePlugin

Contents

SequencePlugin#

class pulserver.design.SequencePlugin[source]#

Bases: object

A sequence function bound to the entries of the scanner protocol.

A subclass sets app and, for the arguments the operator edits, protocol; without protocol the sequence function plays its defaults. Entries a request omits keep their initial values, the entry’s default or else the sequence function’s. Times travel as integer microseconds and other floats to six significant digits, the precision of a float32 parameter, so a reply stored in scanner parameters and sent back evaluates to itself.

validate() evaluates a request with evaluate(), and design() generates and writes it with generate(). A subclass overrides the hooks evaluate() and generate(), and does not override validate() or design().

Attributes:
  • app (callable) – The sequence function, app(system, **arguments). It takes the scanner limits, a pypulseqpp.Opts, and the keyword arguments the entries of protocol bind, and returns a pypulseqpp.Sequence or a list of them, which is a chain: the prescans first and the main sequence last. The defaults the listing shows are those of its signature, so a functools.partial() is a sequence function too. generate() calls it, and so does an evaluate() that designs the sequence; the default evaluate() does not.

  • protocol (mapping) – The entries the operator edits, by key: the interpreter’s parameter names, which are the members of ProtocolKey that UIParam collects. A plain string naming an entry is stored as its member. Empty by default. An entry that states its default may bind a name the app does not take; it is then read by the plugin’s own evaluate() and generate(), which do not pass it to the app. The options the plugin module declares with option() are added, each an OptionParam at its user entry, named in the user entry’s name.

  • strict_limits (bool) – Whether a design that exceeds a limit is refused as designed. By default, False, the design service lowers the slew rate a design exceeding the nerve-stimulation or slew-rate limit is made under and designs it again; a strict plugin’s design is never adjusted, and each file it writes sets the StrictLimits definition. A design whose sequence sets StrictLimits itself is held strictly too.

Raises:
  • ValueError – When a subclass is defined with a protocol key the interpreter does not know, which its parser would drop, with one of the prescription entries, which pulserver applies itself, or with an entry at the user entry of an option; or with both protocol and ui.

  • TypeError – When a subclass is defined with a class as app.

Warns:

DeprecationWarning – When a subclass sets recon, which has no effect: the reconstruction is named by the reconstruction client or, on a console, by the scan. When a subclass sets follows, which has no effect: the RF a scanner scales is the RfLayout an evaluation returns. When a subclass sets ui, the deprecated name of protocol, or subclasses ScannerSequence, the deprecated name of this class.

Methods

design

Write the sequence of a request into directory as signed binary Pulseq.

evaluate

Evaluate a requested protocol, or refuse it by raising.

generate

Return what design() writes for a protocol.

listing

Return the protocol with its schema, at the sequence function's defaults.

validate

Return the validation of a request, as the wire carries it.

Attributes

options

The plugin's options, by name, at the values it was loaded with.

protocol

reads_exam

Whether evaluate() or generate() takes exam.

strict_limits

app