get_ml_gain_increment

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

Return the maximum-likelihood gain increment.

The ML gain increment for any given channel is given as:

dC = sum_{frames}(w * x * s) / dW

where w are the frame relative weights, x are the frame data for the given channels, and s are the signal values. The weight dW is given as:

dW = sum_{frames}(w * s * s)

Parameters:
frame_datanumpy.ndarray (float)

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

signal_wcnumpy.ndarray (float)

The weighted signal values (frame_weight * signal value). An array 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,).