CrossPowerSpectra¶
- class acoular.fprocess.CrossPowerSpectra¶
Bases:
AutoPowerSpectra
Compute 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 = Instance(SpectraGenerator)¶
The data source providing the input spectra, implemented as an instance of
SpectraGenerator
or a derived object.
- precision = Enum('complex128', 'complex64', desc='precision of the fft')¶
Specifies the floating-point precision of the computed cross-spectral matrix (CSM). Options are
'complex128'
and'complex64'
. Default is'complex128'
.
- calc_mode = Enum('full', 'upper', 'lower', desc='calculation mode')¶
'lower'
: Computes only the lower triangle of the CSM,excluding redundant upper-triangle elements.
Default is
'full'
.
- num_channels = Property(depends_on=['source.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 = Property(depends_on=['source.digest', 'precision', 'scaling', 'single_sided', 'calc_mode'])¶
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.ndarray
Blocks of complex-valued auto- and cross-power spectra with shape
(num, :attr:`num_channels` * :attr:`num_freqs`)
. The last block may contain fewer thannum
elements if the input data does not completely fill the requested block size.