gastropy.plot_psd#
- gastropy.plot_psd(freqs, psd, band=None, ax=None, ch_names=None, best_idx=None, peak_freq=None)[source]#
Plot power spectral density with gastric band shading.
Supports single-channel (1D
psd) or multi-channel (2Dpsd) overlays with automatic channel coloring.- Parameters:
freqs (array_like) – Frequency values in Hz.
psd (array_like) – PSD values. Shape
(n_freqs,)for single channel or(n_channels, n_freqs)for multi-channel.band (GastricBand, optional) – Band to shade. Default is
NORMOGASTRIA.ax (matplotlib.axes.Axes, optional) – Axes to plot on. If None, creates a new figure.
ch_names (list of str, optional) – Channel labels for the legend (multi-channel only).
best_idx (int, optional) – Index of the best channel to highlight with a thicker line.
peak_freq (float, optional) – Frequency of the peak to mark with a star.
- Returns:
fig (matplotlib.figure.Figure)
ax (matplotlib.axes.Axes)