get_robust_correlated¶
- sofia_redux.scan.signal.signal_numba_functions.get_robust_correlated(frame_data, frame_weights, frame_valid, channel_indices, channel_g, channel_wg2, sample_flags, resolution, max_dependence=0.25)[source]¶
Derive the robust gain increment and weights.
The robust correlated gain increments and associated weights are derived in a similar way to the maximum-likelihood increments calculated using
get_ml_correlated()
but with a median calculation instead of a mean (please seenumba_functions.smart_median()
for further details). The input weights and values passed into the median (which returns the increment values and weights) are given by:values = d / g weight = fw * cw * g^2
where d is the
frame_data
, g are the channel gains, fw are the frame relative weights, and cw are the channel weights. The median is performed over all channels and frames within a given block (seeget_ml_correlated()
). Any invalid results are returned as zero values increments and increment weights.- Parameters:
- frame_datanumpy.ndarray (float)
The frame data of shape (n_frames, all_channels).
- frame_weightsnumpy.ndarray (float)
The array of frame relative weights of shape (n_frames,).
- frame_validnumpy.ndarray (bool)
A boolean mask of shape (n_frames,) where
False
excludes a frame from any calculations or updates. Should include both invalid frames and modeling flags.- channel_indicesnumpy.ndarray (int)
An array of shape (n_channels,) mapping n_channels to all_channels.
- channel_gnumpy.ndarray (float)
An array of shape (n_channels,) containing the channel gains.
- channel_wg2numpy.ndarray (float)
An array of shape (n_channels,) containing the channel gains^2 multiplied by the channel weights.
- sample_flagsnumpy.ndarray (int)
An array of sample flags of shape (n_frames, all_channels) where any non-zero value excludes a data sample from being included in calculations.
- resolutionint
The signal resolution (number of frames).
- max_dependencefloat, optional
The maximum dependence of a single datum before switching to weighted mean. Please see
numba_functions.smart_median_1d()
for further details.
- Returns:
- mean, mean_weightfloat, float
The mean as described above and weight (denominator).