apply_gain_increments¶
- sofia_redux.scan.signal.signal_numba_functions.apply_gain_increments(frame_data, frame_weight, frame_valid, modeling_frames, frame_dependents, channel_g, channel_fwg2, channel_indices, channel_dependents, sample_flags, signal_values, signal_weights, resolution, increment, increment_weight)[source]¶
Apply the gain increments to frame data and signals.
Updates the frame data, frame and channel dependents, and signal values and weights by the given correlated gain increments. Frame data are updated by:
d -= g * dc
where g is the channel gain and dc is the increment. Frame and channel dependents are updated by the dependent increment of:
dp = cf * cw * fw * g^2 / dw
where cf is the channel filtering, cw is the channel weight, fw is the frame weights, and dw is the gain increment weight. Channel dependents are incremented by dp summed over all frames for each channel, and frame dependents are incremented by dp summed over all channels for each frame. The signal (s) and signal weight (sw) are incremented by:
s += dc sw += dw
- Parameters:
- frame_datanumpy.ndarray (float)
The frame data of shape (n_frames, all_channels). Will be updated in-place.
- frame_weightnumpy.ndarray (float)
The relative frame weight of shape (n_frames,).
- frame_validnumpy.ndarray (bool)
A boolean mask where
False
excludes a given frame from all processing.- modeling_framesnumpy.ndarray (bool)
A boolean mask where
True
indicates that a given frame is used for modeling. While frame data values will still be updated for modeling frames, they will not be used to update dependents.- frame_dependentsnumpy.ndarray (float)
The frame dependents of shape (n_frames,). Will be incremented by channel_{fwg2} * frame_{w} / increment_weight.
- channel_gnumpy.ndarray (float)
The channel mode gains of shape (n_channels,) where n_channels are the number of channels in the signal mode.
- channel_fwg2numpy.ndarray (float)
The product of channel (filtering * weight * gain^2) of shape (n_channels,).
- channel_indicesnumpy.ndarray (int)
The channel indices in the mode channel group of shape (n_channels,) mapping each channel onto (all_channels,) for frame data.
- channel_dependentsnumpy.ndarray (float)
The channel dependents of shape (all_channels,). Will be incremented by channel_{fwg2} * frame_{w} / increment_weight.
- sample_flagsnumpy.ndarray (int)
The frame/channel sample flags of shape (n_frames, all_channels). Non- zero sample flags will not add to frame of channel dependents.
- signal_valuesnumpy.ndarray (float)
The signal values of the correlated signal of shape (n_signal,). Will be incremented in-place by the increment values.
- signal_weightsnumpy.ndarray (float)
The signal weights of the correlated signal of shape (n_signal,). Will be updated in-place to the increment weights.
- resolutionint
The resolution (in frames) of the correlated signal.
- incrementnumpy.ndarray (float)
The signal increment values of shape (n_signal,).
- increment_weightnumpy.ndarray (float)
The signal increment weight value of shape (n_signal,).
- Returns:
- None