downsample_frame_data

sofia_redux.scan.integration.integration_numba_functions.downsample_frame_data(data, window, valid=None)[source]

Downsample data 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 if the window span contains a non-finite value of the data, or a data point marked as invalid.

Parameters:
datanumpy.ndarray (float)

A data 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).