downsample_frame_flags

sofia_redux.scan.integration.integration_numba_functions.downsample_frame_flags(flags, window, valid=None)[source]

Downsample frame flags using a supplied kernel.

The size of the window kernel determines the number of frames in the output downsampled data, and is given as:

(n_frames - window.size + 1) // (window.size // 2)

In other words, convolution only occurs at points where the window is fully applied over the initial data values, and is downsampled by a factor of half the window span. No convolution will occur a data point marked as invalid. In this case, the flag convolution refers to an or operation of all frame flags within the window span.

Parameters:
flagsnumpy.ndarray (int)

A flag array of shape (n_frames, n_channels).

windownumpy.ndarray (float)

The resampling kernel of size (n,) where n is an odd integer.

validnumpy.ndarray (bool), optional

If supplied, True indicates a valid sample available for resampling.

Returns:
downsampled_datanumpy.ndarray (float)

The downsampled array of shape (new_frames, n_channels).