gastropy.multiband_analysis

gastropy.multiband_analysis#

gastropy.multiband_analysis(data, sfreq, bands=None, hwhm_hz=0.015, total_range=(0.01, 0.2))[source]#

Run per-band decomposition across multiple gastric frequency bands.

For each band, finds the peak frequency, applies a narrowband filter, and extracts phase, amplitude, cycle durations, and summary metrics. This replicates the per-band time-frequency analysis from the semi_precision EGG pipeline.

Parameters:
  • data (array_like) – 1D signal (e.g., raw or pre-cleaned EGG).

  • sfreq (float) – Sampling frequency in Hz.

  • bands (list of GastricBand, optional) – Bands to analyse. Default is GASTRIC_BANDS (bradygastria, normogastria, tachygastria).

  • hwhm_hz (float, optional) – Half-width at half-maximum for narrowband filters (Hz). Default is 0.015.

  • total_range (tuple of float, optional) – (fmin, fmax) for PSD and proportional power. Default is (0.01, 0.2).

Returns:

results – Dictionary keyed by band name (e.g., "brady", "normo", "tachy"), each value being the result dict from band_decompose().

Return type:

dict

See also

band_decompose

Single-band decomposition.

Examples

>>> import numpy as np
>>> from gastropy.timefreq import multiband_analysis
>>> sig = np.sin(2 * np.pi * 0.05 * np.arange(0, 300, 0.1))
>>> results = multiband_analysis(sig, sfreq=10.0)
>>> results["normo"]["peak_freq_hz"]
0.05