write#
- pypulseqpp.io.write()[source]#
Write a sequence as Pulseq text or binary.
- Parameters:
seq (pypulseqpp.Sequence) – Sequence to write; not modified.
file_path (str | os.PathLike[str]) – Destination path.
binary (bool, default=False) – Write the binary form instead of text. The binary writer runs no timing check.
create_signature (bool, default=True) – Sign the file, in both forms.
remove_duplicates (bool, default=True) – Write a deduplicated copy, leaving
seqas it is.check_timing (bool, default=True) – Text only: check the timing while writing, which warns about what fails and records
TotalDuration.
- Returns:
The text signature, or None for binary, whose signature is in the file rather than returned.
- Return type:
str or None
See also
readThe other direction.
pypulseqpp.Sequence.writeThe text writer this calls.
pypulseqpp.Sequence.write_binaryThe binary writer this calls.
Examples
>>> import pathlib, tempfile >>> import pypulseqpp as pp >>> directory = pathlib.Path(tempfile.mkdtemp()) >>> seq = pp.Sequence(pp.Opts()) >>> seq.add_block(pp.make_trapezoid("x", area=1000, duration=2e-3)) 1 >>> isinstance(pp.io.write(seq, directory / "gre.seq"), str) True >>> pp.io.write(seq, directory / "gre.bin", binary=True) is None True