ChannelMixer#
- class acoular.tprocess.ChannelMixer
Bases:
TimeOutA signal processing block that mixes multiple input channels into a single output channel.
The
ChannelMixerclass takes a multi-channel signal from aSamplesGenerator(or a derived object) and applies an optional set of amplitude weights to each channel. The resulting weighted sum is then output as a single-channel signal.This class is particularly useful for cases where a combined signal representation is needed, such as beamforming, array signal processing, or for reducing the dimensionality of multi-channel time signal data.
- source = Instance(SamplesGenerator)
The input data source. It must be an instance of a
SamplesGenerator-derived class. It provides the multi-channel time-domain signals that will be mixed.
- weights = CArray()
An array of amplitude weight factors applied to each input channel before summation. If not explicitly set, all channels are weighted equally (delault is
1). The shape ofweightsmust match thenumber of input channels. If an incompatible shape is provided, aValueErrorwill be raised.
- num_channels = Constant(1)
The number of output channels, which is always
1for this class since it produces a single mixed output. (read-only)
- digest = Property(depends_on=['source.digest', 'weights'])
A unique identifier for the object, based on its properties. (read-only)
- result(num)
Generate the mixed output signal in blocks.
This method retrieves data from the
sourceobject, applies the specified amplitudeweightsto each channel, and sums them to produce a single-channel output. The data is processed and yielded in block-wise fashion for efficient memory handling.- Parameters:
- num
int Number of samples per block.
- num
- Yields:
numpy.ndarrayAn array of shape
(num, 1)containing blocks a of single-channel mixed signal. The last block may contain fewer samples if the total number of samples is not a multiple ofnum.
- Raises:
ValueErrorIf the
weightsarray is provided but its shape does not match the expected shape (num_channels,) or (1,), aValueErroris raised indicating that the weights cannot be broadcasted properly.