Sequence.write_binary

Sequence.write_binary#

Sequence.write_binary()[source]#

Write Pulseq binary, with float32 shape samples.

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

  • create_signature (bool, default=True) – Append the signature section: an MD5 of everything above it, so a file says whether it is the file that was written.

Returns:

The signature written, or None when none was asked for.

Return type:

str | None

Examples

>>> import pathlib, tempfile
>>> import pypulseqpp as pp
>>> folder = tempfile.mkdtemp()
>>> seq = pp.Sequence(pp.Opts())
>>> seq.add_block(pp.make_trapezoid("x", area=1000, duration=2e-3))
1
>>> signature = seq.write_binary(pathlib.Path(folder) / "gre.bseq")
>>> len(signature), seq.signature_file
(32, 'bin')