Overscan¶
The overscan (or prescan) region on a CCD can consist of physical pixels on the detector that are not illuminated, or it can consist of a set of virtual pixels created by reading out the serial register either before or after transferring the charge from the CCD for each column/row. A detector may have multiple regions (amplifiers) and each one usually has an associated overscan region.
This module is intended to be applied to a single overscan region.
In HDRL the overscan correction value for each row/column of pixels is computed from a rectangular running sub-region of the full overscan region of the detector.
A small sub-region will increase the uncertainty of the correction but can account for rapid spatial changes in the bias level, while a large sub-region will decrease the uncertainty but smooth out spatial changes.
The actual correction value can be computed by estimating the location/first moment of the pixel value distribution within the sub-region. Several estimation methods, like mean, median, mode or sigma/minmax-clipped mean, are available.
A typical overscan correction may be essentially independent of row/column, or it may vary smoothly or with abrupt gradient changes. Hence the implementation of a location estimation method as opposed to the fitting of an analytical function.
When choosing the overscan region, note that the first few rows/columns that are read out after the image area will have an artificially high bias level due to the charge transfer efficiency not being 100%. It is recommended therefore not to include the 2-3 rows/columns right next to the image region in the overscan region.
An interesting phenomenon is that a very bright star/object may increase the bias level for the few rows/columns that it covers. Hence it is not advisable to set the size of the sub-region to a value that is much larger than the image point-spread-function FWHM.
This module allows the computation of the overscan correction for an image from a predefined overscan region. It also provides a function that applies the overscan correction to the image, using the result of the overscan computation.
In PyHDRL this is hdrl.func.Overscan.
Computation¶
Create an Overscan object with the correction direction, CCD
read-out noise, running-box half size, a hdrl.func.Collapse
instance and overscan region, then call compute() on an
hdrl.core.Image.
The region is a tuple (llx, lly, urx, ury) in FITS-style 1-based
coordinates. The direction is "x" (HDRL_X_AXIS) or "y"
(HDRL_Y_AXIS).
Supported collapse methods are hdrl.func.Collapse.Mean,
hdrl.func.Collapse.Median, hdrl.func.Collapse.Sigclip,
hdrl.func.Collapse.MinMax and hdrl.func.Collapse.Mode.
After compute(), the results are available as properties of the
same object:
correction: 1D overscan correction (hdrl.core.Image)contribution: contribution map (cpl.core.Image)chi2/red_chi2: \(\chi^{2}\) and reduced \(\chi^{2}\)sigclip_reject_low/sigclip_reject_high: sigma-clip rejection maps (when sigma clipping is used)minmax_reject_low/minmax_reject_high: min/max rejection maps (when min/max clipping is used)
import hdrl
collapse = hdrl.func.Collapse.Mean()
os_region = (1, 1, 20, height)
overscan = hdrl.func.Overscan("x", 1.0, 5, collapse, os_region)
overscan.compute(image)
correction = overscan.correction
Correction¶
correct() applies the last computed overscan model to an
hdrl.core.Image. The optional region argument is a tuple
(llx, lly, urx, ury) selecting the image region to correct; if
omitted, the whole image is corrected.
It returns an OverscanCorrectResult with:
corrected: correctedhdrl.core.Imagebadmask: corresponding bad pixel mask (cpl.core.Image)
reg = (21, 1, width, height)
result = overscan.correct(image, reg)
corrected = result.corrected