Sequence.write_v141

Sequence.write_v141#

Sequence.write_v141()[source]#

Write the sequence as a Pulseq 1.4.1 text file.

Version 1.4.1 has no columns for RF centre and use, gradient endpoints or ppm offsets; ppm offsets are written as absolute offsets.

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

  • create_signature (bool, default=True) – Append an MD5 signature of the file’s contents.

  • gamma (float, default=None) – Gyromagnetic ratio in Hz/T; the sequence’s system’s when None.

  • field (float, default=None) – Main field strength in T; the sequence’s system’s B0 when None. With gamma, resolves ppm offsets as pypulseqpp.calc_absolute_offsets() does.

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']