acoupipe.datasets.features#
Module Contents#
- class acoupipe.datasets.features.PowerSpectraAnalytic#
Bases:
acoular.PowerSpectraImportProvides a dummy class for using pre-calculated CSMs.
This class does not calculate the CSM. Instead, the user can inject one or multiple existing CSMs by setting the
csmattribute. This can be useful when algorithms shall be evaluated with existing CSMs. The frequency or frequencies contained by the CSM must be set via thefrequenciesattribute. The attr:num_channels attributes is determined on the basis of the CSM shape. In contrast to thePowerSpectraobject, the attributessample_freq,source,block_size,window,overlap,cached, andnum_blockshave no functionality.- fftfreq()#
Return the Discrete Fourier Transform sample frequencies.
- Returns:
- fndarray
Array of length block_size/2+1 containing the sample frequencies.
- acoupipe.datasets.features.get_frequency_index_range(freq, f, num)#
Return the left and right indices that define the frequency range to integrate over.
- Parameters:
- freqnumpy.array
frequency vector (can be determined by evaluating freqdata() method at a acoular.PowerSpectra instance)
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- Returns:
- tuple
left and right index that belongs to the frequency of interest
- acoupipe.datasets.features.get_point_sources_recursively(source)#
Recursively get all point sources from a acoular.TimeInOut object.
- Parameters:
- sourceinstance of class acoular.TimeInOut
the source object
- Returns:
- list
list of all sources
Recursively get all uncorrelated noise sources from a acoular.TimeInOut object.
- Parameters:
- sourceinstance of class acoular.TimeInOut
the source object
- Returns:
- list
list of all uncorrelated noise sources
- class acoupipe.datasets.features.BaseFeatureCatalog#
Bases:
traits.api.HasPrivateTraitsBaseFeatureCatalog base class for handling feature funcs.
- Attributes:
- namestr
Name of the feature.
- dtypecallable
Numpy dtype of the feature.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.TimeDataFeature#
Bases:
BaseFeatureCatalogTimeDataFeature class for handling time data.
- Attributes:
- namestr
Name of the feature (default=’time_data’).
- time_datainstance of class acoular.SamplesGenerator
The source delivering the time data.
- get_feature_func()#
Return the callable for calculating the time data.
- class acoupipe.datasets.features.TargetmapFeature#
Bases:
BaseFeatureCatalogBaseFeatureCatalog base class for handling feature funcs.
- Attributes:
- namestr
Name of the feature.
- dtypecallable
Numpy dtype of the feature.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.SourcemapFeature#
Bases:
BaseFeatureCatalogHandle the generation of sourcemaps obtained with microphone array methods.
- Attributes:
- namestr
Name of the feature (default=’sourcemap’).
- beamformerinstance of class acoular.BeamformerBase
The beamformer to calculate the sourcemap.
- ffloat
The center frequency or list of frequencies of the dataset. If None, all frequencies are included.
- numinteger
Controls the width of the frequency bands considered; defaults to 0 (single frequency line).
num
frequency band width
0
single frequency line
1
octave band
3
third-octave band
n
1/n-octave band
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered. Is determined automatically from attr:f and attr:num.
- set_freq_limits()#
Set the beamformer frequency limits to calculate only the necessary frequencies.
- get_feature_func()#
Return the callable for calculating the sourcemap.
- class acoupipe.datasets.features.SpectraFeature#
Bases:
BaseFeatureCatalogHandles the calculation of features in the frequency domain.
- Attributes:
- namestr
Name of the feature.
- freq_datainstance of class acoular.BaseSpectra
The frequency data to calculate the feature for.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- set_freq_limits()#
Set the beamformer frequency limits to calculate only the necessary frequencies.
- class acoupipe.datasets.features.SpectrogramFeature#
Bases:
SpectraFeatureSpectrogramFeature class for handling spectrogram features.
- Attributes:
- namestr
Name of the feature (default=’spectrogram’).
- freq_datainstance of class acoular.RFFT
The object which calculates the spectrogram data.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.CSMFeature#
Bases:
SpectraFeatureCSMFeature class for handling cross-spectral matrix calculation.
- Attributes:
- namestr
Name of the feature (default=’csm’).
- freq_datainstance of class acoular.PowerSpectra
The object which calculates the cross-spectral matrix.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- static calc_csm1(sampler, freq_data, name)#
Calculate the cross-spectral matrix (CSM) from time data.
- Parameters:
- freq_datainstance of class acoular.PowerSpectra
power spectra to calculate the csm feature
- Returns:
- numpy.array
The complex-valued cross-spectral matrix with shape (numfreq, num_mics, num_mics).
- static calc_csm2(sampler, freq_data, fidx, name)#
Calculate the cross-spectral matrix (CSM) from time data.
- Parameters:
- freq_datainstance of class acoular.PowerSpectra
power spectra to calculate the csm feature
- fidxlist of tuples, optional
list of tuples containing the start and end indices of the frequency bands to be considered, by default None
- Returns:
- numpy.array
The complex-valued cross-spectral matrix with shape (numfreq, num_mics, num_mics) with numfreq depending on the number of frequencies in fidx.
- get_feature_func()#
Return the callable for calculating the cross-spectral matrix.
- class acoupipe.datasets.features.CSMtriuFeature#
Bases:
SpectraFeatureHandles the calculation of features in the frequency domain.
- Attributes:
- namestr
Name of the feature.
- freq_datainstance of class acoular.BaseSpectra
The frequency data to calculate the feature for.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- static calc_csmtriu1(sampler, freq_data, name)#
Calculate the cross-spectral matrix (CSM) from time data.
- Parameters:
- freq_datainstance of class acoular.PowerSpectra
power spectra to calculate the csm feature
- Returns:
- numpy.array
The real-valued cross-spectral matrix with shape (numfreq, num_mics, num_mics).
- static calc_csmtriu2(sampler, freq_data, fidx, name)#
Calculate the cross-spectral matrix (CSM) from time data.
- Parameters:
- freq_datainstance of class acoular.PowerSpectra
power spectra to calculate the csm feature
- fidxlist of tuples, optional
list of tuples containing the start and end indices of the frequency bands to be considered, by default None
- Returns:
- numpy.array
The real-valued cross-spectral matrix with shape (numfreq, num_mics, num_mics) with numfreq depending on the number of frequencies in fidx.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.EigmodeFeature#
Bases:
SpectraFeatureHandles the calculation of features in the frequency domain.
- Attributes:
- namestr
Name of the feature.
- freq_datainstance of class acoular.BaseSpectra
The frequency data to calculate the feature for.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- static calc_eigmode1(sampler, freq_data, name)#
Calculate eigenvalue-scaled eigenvectors of the CSM from time data.
- Parameters:
- freq_datainstance of class acoular.PowerSpectra
power spectra to calculate the csm feature
- Returns:
- numpy.array
The eigenvalue scaled eigenvectors with shape (numfreq, num_mics, num_mics).
- static calc_eigmode2(sampler, freq_data, fidx, name)#
Calculate eigenvalue-scaled eigenvectors of the CSM from time data.
- Parameters:
- freq_datainstance of class acoular.PowerSpectra
power spectra to calculate the csm feature
- fidxlist of tuples, optional
list of tuples containing the start and end indices of the frequency bands to be considered, by default None
- Returns:
- numpy.array
The eigenvalue scaled eigenvectors with shape (numfreq, num_mics, num_mics) with numfreq depending on the number of frequencies in fidx.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.LocFeature#
Bases:
BaseFeatureCatalogBaseFeatureCatalog base class for handling feature funcs.
- Attributes:
- namestr
Name of the feature.
- dtypecallable
Numpy dtype of the feature.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.AnalyticSourceStrengthFeature#
Bases:
SpectraFeatureHandles the calculation of features in the frequency domain.
- Attributes:
- namestr
Name of the feature.
- freq_datainstance of class acoular.BaseSpectra
The frequency data to calculate the feature for.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.EstimatedSourceStrengthFeature#
Bases:
SpectraFeatureHandles the calculation of features in the frequency domain.
- Attributes:
- namestr
Name of the feature.
- freq_datainstance of class acoular.BaseSpectra
The frequency data to calculate the feature for.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.AnalyticNoiseStrengthFeature#
Bases:
SpectraFeatureHandles the calculation of features in the frequency domain.
- Attributes:
- namestr
Name of the feature.
- freq_datainstance of class acoular.BaseSpectra
The frequency data to calculate the feature for.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.EstimatedNoiseStrengthFeature#
Bases:
SpectraFeatureHandles the calculation of features in the frequency domain.
- Attributes:
- namestr
Name of the feature.
- freq_datainstance of class acoular.BaseSpectra
The frequency data to calculate the feature for.
- ffloat
the frequency (or center frequency) of interest
- numint
the frequency band (0: single frequency line, 1: octave band, 3: third octave band)
- fidxlist of tuples
List of tuples containing the start and end indices of the frequency bands to be considered.
- get_feature_func()#
Will return a method depending on the class parameters.
- class acoupipe.datasets.features.BaseFeatureCollection#
Bases:
traits.api.HasPrivateTraitsBaseFeatureCollection base class for handling feature funcs.
- Attributes:
- feature_funcslist
List of feature_funcs.
- add_feature_func(feature_func)#
Add a feature_func to the BaseFeatureCollection.
- Parameters:
- feature_funcstr
Feature to be added.
- get_feature_funcs()#
Get all feature_funcs of the BaseFeatureCollection.
- Returns:
- list
List of feature_funcs.
- class acoupipe.datasets.features.BaseFeatureCollectionBuilder#
Bases:
traits.api.HasPrivateTraitsBaseFeatureCollectionBuilder base class for building a BaseFeatureCollection.
- Attributes:
- feature_collectionBaseFeatureCollection
BaseFeatureCollection object.
- add_custom(feature_func)#
Add a custom feature to the BaseFeatureCollection.
The custom feature_func should be a callable that takes a sampler as input and returns a dictionary of feature name and feature data.
- Parameters:
- feature_funccallable
Feature to be added.
- build()#
Build a BaseFeatureCollection.
- Returns:
- BaseFeatureCollection
BaseFeatureCollection object.
- acoupipe.datasets.features.create_feature(feature_func, name, shape, dtype)#