remove_channel_drifts

sofia_redux.scan.integration.integration_numba_functions.remove_channel_drifts(frame_data, frame_weights, frame_valid, modeling_frames, sample_flags, drift_frame_size, channel_filtering, frame_dependents, channel_dependents, channel_indices, robust=False)[source]

Calculate and remove the average offset from each channel.

Parameters:
frame_datanumpy.ndarray (float)

The frame data of shape (n_frames, all_channels). Will be updated in-place.

frame_weightsnumpy.ndarray (float)

The frame relative weights of shape (n_frames,).

frame_validnumpy.ndarray (bool)

A boolean mask of shape (n_frames,) where False excludes a frame from all processing.

modeling_framesnumpy.ndarray (bool)

A boolean mask of shape (n_frames,) where True marks a frame as “modeling”. Modeling frames will not be used to calculate the average channel offsets, but will have the average offset removed. Modeling frames will not contribute to dependents.

sample_flagsnumpy.ndarray (int)

An array of integer flags of shape (n_frames, all_channels) where non-zero values will not contribute to dependents or the average offset calculation.

drift_frame_sizeint

The size of each block of frames for which to calculate the average channel values which will then be removed from that block.

channel_filteringnumpy.ndarray (float)

The channel filtering factor of shape (n_channels,).

frame_dependentsnumpy.ndarray (float)

The frame dependents of shape (n_frames,). Will be updated in-place.

channel_dependentsnumpy.ndarray (float)

The channel dependents of shape (all_channels,). Will be updated in-place.

channel_indicesnumpy.ndarray (int)

The channels for which to calculate and subtract the average offsets. Should be of shape (n_channels,) and map n_channels -> all_channels.

robustbool, optional

If True, use the robust method (median) to calculate the average channel offset. Otherwise, use the weighted mean.

Returns:
average_offset, offset_weightsnumpy.ndarray, numpy.ndarray

The average channel offset (over all drifts) and associated weight sums. Both are float arrays of shape (n_channels,).