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 = Instance(SamplesGenerator)

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 = CInt(0)

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

stop = Union(None, CInt)

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(int)

List of channel indices to be excluded from processing.

channels = Property(depends_on=['invalid_channels', 'source.num_channels'])

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

num_channels_total = Delegate('source', 'num_channels')

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

num_samples_total = Delegate('source', 'num_samples')

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

num_channels = Property(depends_on=['invalid_channels', 'source.num_channels'])

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

num_samples = Property(depends_on=['start', 'stop', 'source.num_samples'])

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

basename = Property(depends_on=['source.digest'])

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

digest = Property(depends_on=['source.digest', 'start', 'stop', 'invalid_channels'])

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.