Generator#
- 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
Sampling frequency of the signal, defaults to 1.0
- num_samples
Number of signal samples.
-1denotes an indefinite stream.
- num_channels
Number of channels
- digest
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, …).
Notes
Yielded blocks remain stable after the generator advances. Implementations must not modify blocks received from their source. Callers should treat blocks as read-only because some generators return views to avoid copying.