read_mrd_description

read_mrd_description#

torchsim.read_mrd_description(stream)[source]#

Read an MRD stream up to its sequence description.

The messages ahead of the description – a config, a config file name, the XML header, other texts – are read and the stream is left at the message after the description, which is where its first acquisition is.

Parameters:

stream (binary file-like) – The stream, read with read(n): an open file, or a socket’s makefile("rb").

Returns:

  • header (str or None) – The MRD XML header, None if the stream carried none before the description.

  • descriptions (list of SequenceDescription) – One per file of the sequence chain, in play order. RF definitions carry the envelope normalised to a peak of one, played at the event’s amplitude_hz, and their sample times in units of the RF raster.

Raises:

ValueError – If any other message, or the end of the stream, comes before the description.