Subtract the overscan region from an image.
Parameters: | ccd : CCDData
overscan : CCDData
overscan_axis : 0 or 1, optional
fits_section : str
median : bool, optional
model : Model, optional
add_keyword : str, Keyword or dict-like, optional
|
---|---|
Returns: | ccd : CCDData
|
Raises: | TypeError
|
Notes
The format of the fits_section string follow the rules for slices that are consistent with the FITS standard (v3) and IRAF usage of keywords like TRIMSEC and BIASSEC. Its indexes are one-based, instead of the python-standard zero-based, and the first index is the one that increases most rapidly as you move through the array in memory order, opposite the python ordering.
The ‘fits_section’ argument is provided as a convenience for those who are processing files that contain TRIMSEC and BIASSEC. The preferred, more pythonic, way of specifying the overscan is to do it by indexing the data array directly with the overscan argument.
Examples
>>> import numpy as np
>>> from astropy import units as u
>>> arr1 = CCDData(np.ones([100, 100]), unit=u.adu)
The statement below uses all rows of columns 90 through 99 as the overscan.
>>> no_scan = subtract_overscan(arr1, overscan=arr1[:, 90:100])
>>> assert (no_scan.data == 0).all()
This statement does the same as the above, but with a FITS-style section.
>>> no_scan = subtract_overscan(arr1, fits_section='[91:100, :]')
>>> assert (no_scan.data == 0).all()
Spaces are stripped out of the fits_section string.