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_bandedfunction converts a linear power spectrum into a banded spectrum by summing power within frequency bands defined bylower_edgesandupper_edges. It handles multi-dimensional spectra by allowing specification of the axis corresponding to frequency bins.- Parameters:
- linear_spectrum
numpy.ndarray The input linear power spectrum. The axis specified by
axisshould 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_spectrumthat corresponds to frequency bins. If the frequency bins are not along the first axis, specify the appropriate axis index.
- linear_spectrum
- Returns:
- banded_spectrumnumpy.ndarray
The aggregated banded power spectrum.