ChannelMixer#

class acoular.tprocess.ChannelMixer

Bases: TimeOut

A signal processing block that mixes multiple input channels into a single output channel.

The ChannelMixer class takes a multi-channel signal from a SamplesGenerator (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 of weights must match the number of input channels. If an incompatible shape is provided, a ValueError will be raised.

num_channels = Constant(1)

The number of output channels, which is always 1 for 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 source object, applies the specified amplitude weights to 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:
numint

Number of samples per block.

Yields:
numpy.ndarray

An 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 of num.

Raises:
ValueError

If the weights array is provided but its shape does not match the expected shape (num_channels,) or (1,), a ValueError is raised indicating that the weights cannot be broadcasted properly.