Quartic Fit Correction#
Concept#
The quartic fit correction takes care of the flat field, gain, and other pixel-by-pixel effects. There are five coefficients (a, b, c, d, e) for each pixel that define a function for correction:
For pixel at coordinate (i, j), the original image values in DN are corrected to be X using the five coefficients in a polynomial correction.
Vignetting correction#
Vignetting is folded into the quartic fit correction. Optical vignetting describes the drop in brightness towards the edge of images captured through an optical path. The vignetting correction module applies measured calibration maps to undo the effects of optical vignetting. Vignetting calibration maps are spacecraft and polarizer-state dependent, and are measured pre-flight and updated using starfield measurements during commissioning and during the life of the mission.
For an input data array (I) and corresponding vignetting correction array (VG), the corrected data array (Iā) for each corresponding pixel i,j is computed via:
Applying correction#
The correction is carried out primarily in the punchbowl.level1.quartic_fit.photometric_calibration
function:
- punchbowl.level1.quartic_fit.photometric_calibration(image: ndarray, coefficient_image: ndarray) ndarray
Compute a non-linear photometric calibration of PUNCH images.
- Parameters:
image (np.ndarray) ā Image to be corrected.
coefficient_image (np.ndarray) ā Frame containing uncertainty values. The first two dimensions are the spatial dimensions of the image. The last dimension iterates over the powers of the coefficients, starting with index 0 being the highest power and counting down.
- Returns:
a photometrically corrected frame
- Return type:
np.ndarray
Notes
Each instrument is subject to an independent non-linear photometric response, which needs to be corrected. The module converts from raw camera digitizer number (DN) to photometric units at each pixel. Each pixel is replaced with the corresponding value of the quartic polynomial in the current calibration file data product for that particular camera.
A quartic polynomial is applied as follows:
\[X_{i,j} = a_{i,j}+b_{i,j}*DN_{i,j}+c_{i,j}*DN_{i,j}^2+d_{i,j}*DN_{i,j}^3+e_{i,j}*DN_{i,j}^4\]for each pixel in the detector. Each quantity (a, b, c, d, e) is a function of pixel location (i,j), and is generated using dark current and Stim lamp maps. a = offset (dark and the bias). b, c, d, e = higher order terms. Specifically
coefficient_image[:,i,j] = [e, d, c, b, a]
(highest order terms first)As each pixel is independent, a quartic fit calibration file of dimensions 2k*2k*5 is constructed, with each layer containing one of the five polynomial coefficients for each pixel.
Examples
>>> punch_image = np.ones((100,100)) >>> coefficient_image = create_coefficient_image(np.array([0, 0, 0, 1, 0]), punch_image.shape) >>> data = photometric_calibration(punch_image, coefficient_image)
If you wish to incorporate this as a Prefect task in a custom pipeline,
using something like the punchbowl.level1.quartic_fit.perform_quartic_fit_task
is recommended.
Deriving correction#
Quartic fit / vignetting correction calibration files are derived pre-flight from measurements, and will be updated during commissioning using starfield brightness data, via a separate module.