PowerSpectra¶

class
acoular.spectra.
PowerSpectra
¶ Bases:
traits.has_traits.HasPrivateTraits
 Provides the cross spectral matrix of multichannel time data
and its eigendecomposition.
This class includes the efficient calculation of the full cross spectral matrix using the Welch method with windows and overlap. It also contains the CSM’s eigenvalues and eigenvectors and additional properties.
The result is computed only when needed, that is when the
csm
,eva
, oreve
attributes are acturally read. Any change in the input data or parameters leads to a new calculation, again triggered when an attribute is read. The result may be cached on disk in HDF5 files and need not to be recomputed during subsequent program runs with identical input data and parameters. The input data is taken to be identical if the source has identical parameters and the same file name in case of that the data is read from a file.
time_data
= Trait(SamplesGenerator, desc="time data object")¶ The
SamplesGenerator
object that provides the data.

numchannels
= Delegate('time_data')¶ Number of samples

calib
= Instance(Calib)¶ The
Calib
object that provides the calibration data, defaults to no calibration, i.e. the raw time data is used.deprecated: use
calib
property ofTimeSamples
objects

block_size
= Trait(1024, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, desc="number of samples per FFT block")¶ FFT block size, one of: 128, 256, 512, 1024, 2048 … 65536, defaults to 1024.

ind_low
= Int(1, desc="index of lowest frequency line")¶ Index of lowest frequency line to compute, integer, defaults to 1, is used only by objects that fetch the csm, PowerSpectra computes every frequency line.

ind_high
= Int(1, desc="index of highest frequency line")¶ Index of highest frequency line to compute, integer, defaults to 1 (last possible line for default block_size).

window
= Trait('Rectangular', {'Rectangular':ones, 'Hanning':hanning, 'Hamming':hamming, 'Bartlett':bartlett, 'Blackman':blackman}, desc="type of window for FFT")¶ Window function for FFT, one of: * ‘Rectangular’ (default) * ‘Hanning’ * ‘Hamming’ * ‘Bartlett’ * ‘Blackman’

overlap
= Trait('None', {'None':1, '50%':2, '75%':4, '87.5%':8}, desc="overlap of FFT blocks")¶ Overlap factor for averaging: ‘None’(default), ‘50%’, ‘75%’, ‘87.5%’.

cached
= Bool(True, desc="cached flag")¶ Flag, if true (default), the result is cached in h5 files and need not to be recomputed during subsequent program runs.

num_blocks
= Property( desc="overall number of FFT blocks")¶ Number of FFT blocks to average, readonly (set from block_size and overlap).

freq_range
= Property( desc = "frequency range" )¶ 2element array with the lowest and highest frequency. If set, will overwrite
ind_low
andind_high
according to the range. Values will be set to the next higher discrete frequencies.

indices
= Property( desc = "index range" )¶ Array with a sequence of indices for all frequencies between
ind_low
andind_high
within the result, readonly.

basename
= Property( depends_on = 'time_data.digest', desc="basename for cache file")¶ Name of the cache file without extension, readonly.

csm
= Property( desc="cross spectral matrix")¶ The cross spectral matrix, (number of frequencies, numchannels, numchannels) array of complex; readonly.

precision
= Trait('complex128', 'complex64', desc="precision csm, eva, eve")¶ The floatingnumberprecision of entries of csm, eigenvalues and eigenvectors, corresponding to numpy dtypes. Default is 64 bit.

eva
= Property( desc="eigenvalues of cross spectral matrix")¶ Eigenvalues of the cross spectral matrix as an (number of frequencies) array of floats, readonly.

eve
= Property( desc="eigenvectors of cross spectral matrix")¶ Eigenvectors of the cross spectral matrix as an (number of frequencies, numchannels, numchannels) array of floats, readonly.

calc_csm
(self)¶ csm calculation

calc_ev
(self)¶ eigenvalues / eigenvectors calculation

calc_eva
(self)¶ calculates eigenvalues of csm

calc_eve
(self)¶ calculates eigenvectors of csm

synthetic_ev
(self, freq, num=0)¶ Return synthesized frequency band values of the eigenvalues.
 Parameters
 freqfloat
Band center frequency for which to return the results.
 numinteger
Controls the width of the frequency bands considered; defaults to 3 (thirdoctave band).
num
frequency band width
0
single frequency line
1
octave band
3
thirdoctave band
n
1/noctave band
 Returns
 float
Synthesized frequency band value of the eigenvalues (the sum of all values that are contained in the band).

fftfreq
(self)¶ Return the Discrete Fourier Transform sample frequencies.
 Returns
 fndarray
Array of length block_size/2+1 containing the sample frequencies.