TimePower#

class acoular.tprocess.TimePower

Bases: TimeOut

Calculate the time-dependent power of a signal by squaring its samples.

This class computes the power of the input signal by squaring the value of each sample. It processes the signal in blocks, making it suitable for large datasets or real-time signal processing. The power is calculated on a per-block basis, and each block of the output is yielded as a NumPy array.

Attributes:
sourceSamplesGenerator

The input data source, which provides the time signal or signal samples to be processed. It must be an instance of SamplesGenerator or any derived class that provides a result() method.

source

The input data source. It must be an instance of a SamplesGenerator-derived class.

result(num)

Generate the time-dependent power of the input signal in blocks.

This method iterates through the signal samples provided by the source and calculates the power by squaring each sample. The output is yielded block-wise to facilitate processing large signals in chunks.

Parameters:
numint

Number of samples per block.

Yields:
numpy.ndarray

An array containing the squared samples from the source. Each block will have the shape (num, num_channels), where num_channels is inhereted from the TimeOut base class. The last block may contain fewer samples if the total number of samples is not a multiple of num.

sample_freq

Sampling frequency of output signal, as given by source.

num_channels

Number of channels in output, as given by source.

num_samples

Number of samples in output, as given by source.

digest

A unique identifier for the generator, based on its properties. (read-only)