debounce¶
- sofia_redux.instruments.exes.debounce.debounce(data, header, abeams, bbeams, flat, good_data=None, illum=None, variance=None, spectral=False)[source]¶
Correct for optics shifts between nods (bounces).
Each nod pair is undistorted, then the B nod is shifted slightly in the spatial direction and differenced with the A nod. The shift direction that results in a minimum squared difference (summed over the spectral direction) is used as the bounce direction.
The amplitude of the shift is controlled by the bounce parameter (hdr[‘BOUNCE’]), which should be set to a number whose absolute value is between 0 and 1 (typically 0.1). If the bounce parameter is set to a positive number, only the above shift (the first-derivative bounce) will be corrected.
If the bounce parameter is set to a negative value (e.g. -0.1), the debouncing algorithm will also attempt to fix the second-derivative bounce by smoothing the A or B nod slightly; the amount of smoothing is also controlled by the absolute value of the bounce parameter.
Note that if the observed source is too near the edge of the order, it may confuse the debouncing algorithm; in this case, it is usually best to turn debouncing off (i.e. set the bounce parameter to 0).
- Parameters:
- datanumpy.ndarray
3D data cube [nframe, nspec, nspat].
- headerfits.Header
Header of FITS file. May be updated in place.
- abeamsarray-like of int
Index numbers of A frames in data cube.
- bbeamsarray-like of int
Index numbers of B frames in data cube.
- flatnumpy.ndarray
2D processed flat, as produced by makeflat [nspec, nspat].
- good_datanumpy.ndarray, optional
Bad pixel array matching data shape indicating valid data (True=good, False=bad).
- illumnumpy.ndarray, optional
2D array of size [nspec, nspat] indicating illuminated regions of the frame. 1 = illuminated, 0 = unilluminated, -1 = pixel that does not correspond to any region in the raw frame (after undistortion).
- variancenumpy.ndarray, optional
3D array of size [nframe, nspec, nspat] of variance planes corresponding to data.
- spectralbool, optional
If True, debounce is applied in the spectral direction instead of the spatial.
- Returns:
- correctednumpy.ndarray
Corrected 3D data cube