Reading and writing files

Reading and writing files#

Reading a .seq file into a sequence whose system is built from the file, writing a sequence in the text or the binary form, and the tables a file of a sequence holds, as arrays. Storage, deduplication and file revisions describes what a file records, including which system limits, and the two forms.

File input and output#

Object

Input

Returns

Purpose

read

File path; optional gradient and slew limits

Sequence on a system built from the file

Read with file-derived rasters and limits.

read_chain

First file path; detect_rf_use, verify

(Path, Sequence) pairs in play order

Read a file and the NextSequence files it names, each on a system built from it.

write

Sequence, file path, binary

Text signature, or None for binary

Write Pulseq text or binary.

Library export#

libraries() returns the block table and every library of a sequence as the tables a text file of it holds: the rows write() writes with remove_duplicates=False, under the same ids, in read-only arrays. Times are in seconds and the other columns are in the file’s units.

Object

Input

Returns

Purpose

SequenceLibraries

—

Block table; RF, gradient, ADC, shape and extension tables; layout

A sequence’s libraries without decoding its blocks.

Shape

Sample count, stored values

Shape; decompressed returns the samples

One row of the shape library.