CalibImages - EranOfek/AstroPack GitHub Wiki

Description

Class Hierarchy: Base -> Component -> CalibImages

The CalibImages class is a container for bias/dark/flat/fringing/non-linearity images. An introduction bias and flat calibration is available here.

This class can be used to generate calibration images and to apply them in a single step to science images. This class is using functions available in the imProc.dark and imProc.flat packages.

Class Properties

  • Bias [class: AstroImage]

  • Dark [class: AstroImage]

  • Flat [class: AstroImage]

  • Fringe [class: AstroImage]

  • Linearity

  • DarkGroupsKey - cell array of keys

  • DarkGroupsVal - Cell (size Nimages) of cells (size Nkeys)

  • SubtractOverScan - A logical (default is true)

Additional private properties are updated automatically from the image header:

  • FlatFilter
  • DarkExpTime
  • DarkTemp
  • FringeFilter
  • FringeExpTime

Methods

Read and write:

The following static method can be use to read FITS calibration images into a CalibImages object:

CI = CalibImages.read('Bias','LAST.2.1.2_20200821.060000_clear___1_0_dark_proc_Image_1.fits','BiasMask','LAST.2.1.2_20200821.060000_clear___1_0_dark_proc_Mask_1.fits','Flat','LAST.2.1.2_20200821.060000_clear___1_0_flat_proc_Image_1.fits','FlatMask','LAST.2.1.2_20200821.060000_clear___1_0_flat_proc_Mask_1.fits');

Alternatively, if the images file names follows the LAST/ULTRASAT file name convention implemented in the FileNames object) you can read the latest calibration files stored in a specific directory:

CI = CalibImages.loadFromDir
% see help for more information

Create calibration images

Several tools for creating bias and flat images exist. These tools are using the functions in the imProc.dark and imProc.flat packages.

Some simple examples:

CI = CalibImages('Bias',Bias, 'Flat',Flat);  % load bias/flat images
% create bias/flat and process:
CI.createBias(Images);
CI.createFlatFilter(Images, 'R');  % create a flat image for a single filter
CI.createFlat(Images);  % create a flat images for all filters

Apply calibration to science images

The CalibImages class contains functions for specific steps (e.g., debias, overscan, deflatOneFilt, deflat). To apply all the calibration steps (e.g., bias subtraction, flat correction,,,) in a single call:

These steps includs:

  • Create a mask image
  • Flag staturated pixels in mask
  • Subtract bias image
  • Propagate bias mask to science mask.
  • Subtract and remove overscan from image
  • Nonlinearity correction
  • Divide image by flat
  • Propagate flat mask to science mask.
  • Correct for fringing
  • Multiple image by gain
CI.processImages(Images); % subtract bias and divided by flat

Utilities

  • isemptyProp - Check if some properties (e.g., 'Bias') images are empty.
  • crop - Crop all images in a CalibImages object.
  • populateLinearity - read Linearity file from the config file and populate the CalibImages.
  • exist - Check if Bias/Dark/Flat/... image is populated in a CalibImages object.

Examples

% check if bias and flat images exist in CalibImages object
% R1 corresponds to Bias, while R2 corresponds to Flat
[R1, R2] = isemptyProp(Obj, {'Bias','Flat'}, 'Image')

% crop the Calibration images in the CalibImages object:
CI.crop([1 100 1 100])

% Check if Dark calibration image exist:
CI.exist('Dark')
⚠️ **GitHub.com Fallback** ⚠️