apply_drifts_to_channel_data¶
- sofia_redux.scan.integration.integration_numba_functions.apply_drifts_to_channel_data(channel_indices, offsets, average_drifts, inconsistencies, hardware_gain, filter_time_scale, source_filtering, integration_filter_time_scale, crossing_time, is_detector_stage, update_filtering)[source]¶
Apply the average drifts to channel data.
After calculating the average channel drifts for all channels, the
offset
attribute of the channel data is modified by:offset += average_drifts * G
where G = 1 if the detector is not staged (
is_detector_stage`=`False
) or set tohardware_gain
if the detector is staged.If
update_filtering
isTrue
, the source filtering will be updated by:sf *= 1 - (crossing_time / filter_time_scale)
Note that the previous correction will be removed first. Also, the filtering_time_scale will be set to the minimum of the integration filtering time scale and the current filtering time scale.
- Parameters:
- channel_indicesnumpy.ndarray (int)
The channel indices for which to apply the drifts to of shape (n_channels,). Should map n_channels -> all_channels.
- offsetsnumpy.ndarray (float)
The channel gain offsets of shape (all_channels,). Will be updated in-place.
- average_driftsnumpy.ndarray (float)
The average drifts to apply to the channel offsets of shape (n_channels,).
- inconsistenciesnumpy.ndarray (int)
The channel inconsistencies of shape (all_channels,).
- hardware_gainnumpy.ndarray (float)
The channel hardware gains of shape (all_channels,).
- filter_time_scalenumpy.ndarray (float)
The filter time scale for all channels of shape (all_channels,). Will be updated in-place.
- source_filteringnumpy.ndarray (float)
The channel source filtering of shape (all_channels,). Will be updated in-place.
- integration_filter_time_scalefloat
The integration filter time scale.
- crossing_timefloat
The point-crossing time for the integration.
- is_detector_stagebool
If
True
indicates that the detector is staged and hardware gains should be applied.- update_filteringbool
If
True
updates the source filtering and filter time scale for the given channels. This should be set toFalse
if the drift block size (number of frames in a single drift) is greater than the total number of frames in the integration.
- Returns:
- inconsistent_channels, total_inconsistenciesint, int
The total number of channels containing one or more inconsistencies, and the total number of inconsistencies in the given channels.