punchbowl.level1.vignette#
Functions#
|
Prefect task to correct the vignetting of an image. |
|
Create calibration data for vignetting. |
|
Create calibration data for vignetting for the NFI spacecraft. |
Module Contents#
- punchbowl.level1.vignette.correct_vignetting_task(data_object: ndcube.NDCube, vignetting_path: str | pathlib.Path | punchbowl.util.DataLoader | None) ndcube.NDCube[source]#
Prefect task to correct the vignetting of an image.
Vignetting is a reduction of an image’s brightness or saturation toward the periphery compared to the image center, created by the optical path. The Vignetting Module will transform the data through a flat-field correction map, to cancel out the effects of optical vignetting created by distortions in the optical path. This module also corrects detector gain variation and offset.
Correction maps will be 2048*2048 arrays, to match the input data, and built using the starfield brightness pattern. Mathematical Operation:
I’_{i,j} = I_i,j / FF_{i,j}
Where I_{i,j} is the number of counts in pixel i, j. I’_{i,j} refers to the modified value. FF_{i,j} is the small-scale flat field factor for pixel i, j. The correction mapping will take into account the orientation of the spacecraft and its position in the orbit.
Uncertainty across the image plane is calculated using the modelled flat-field correction with stim lamp calibration data. Deviations from the known flat-field are used to calculate the uncertainty in a given pixel. The uncertainty is convolved with the input uncertainty layer to produce the output uncertainty layer.
- Parameters:
data_object (PUNCHData) – data on which to operate
vignetting_path (pathlib) – path to vignetting function to apply to input data
- Returns:
modified version of the input with the vignetting corrected
- Return type:
PUNCHData
- punchbowl.level1.vignette.generate_vignetting_calibration_wfi(path_vignetting: str, path_mask: str, spacecraft: str, vignetting_threshold: float = 1.2, rows_ignore: tuple = (13, 15), rows_adjust: tuple = (15, 16), rows_adjust_source: tuple = (16, 20), mask_erosion: tuple = (6, 6)) numpy.ndarray[source]#
Create calibration data for vignetting.
- Parameters:
path_vignetting (str) – path to raw input vignetting function
path_mask (str) – path to spacecraft mask function
spacecraft (str) – spacecraft number
vignetting_threshold (float, optional) – threshold for bad vignetting pixels, by default 1.2
rows_ignore (tuple, optional) – rows to exclude entirely from original vignetting data, by default (13,15) for 128x128 input
rows_adjust (tuple, optional) – rows to adjust to the minimum of a set of rows above (per column), by default (15,16) for 128x128 input
rows_adjust_source (tuple, optional) – rows to use for statistics to adjust vignetting rows as above, by default (16,20) for 128x128 input
mask_erosion (tuple, optional) – kernel to use in erosion operation to reduce the mask applied to the vignetting function, by default (6,6)
- Returns:
vignetting function array
- Return type:
np.ndarray
- punchbowl.level1.vignette.generate_vignetting_calibration_nfi(input_files: list[str], dark_path: str, path_mask: str, polarizer: str, dateobs: str, version: str, output_path: str | None = None) numpy.ndarray | None[source]#
Create calibration data for vignetting for the NFI spacecraft.
- Parameters:
input_files (list[str]) – Paths to input NFI files for processing
dark_path (str) – Path to the dark frame FITS file
path_mask (str) – Path to the speckle mask FITS file
polarizer (str) – Polarizer name
dateobs (str) – Timestamp for calibration file
version (str) – File version
output_path (str | None) – Path to calibration file output
- Returns:
vignetting function array
- Return type:
np.ndarray | None