level_for_channels

sofia_redux.scan.filters.filters_numba_functions.level_for_channels(signal, valid_frame, modeling_frame, sample_flag, channel_indices)[source]

Level a given signal over all frames for the given channel indices.

The resulting operation subtracts the mean for each channel from the frame data. The mean is calculated using only valid samples, but is subtracted from all samples. If there are no valid samples for a given channel, its data will be zeroed. Valid samples are those that are marked as a valid_frame, is not a modeling_frame, and has a zero valued sample_flag.

Parameters:
signalnumpy.ndarray (float)

The signal data to level of shape (n_channels, >=n_frames). Is updated in-place.

valid_framenumpy.ndarray (bool)

A boolean mask where False excludes a frame from being included in the average signal calculation. Should be of shape (n_frames,).

modeling_framenumpy.ndarray (bool)

A boolean mask marking modeling frames with True. These frames will not be included in the average signal calculation. Should be of shape (n_frames,).

sample_flagnumpy.ndarray (int)

The flag mask of shape (n_frames, all_channels) where any nonzero value will exclude that given channel and frame from being included in the averaging calculation.

channel_indicesnumpy.ndarray (int)

The channel indices for which signal is applicable and maps n_channels onto all_channels. An array of shape (n_channels,).

Returns:
None