modules.ccd_calibrations
Library of functions to build the CCD calibration files for image processing to reduce data from the Tull coude spectrograph
Created by DMK on 9/24/2023
Last updated by DMK on 10/14/2023
Module Contents
Functions
|
Function to read in the bias images and median combine them into a super bias to apply to other frames |
|
Function to read in flat field images and median combine them into the flat field for image processing |
|
Function to create a bad pixel mask using the super bias and flat field. |
|
Function to make a 2D image plot of an input 2D data array. Generalized to plot any input image. |
|
Main function to build all of the CCD calibrations, using the above functions for the individual calibrations. |
- modules.ccd_calibrations.build_super_bias(bias_file_names, read_noise)
Function to read in the bias images and median combine them into a super bias to apply to other frames
- Parameters:
bias_file_names (list) – List of file names (type str) for the raw bias frames
read_noise (float) – The read noise (in ADU, converted from the header value which is given in electrons)
- Returns:
super_bias – Multi-extension FITS ImageHDU list with the median combined super bias and associated error
- Return type:
HDUList
- modules.ccd_calibrations.build_flat_field(flat_file_names, read_noise, super_bias)
Function to read in flat field images and median combine them into the flat field for image processing
- Parameters:
flat_file_names (list) – List of file names (type str) for the raw flat field frames
read_noise (float) – The read noise (in ADU, converted from the header value which is given in electrons)
super_bias (HDUList) – Multi-extension FITS ImageHDU list with the median combined super bias and associated error created with build_super_bias.
- Returns:
flat_field – Multi-extension FITS ImageHDU list with the median combined flat field and associated error.
- Return type:
HDUList
- modules.ccd_calibrations.make_bad_pixel_mask(super_bias, flat_field, bias_bpm_percentile, flat_field_bpm_limit)
Function to create a bad pixel mask using the super bias and flat field.
- Parameters:
super_bias (HDUList) – Multi-extension FITS ImageHDU list with the median combined super bias and associated error created with build_super_bias.
flat_field (HDUList) – Multi-extension FITS ImageHDU list with the median combined flat field and associated error created with build_flat_field.
bias_bpm_percentile (float) – The percentile above which super bias counts are marked as bad pixels (hot pixels). This is defined in the config file.
flat_field_bpm_limit (float) – The flat field value below which a pixel is marked as bad. This is defined in the config file.
- Returns:
bad_pixel_mask – The bad pixel mask created using the super bias and flat field. Bad pixels are valued 0, good pixels are valued 1.
- Return type:
FITSHDU
- modules.ccd_calibrations.cal_image_2d_plot(image, figure_title, file_name, bpm=None)
Function to make a 2D image plot of an input 2D data array. Generalized to plot any input image.
- Parameters:
image (array) – The 2D array to show.
title (str) – The title of the plot (here to mark what type of image is plotted).
file_name (str) – The file name to save the plot to.
bpm (array, optional) – The 2D array defining the bad pixel mask. This can be input and overplotted the input data image. The default is None.
- Return type:
None.
- modules.ccd_calibrations.build_calibrations(header_df, bias_frame_indices, flat_frame_indices, config)
Main function to build all of the CCD calibrations, using the above functions for the individual calibrations.
- Parameters:
header_df (pandas DataFrame) – The compiled information from the file headers.
bias_frame_indices (list) – List of indices of the bias frames for the header dataframe.
flat_frame_indices (list) – List of indices of the flat frames for the header dataframe.
config (dict) – The overall config file defined using YAML with all parameters for running the reduction and analysis pipeline.
- Return type:
None.