ccd_calib#
- pyscope.reduction.ccd_calib(fnames, dark_frame=None, bias_frame=None, flat_frame=None, camera_type='ccd', astro_scrappy=(1, 3), bad_columns='', in_place=False, verbose=0, pedestal=1000)[source]#
Calibrate astronomical images using master calibration frames.
The
ccd_calib_clifunction applies bias, dark, and flat corrections to raw CCD or CMOS images to produce calibrated versions. Calibrated images are saved with the suffix_calappended to the original filename unless the--in-placeoption is used, which overwrites the raw files. The calibration process supports additional features like hot pixel removal and bad column correction.- Parameters:
- fnames
listofstr List of filenames to calibrate.
- dark_frame
str, optional Path to master dark frame. If the camera type is
cmos, the exposure time of the dark frame must match the exposure time of the target images.- bias_frame
str, optional Path to master bias frame. Ignored if the camera type is
cmos.- flat_frame
str, optional Path to master flat frame. The script assumes the master flat frame has already been bias and dark corrected. The flat frame is normalized by the mean of the entire image before being applied to the target images.
- camera_type
str, optional Camera type. Must be either
ccdorcmos. Defaults to"ccd".- astro_scrappy
tupleof (int,int), optional Number of hot pixel removal iterations and estimated camera read noise (in root-electrons per pixel per second). Defaults to
(1, 3).- bad_columns
str, optional Comma-separated list of bad columns to fix by averaging the value of each pixel in the adjacent column. Defaults to
"".- in_place
bool, optional If
True, overwrites the input files with the calibrated images. Defaults toFalse.- pedestal
int, optional Pedestal value to add to calibrated images after processing to prevent negative pixel values. Defaults to
1000.- verbose
int, optional Verbosity level for logging output: -
0: Warnings only (default). -1: Informational messages. -2: Debug-level messages.
- fnames
- Returns:
NoneThe function does not return any value. It writes calibrated images to disk.
- Raises:
FileNotFoundErrorRaised if any of the specified input files do not exist.
ValueErrorRaised if the calibration frames (e.g.,
dark_frame,bias_frame,flat_frame) do not match the target images in terms of critical metadata, such as: - Exposure time - Binning (X and Y) - Readout modeKeyErrorRaised if required header keywords (e.g.,
IMAGETYP,FILTER,EXPTIME,GAIN) are missing from the calibration frames or the raw image files.