synchronize_gains

sofia_redux.scan.signal.signal_numba_functions.synchronize_gains(frame_data, sample_flags, frame_valid, modeling_frames, channel_indices, delta_gains, frame_wc2, channel_wc2, signal_values, frame_parms, channel_parms)[source]

Resync the frame data with the gain deltas and update dependents.

The supplied frame data (d) are decremented by:

d -= delta_g * c

where delta_g are the gain deltas and c are the signal values. Dependents are incremented via:

frame_dependents += sum_{channels}(frame_wc2 / channel_wc2) channel_dependents += (1 - 1/n)

where n are the number of channels with channel_wc2 > 0 (i.e., one gain parameter per channel minus the overall gain renormalization). The frame and channel wc2 values are the current accumulated gain weights in the frame and channel planes (increments are calculated by get_ml_gain_increment() and get_robust_gain_increment().

Parameters:
frame_datanumpy.ndarray (float)

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

sample_flagsnumpy.ndarray (int)

Sample flags of shape (n_frames, all_channels) where any non-zero value excludes a sample (frame data) from certain calculations. In this case, frame data will always be updated, but dependents will not for a non-zero sample flag.

frame_validnumpy.ndarray (bool)

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

modeling_framesnumpy.ndarray (bool)

A boolean mask of shape (n_frames,) where True indicates that a frame is a modeling frame for which dependents should not be updated.

channel_indicesnumpy.ndarray (int)

The indices of the channel group for the signal mode. Used to map n_channels onto all_channels.

delta_gainsnumpy.ndarray (float)

The change in the gains of shape (n_channels,). For zero deltas, no change needs to be made.

frame_wc2numpy.ndarray (float)

The frame signal gain weights of shape (n_frames,).

channel_wc2numpy.ndarray (float)

The channel signal gain weights of shape (n_channels,).

signal_valuesnumpy.ndarray (float)

The frame signal gain values of shape (n_frames,).

frame_parmsnumpy.ndarray (float)

The frame dependents of shape (n_frames,). Updated in-place.

channel_parmsnumpy.ndarray (float)

The channel dependents of shape (all_channels,). Updated in-place

Returns:
None