robust_channel_weights¶
- sofia_redux.scan.integration.integration_numba_functions.robust_channel_weights(frame_data, relative_weights, sample_flags, valid_frames, channel_indices)[source]¶
Derive robust channel variance and weights.
The returned weight and variance for a channel
i
is given as:var = median(relative_weight * frame_data[:, i] ** 2) weight = sum(relative_weight)
taken over all valid frames for the channel
i
and zero flagged samples for the channeli
.- Parameters:
- frame_datanumpy.ndarray (float)
An (n_frame, n_channel) array of frame data values.
- relative_weightsnumpy.ndarray (float)
The relative frame weights of shape (n_frames,).
- sample_flagsnumpy.ndarray (int)
The frame data sample flags of shape (n_frames, n_channels). Only frames that are unflagged (flag=0) will be included in the derivation.
- valid_framesnumpy.ndarray (bool)
An array indicating which frames are valid (
True
) and should be included in the derivation.- channel_indicesnumpy.ndarray (int)
The channel indices to include in the derivation of shape (n,) where n <= n_channels.
- Returns:
- variance_sum, variance_weightnumpy.ndarray, numpy.ndarray
The channel variance sum (variance * weight) and channel variance weights, both of shape (n,) and float type.