get_drift_corrections

sofia_redux.scan.custom.sofia.info.sofia_info_numba_functions.get_drift_corrections(frame_utc, frame_valid, drift_utc_ranges, drift_deltas)[source]

Get the drift corrections by linear interpolation between drifts.

The drift correction will be given as:

delta_i * (frame_time - start_i) / (end_i - start_i)

where the start and end are the UTC start and end times for a given drift where start < frame_time <= end. If the frame_time is greater than the maximum available drift end time, then extrapolation will be used.

Parameters:
frame_utcnumpy.ndarray (float)

An array of shape (n_frames,) containing the frame UTC times.

frame_validnumpy.ndarray (bool)

A boolean mask of shape (n_frames,) where False skips the correction calculation for that frame.

drift_utc_rangesnumpy.ndarray (float)

The start and end times for the drifts of shape (n_drifts, 2) where index [0, 0] gives the start time of the first drift, and index [0, 1] gives the end time of the first drift.

drift_deltasnumpy.ndarray (float)

The drift offset deltas of shape (n_drifts, 2) where index [0, 0] gives the delta of the first drift in the x-direction, and index [0, 1] gives the delta of the first drift in the y-direction.

Returns:
drift_correction, extrapolation_framenumpy.ndarray (float), int

The drift correction is an array of shape (n_frames, 2) where index [0, 0] gives the correction for frame 0 in the x-direction and index [0, 1] gives the correction for frame 0 in the y-direction. The extrapolation frame will be set to a positive number indicating the frame from which extrapolation was required. If no extrapolation occurred, this value is -1.