MAT Reader

class gpype.backend.sources.mat_reader.MatReader[source]

Bases: RecordingReader

Replays a MATLAB v7.3 (.mat) recording as if it were a live source.

Reads back what MatWriter writes – sampling rate, channel labels and roles from the gpype_meta document, falling back to the recorded time column when metadata is absent (a file written by an earlier draft, or a third-party MAT file), and to the caller’s own sampling_rate when neither is available. Markers, gaps and trust come back from gpype_meta too.

__init__(file_name, sampling_rate=None, frame_size=1, speed=1.0, loop=False, mode='realtime', variable_name='data', has_time_row=True, edge_id=None, **kwargs)[source]

Initialize the reader core.

Parameters:
  • file_name (str) – Path to the .mat recording.

  • sampling_rate (Optional[float]) – The recording’s rate, if the file cannot say; one given must agree with a rate it records.

  • frame_size (int) – Samples emitted per cycle. In batch mode the frame is the whole recording.

  • speed (float) – Replay speed relative to real time.

  • loop (bool) – Start again at the end of the file.

  • mode (str) – realtime or batch.

  • variable_name (str) – Name of the dataset MatWriter wrote the recording under.

  • has_time_row (bool) – Whether the dataset’s first row is a time axis rather than a signal channel. Explicit rather than sniffed, so a real signal channel can never be mistaken for one – /gpype_meta, when present, overrides it with what the writer actually did.

  • edge_id (Optional[str]) – Which edge runs this node, matched against the edge process’s –edge-id. None, the default, is every edge; ignored when the pipeline is not distributed.

  • **kwargs – Additional arguments for the parent reader.

Raises:
  • ImportError – If h5py is not installed.

  • ValueError – If no usable rate or dataset can be found, or a sampling_rate, channel_count or batch frame_size given by hand disagrees with the file.