read_chain#
- pypulseqpp.io.read_chain()[source]#
Read a sequence file and every file its
NextSequencedefinitions name, in play order.A
NextSequencename is relative to the directory of the file naming it, aspypulseqpp.sequences.write()writes a scan with prescans. Each file is read byread().- Parameters:
file_path (str | os.PathLike[str]) – The first file of the chain.
detect_rf_use (bool, default=False) – Assign a use to each unlabelled RF event of every file, as
read()does.remove_duplicates (bool, default=True) – Collapse identical library rows of every file after reading.
verify (bool, default=False) – Check every file against the signature it carries.
- Returns:
Each file’s path, joined as the chain names it, and its sequence.
- Return type:
- Raises:
FileNotFoundError – If a file of the chain does not exist.
ValueError – If the chain names a file it has already played.
Examples
>>> import pathlib, tempfile >>> import pypulseqpp as pp >>> directory = pathlib.Path(tempfile.mkdtemp()) >>> for name, following in (("scan.seq", "scan_main.seq"), ("scan_main.seq", "")): ... seq = pp.Sequence(pp.Opts()) ... _ = seq.add_block(pp.make_delay(1e-3)) ... if following: ... seq.set_definition("NextSequence", following) ... _ = pp.io.write(seq, directory / name) >>> [path.name for path, _ in pp.io.read_chain(directory / "scan.seq")] ['scan.seq', 'scan_main.seq']