gastropy.read_bids_physio

gastropy.read_bids_physio#

gastropy.read_bids_physio(tsv_path, json_path=None)[source]#

Read a BIDS _physio.tsv.gz and its companion JSON sidecar.

Parameters:
  • tsv_path (str or Path) – Path to a _physio.tsv.gz (or uncompressed _physio.tsv) file. Gzip compression is auto-detected from the .gz extension.

  • json_path (str or Path, optional) – Path to the companion _physio.json sidecar. If None, inferred by replacing the TSV extension with .json.

Returns:

Dictionary with keys:

  • signal : ndarray, shape (n_channels, n_samples)

  • sfreq : float — sampling frequency in Hz

  • columns : list of str — column names from the JSON Columns field

Plus every other key-value pair from the JSON sidecar (e.g. StartTime, TR, Source) stored as-is.

Return type:

dict

Raises:
  • FileNotFoundError – If the TSV or JSON file does not exist.

  • ValueError – If the JSON sidecar is missing required BIDS fields (SamplingFrequency, Columns).