base#
Implements base classes for signal processing blocks in Acoular.
The classes in this module are abstract base classes that provide a common interface for all classes
that generate an output via the generator result() in block-wise manner. They are not intended
to be used directly, but to be subclassed by classes that implement the actual signal processing.
Interface for any generating signal processing block. |
|
Interface for any generating multi-channel time domain signal processing block. |
|
Interface for any generating multi-channel signal frequency domain processing block. |
|
Abstract base class receiving from a |
|
Abstract base class receiving from a |
|
Abstract base class receiving from a |
- class acoular.base.Generator#
Bases:
ABCHasStrictTraitsInterface for any generating signal processing block.
It provides a common interface for all classes, which generate an output via the generator
result()in block-wise manner. It has a common set of traits that are used by all classes that implement this interface. This includes the sampling frequency of the signal (sample_freq), the number of samples (num_samples), and the number of channels (num_channels). A private traitdigestis used to store the internal identifier of the object, which is a hash of the object’s attributes. This is used to check if the object’s internal state has changed.- sample_freq = Float(1.0)#
Sampling frequency of the signal, defaults to 1.0
- num_samples = CInt#
Number of signal samples
- num_channels = CInt#
Number of channels
- digest = Property(depends_on=['sample_freq', 'num_samples', 'num_channels'])#
A unique identifier for the generator, based on its properties. (read-only)
- abstractmethod result(num)#
Python generator that yields the output block-wise.
This method needs to be implemented by the derived classes.
- Parameters:
- numint
The size of the first dimension of the blocks to be yielded
- Yields:
- numpy.ndarray
Two-dimensional output data block of shape (num, …)
- class acoular.base.SamplesGenerator#
Bases:
GeneratorInterface for any generating multi-channel time domain signal processing block.
It provides a common interface for all SamplesGenerator classes, which generate an output via the generator
result()in block-wise manner. This class has no real functionality on its own and should not be used directly.- digest = Property(depends_on=['sample_freq', 'num_samples', 'num_channels'])#
A unique identifier for the generator, based on its properties. (read-only)
- abstractmethod result(num)#
Python generator that yields the output block-wise.
- Parameters:
- numint
This parameter defines the size of the blocks to be yielded (i.e. the number of samples per block)
- Yields:
- numpy.ndarray
The two-dimensional time-data block of shape (num, num_channels).
- class acoular.base.SpectraGenerator#
Bases:
GeneratorInterface for any generating multi-channel signal frequency domain processing block.
It provides a common interface for all SpectraGenerator classes, which generate an output via the generator
result()in block-wise manner. This class has no real functionality on its own and should not be used directly.- num_freqs = CInt#
Number of frequencies
- freqs = CArray#
1-D array of frequencies
- block_size = CInt#
The length of the block used to calculate the spectra
- digest = Property(depends_on=['sample_freq', 'num_samples', 'num_channels', 'num_freqs', 'block_size'])#
A unique identifier for the generator, based on its properties. (read-only)
- abstractmethod result(num=1)#
Python generator that yields the output block-wise.
- Parameters:
- numinteger
This parameter defines the size of the number of snapshots to be yielded. Defaults to 1.
- Yields:
- numpy.ndarray
A two-dimensional block of shape (num, num_channels * num_freqs).
- class acoular.base.TimeOut#
Bases:
SamplesGeneratorAbstract base class receiving from a
sourceand returning time domain signals.It provides a base class that can be used to create signal processing blocks that receive data from any generating
sourceand generates a time signal output via the generatorresult()in block-wise manner.- digest = Property(depends_on=['source.digest'])#
A unique identifier for the generator, based on its properties. (read-only)
- abstractmethod result(num)#
Python generator that processes the source data and yields the time-signal block-wise.
This method needs to be implemented by the derived classes.
- Parameters:
- numint
This parameter defines the size of the blocks to be yielded (i.e. the number of samples per block)
- Yields:
- numpy.ndarray
Two-dimensional output data block of shape (num, num_channels)
- class acoular.base.SpectraOut#
Bases:
SpectraGeneratorAbstract base class receiving from a
sourceand returning frequency domain signals.It provides a base class that can be used to create signal processing blocks that receive data from any generating
sourcedomain and generates a frequency domain output via the generatorresult()in block-wise manner.- block_size = Delegate('source')#
The size of the block used to calculate the spectra
- digest = Property(depends_on=['source.digest'])#
A unique identifier for the generator, based on its properties. (read-only)
- abstractmethod result(num=1)#
Python generator that processes the source data and yields the output block-wise.
This method needs to be implemented by the derived classes.
- numinteger
This parameter defines the the number of snapshots to be yielded. Defaults to 1.
- Yields:
- numpy.ndarray
A two-dimensional block of shape (num, num_channels * num_freqs).
- class acoular.base.InOut#
Bases:
SamplesGenerator,SpectraGeneratorAbstract base class receiving from a
sourceand returning signals in the same domain.It provides a base class that can be used to create signal processing blocks that receive data from any generating
sourceand generates an output via the generatorresult()in block-wise manner.- digest = Property(depends_on=['source.digest'])#
A unique identifier for the generator, based on its properties. (read-only)
- abstractmethod result(num)#
Python generator that processes the source data and yields the output block-wise.
This method needs to be implemented by the derived classes.
- Parameters:
- numint
The size of the first dimension of the blocks to be yielded
- Yields:
- numpy.ndarray
Two-dimensional output data block of shape (num, …)