get_robust_gain_increment

sofia_redux.scan.signal.signal_numba_functions.get_robust_gain_increment(frame_data, signal_c, signal_wc2, sample_flags, channel_indices, valid_frames)[source]

Return the robust median gain increment.

This function returns a value similar to get_ml_gain_increment() that substitutes the mean operation with a robust weighted median (see numba_functions.smart_median_1d()). The return increment and increment weight are returned by passing the following values into the weighted median operation:

values = frame_data / c weights = wc^2

where c are the signal values (per frame) and w are the frame relative weights.

Parameters:
frame_datanumpy.ndarray (float)

The frame data array of shape (n_frames, all_channels).

signal_cnumpy.ndarray (float)

The signal values of shape (n_frames,).

signal_wc2numpy.ndarray (float)

The weighted square signal values (frame_weight * signal_value^2). An array of shape (n_frames,).

sample_flagsnumpy.ndarray (int)

The frame data sample flags of shape (n_frames, all_channels). Any non-zero sample will not be included in calculations.

channel_indicesnumpy.ndarray (int)

An array of shape (n_channels,) mapping the mode channel group indices to all_channels in the frame_data.

valid_framesnumpy.ndarray (bool)

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

Returns:
increment, increment_weightnumpy.ndarray, numpy.ndarray

The increment values and weights of shape (n_channels,).