ccd_process

ccdproc.ccd_process(ccd, oscan=None, trim=None, error=False, master_bias=None, dark_frame=None, master_flat=None, bad_pixel_mask=None, gain=None, readnoise=None, oscan_median=True, oscan_model=None, min_value=None, dark_exposure=None, data_exposure=None, exposure_key=None, exposure_unit=None, dark_scale=False, gain_corrected=True)[source]

Perform basic processing on ccd data.

The following steps can be included:

The task returns a processed CCDData object.

Parameters:
ccdCCDData

Frame to be reduced.

oscanCCDData, str or None, optional

For no overscan correction, set to None. Otherwise provide a region of ccd from which the overscan is extracted, using the FITS conventions for index order and index start, or a slice from ccd that contains the overscan. Default is None.

trimstr or None, optional

For no trim correction, set to None. Otherwise provide a region of ccd from which the image should be trimmed, using the FITS conventions for index order and index start. Default is None.

errorbool, optional

If True, create an uncertainty array for ccd. Default is False.

master_biasCCDData or None, optional

A master bias frame to be subtracted from ccd. The unit of the master bias frame should match the unit of the image after gain correction if gain_corrected is True. Default is None.

dark_frameCCDData or None, optional

A dark frame to be subtracted from the ccd. The unit of the master dark frame should match the unit of the image after gain correction if gain_corrected is True. Default is None.

master_flatCCDData or None, optional

A master flat frame to be divided into ccd. The unit of the master flat frame should match the unit of the image after gain correction if gain_corrected is True. Default is None.

bad_pixel_masknumpy.ndarray or None, optional

A bad pixel mask for the data. The bad pixel mask should be in given such that bad pixels have a value of 1 and good pixels a value of 0. Default is None.

gainQuantity or None, optional

Gain value to multiple the image by to convert to electrons. Default is None.

readnoiseQuantity or None, optional

Read noise for the observations. The read noise should be in electrons. Default is None.

oscan_medianbool, optional

If true, takes the median of each line. Otherwise, uses the mean. Default is True.

oscan_modelModel or None, optional

Model to fit to the data. If None, returns the values calculated by the median or the mean. Default is None.

min_valuefloat or None, optional

Minimum value for flat field. The value can either be None and no minimum value is applied to the flat or specified by a float which will replace all values in the flat by the min_value. Default is None.

dark_exposureQuantity or None, optional

Exposure time of the dark image; if specified, must also provided data_exposure. Default is None.

data_exposureQuantity or None, optional

Exposure time of the science image; if specified, must also provided dark_exposure. Default is None.

exposure_keyKeyword, str or None, optional

Name of key in image metadata that contains exposure time. Default is None.

exposure_unitUnit or None, optional

Unit of the exposure time if the value in the meta data does not include a unit. Default is None.

dark_scalebool, optional

If True, scale the dark frame by the exposure times. Default is False.

gain_correctedbool, optional

If True, the master_bias, master_flat, and dark_frame have already been gain corrected. Default is True.

Returns:
occdCCDData

Reduded ccd.

Examples

  1. To overscan, trim and gain correct a data set:

    >>> import numpy as np
    >>> from astropy import units as u
    >>> from astropy.nddata import CCDData
    >>> from ccdproc import ccd_process
    >>> ccd = CCDData(np.ones([100, 100]), unit=u.adu)
    >>> nccd = ccd_process(ccd, oscan='[1:10,1:100]',
    ...                    trim='[10:100, 1:100]', error=False,
    ...                    gain=2.0*u.electron/u.adu)