CrossPowerSpectra#
- class acoular.fprocess.CrossPowerSpectra
Bases:
AutoPowerSpectraCompute the complex-valued auto- and cross-power spectra from frequency-domain data.
This class generates the cross-spectral matrix (CSM) in a flattened representation, which includes the auto-power spectra (diagonal elements) and cross-power spectra (off-diagonal elements). Depending on the
calc_mode, the class can compute:The full CSM, which includes all elements.
Only the upper triangle of the CSM.
Only the lower triangle of the CSM.
The results are computed block-by-block and scaled according to the specified configuration.
- source
The data source providing the input spectra, implemented as an instance of
SpectraGeneratoror a derived object.
- precision
Specifies the floating-point precision of the computed cross-spectral matrix (CSM). Options are
'complex128'and'complex64'. Default is'complex128'.
- calc_mode
'lower': Computes only the lower triangle of the CSM,excluding redundant upper-triangle elements.
Default is
'full'.
- num_channels
The number of channels in the output data. The value depends on the number of input channels \(n\) and the selected
calc_mode:'full': \(n^2\) (all elements in the CSM).'upper': \(n + n(n-1)/2\) (diagonal + upper triangle elements).'lower': \(n + n(n-1)/2\) (diagonal + lower triangle elements).
- digest
A unique identifier based on the computation properties.
- result(num=1)
Generate blocks of complex-valued auto- and cross-power spectra.
This generator computes the cross-spectral matrix (CSM) for input spectra block-by-block. Depending on the
calc_mode, the resulting CSM is flattened in one of three ways:'full': Includes all elements of the CSM.'upper': Includes only the diagonal and upper triangle.'lower': Includes only the diagonal and lower triangle.
- Parameters:
- num
int, optional Number of snapshots (blocks) in each output data block. Default is
1.
- num
- Yields:
numpy.ndarrayBlocks of complex-valued auto- and cross-power spectra with shape
(num, :attr:`num_channels` * :attr:`num_freqs`). The last block may contain fewer thannumelements if the input data does not completely fill the requested block size.
- scaling
Specifies the scaling method for the auto-power spectra. Options are:
'power': Outputs the raw power of the spectra.'psd': Outputs the Power Spectral Density (PSD), normalized by the block size and sampling frequency.
- single_sided
A Boolean flag indicating whether the input spectra are single-sided. Default is
True.
- sample_freq
Sampling frequency of output signal, as given by
source.
- num_samples
Number of snapshots in output, as given by
source.
- num_freqs
Number of frequencies in output, as given by
source.
- freqs
1-D array of frequencies, as given by
source.
- block_size
The size of the block used to calculate the spectra