uwacan.spectral.linear_to_banded#

linear_to_banded(linear_spectrum, lower_edges, upper_edges, spectral_resolution, axis=0)[source]#

Aggregate a linear power spectrum into specified frequency bands.

The linear_to_banded function converts a linear power spectrum into a banded spectrum by summing power within frequency bands defined by lower_edges and upper_edges. It handles multi-dimensional spectra by allowing specification of the axis corresponding to frequency bins.

Parameters:
linear_spectrumnumpy.ndarray

The input linear power spectrum. The axis specified by axis should correspond to frequency bins.

lower_edgesarray_like

The lower frequency edges for each band. Must be in ascending order.

upper_edgesarray_like

The upper frequency edges for each band. Must be in ascending order and greater than or equal to lower_edges.

spectral_resolutionfloat

The frequency resolution (Δf) of the linear spectrum.

axisint, optional, default=0

The axis of linear_spectrum that corresponds to frequency bins. If the frequency bins are not along the first axis, specify the appropriate axis index.

Returns:
banded_spectrumnumpy.ndarray

The aggregated banded power spectrum.