Sequence.write_v141

Sequence.write_v141#

Sequence.write_v141()[source]#

Write Pulseq 1.4.1 text, for an interpreter predating Pulseq 1.5.

Parameters:
  • name (str | os.PathLike[str]) – Where to write it.

  • create_signature (bool, default=True) – Sign the file, so a reader can tell it has not been edited.

  • gamma (float, default=42576000.0) – Gyromagnetic ratio in Hz/T.

  • field (float, default=1.5) – Main field in T. With gamma, converts ppm offsets, which 1.4.1 has no column for, to absolute offsets.

Returns:

The MD5 signature written, or None if the file is unsigned.

Return type:

str | None

Raises:

RuntimeError – If the sequence carries rotation or RF-shim extensions.

Warns:

UserWarning – When soft delays are omitted.

Examples

>>> import pathlib, tempfile
>>> import pypulseqpp as pp
>>> path = pathlib.Path(tempfile.mkdtemp()) / "gre.seq"
>>> seq = pp.Sequence(pp.Opts())
>>> seq.add_block(pp.make_trapezoid("x", area=1000, duration=2e-3))
1
>>> _ = seq.write_v141(path)
>>> path.read_text().splitlines()[3:6]
['[VERSION]', 'major 1', 'minor 4']