Sequence.write#
- Sequence.write()[source]#
Write Pulseq text and record its signature metadata.
With
v141_compat=True, metadata is recorded on the written source (the deduplicated copy when requested).- 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.
remove_duplicates (bool, default=True) – Collapse identical library rows first. Write a collapsed copy, leaving this sequence’s event libraries unchanged.
check_timing (bool, default=False) – Judge the timing first, and warn if anything is wrong.
v141_compat (bool, default=False) – Write 1.4.1 instead, for an interpreter that predates 1.5.
- Returns:
The signature written, or None if the file is unsigned. It is the signature of what was written, so with
remove_duplicatesit belongs to the collapsed copy rather than to this sequence.- Return type:
str | None
- Warns:
UserWarning – If
check_timingis set and the timing check finds anything.
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(pathlib.Path(folder) / "gre.seq") >>> len(signature), seq.signature_type, seq.signature_file (32, 'md5', 'text')