gastropy.write_bids_physio

gastropy.write_bids_physio#

gastropy.write_bids_physio(tsv_path, signal, sfreq, columns, start_time=0.0, **extra_json)[source]#

Write signal data as BIDS _physio.tsv.gz with companion JSON sidecar.

Parameters:
  • tsv_path (str or Path) – Output path for the .tsv.gz file. The companion .json sidecar is written alongside with the same stem.

  • signal (ndarray, shape (n_channels, n_samples)) – Signal data. Each row becomes one column in the TSV.

  • sfreq (float) – Sampling frequency in Hz.

  • columns (list of str) – Column names, one per row of signal. Length must match signal.shape[0].

  • start_time (float, optional) – Recording start time in seconds relative to task onset. Default is 0.0.

  • **extra_json – Additional key-value pairs for the JSON sidecar (e.g. TR=1.856, Source="semi_precision").

Returns:

Paths to the written (tsv_path, json_path).

Return type:

tuple of (Path, Path)

Raises:

ValueError – If len(columns) does not match signal.shape[0].