downsample_data

sofia_redux.scan.frames.frames_numba_functions.downsample_data(data, sample_flag, valid, window, start_indices)[source]

Downsample data to a new resolution using a window kernel.

Parameters:
datanumpy.ndarray (float)

The high resolution data to downsample of shape (n_frames, n_channels).

sample_flagnumpy.ndarray (int)

The integer sample flags marking normal data (0) or some other type (nonzero). The low resolution data will be the result of an OR operation of all sample flags within the kernel window.

validnumpy.ndarray (float)

The boolean mask validity array for the low-resolution output data of shape (low_resolution_frames,) where False indicates that the low resolution output frame is invalid and should not be populated.

windownumpy.ndarray (float)

The convolution kernel to apply for the downsampling of shape (n_windows,). This should be supplied in a normalized form such that sum(window) = 1 as no subsequent normalization occurs.

start_indicesnumpy.ndarray (int)

For each low-resolution frame, the frame index on the high resolution data indicating where the first element of the window should be placed for the convolution. Should be of shape (low_resolution_frames,).

Returns:
low_resolution_data, low_resolution_flagsnumpy.ndarray, numpy.ndarray

The low resolution data and sample flags.