MaskedTimeOut#

class acoular.tprocess.MaskedTimeOut

Bases: TimeOut

A signal processing block that allows for the selection of specific channels and time samples.

The MaskedTimeOut class is designed to filter data from a given SamplesGenerator (or a derived object) by defining valid time samples and excluding specific channels. It acts as an intermediary between the data source and subsequent processing steps, ensuring that only the selected portion of the data is passed along.

This class is useful for selecting specific portions of data for analysis. The processed data is accessed through the generator method result(), which returns data in block-wise fashion for efficient streaming.

source

The input data source. It must be an instance of a SamplesGenerator-derived class. This object provides the raw time-domain signals that will be filtered based on the start, stop, and invalid_channels attributes.

start

The index of the first valid sample. Default is 0.

stop

The index of the last valid sample (exclusive). If set to None, the selection continues until the end of the available data.

invalid_channels

List of channel indices to be excluded from processing.

channels

A mask or index array representing valid channels. (automatically updated)

num_channels_total

Total number of input channels, including invalid channels, as given by source. (read-only).

num_samples_total

Total number of input channels, including invalid channels. (read-only).

num_channels

Number of valid input channels after excluding invalid_channels. (read-only)

num_samples

Number of valid time-domain samples, based on start and stop indices. (read-only)

basename

The name of the cache file (without extension). It serves as an internal reference for data caching and tracking processed files. (automatically generated)

digest

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

result(num)

Generate blocks of processed data, selecting only valid samples and channels.

This method fetches data from the source object, applies the defined start and stop constraints on time samples, and filters out invalid_channels. The data is then yielded in block-wise fashion to facilitate efficient streaming.

Parameters:
numint

Number of samples per block.

Yields:
numpy.ndarray

An array of shape (num, MaskedTimeOut.num_channels), contatining blocks of a filtered time-domain signal. The last block may contain fewer samples if the total number of samples is not a multiple of num. MaskedTimeOut.num_channels is not inherited directly and may be smaller than the source’s number of channels.

Raises:
OSError

If no valid samples are available within the defined start and stop range. This can occur if start is greater than or equal to stop or if the source is not containing any valid samples in the given range.

sample_freq

Sampling frequency of output signal, as given by source.