opihiexarata.opihi.preprocess module

A data wrapper class which takes in raw Opihi data, flats, and darks and produces a valid reduced image.

class opihiexarata.opihi.preprocess.OpihiPreprocessSolution(mask_c_fits_filename: str, mask_g_fits_filename: str, mask_r_fits_filename: str, mask_i_fits_filename: str, mask_z_fits_filename: str, mask_1_fits_filename: str, mask_2_fits_filename: str, mask_b_fits_filename: str, flat_c_fits_filename: str, flat_g_fits_filename: str, flat_r_fits_filename: str, flat_i_fits_filename: str, flat_z_fits_filename: str, flat_1_fits_filename: str, flat_2_fits_filename: str, flat_b_fits_filename: str, bias_fits_filename: str, dark_current_fits_filename: str, linearity_fits_filename: str)[source]

Bases: ExarataSolution

A class which represents the reduction process of Opihi data, having the raw data corrected using previously and provided derived flats and darks. The required parameters (such as exposure time) must also be provided.

This class does not have an engine as there is only one way to reduce data provided the systematics of the Opihi telescope itself; as such the data is handled straight by this solution class.

_mask_c_fits_filename

The filename for the pixel mask for the clear filter stored in a fits file.

Type:

string

_mask_g_fits_filename

The filename for the pixel mask for the g filter stored in a fits file.

Type:

string

_mask_r_fits_filename

The filename for the pixel mask for the r filter stored in a fits file.

Type:

string

_mask_i_fits_filename

The filename for the pixel mask for the i filter stored in a fits file.

Type:

string

_mask_z_fits_filename

The filename for the pixel mask for the z filter stored in a fits file.

Type:

string

_mask_1_fits_filename

The filename for the pixel mask for the 1 filter stored in a fits file.

Type:

string

_mask_2_fits_filename

The filename for the pixel mask for the 2 filter stored in a fits file.

Type:

string

_mask_b_fits_filename

The filename for the pixel mask for the block filter stored in a fits file.

Type:

string

_flat_c_fits_filename

The filename for the flat field for the clear filter stored in a fits file.

Type:

string

_flat_g_fits_filename

The filename for the flat field for the g filter stored in a fits file.

Type:

string

_flat_r_fits_filename

The filename for the flat field for the r filter stored in a fits file.

Type:

string

_flat_i_fits_filename

The filename for the flat field for the i filter stored in a fits file.

Type:

string

_flat_z_fits_filename

The filename for the flat field for the z filter stored in a fits file.

Type:

string

_flat_1_fits_filename

The filename for the flat field for the 1 filter stored in a fits file.

Type:

string

_flat_2_fits_filename

The filename for the flat field for the 2 filter stored in a fits file.

Type:

string

_flat_b_fits_filename

The filename for the flat field for the block filter stored in a fits file.

Type:

string

_bias_fits_filename

The filename for the per-pixel bias values of the data, stored in a fits file.

Type:

string

_dark_current_fits_filename

The filename for the per-pixel rate values of the dark data, stored in a fits file.

Type:

string

_linearity_fits_filename

The filename for the linearity response of the CCD. This should be a 1D fits file detailing counts as a function of time for the saturation curve of the CCD.

Type:

string

mask_carray

The pixel mask for the clear filter as determined by the provided fits file.

mask_garray

The pixel mask for the g filter as determined by the provided fits file.

mask_rarray

The pixel mask for the r filter as determined by the provided fits file.

mask_iarray

The pixel mask for the i filter as determined by the provided fits file.

mask_zarray

The pixel mask for the z filter as determined by the provided fits file.

mask_1array

The pixel mask for the 1 filter as determined by the provided fits file.

mask_2array

The pixel mask for the 2 filter as determined by the provided fits file.

mask_barray

The pixel mask for the block filter as determined by the provided fits file.

flat_carray

The flat field for the clear filter as determined by the provided fits file.

flat_garray

The flat field for the g filter as determined by the provided fits file.

flat_rarray

The flat field for the r filter as determined by the provided fits file.

flat_iarray

The flat field for the i filter as determined by the provided fits file.

flat_zarray

The flat field for the z filter as determined by the provided fits file.

flat_1array

The flat field for the 1 filter as determined by the provided fits file.

flat_2array

The flat field for the 2 filter as determined by the provided fits file.

flat_barray

The flat field for the block filter as determined by the provided fits file.

biasarray

The bias array as determined by the provided fits file.

dark_currentarray

The dark rate, per pixel, as determined by the provided fits file. The dark current unit is counts / second.

linearity_factorsarray

The polynomial factors of the linearity function starting from the 0th order.

linearity_functionfunction

The linearity function across the whole CCD. It is an average function across all of the pixels.

__init__(mask_c_fits_filename: str, mask_g_fits_filename: str, mask_r_fits_filename: str, mask_i_fits_filename: str, mask_z_fits_filename: str, mask_1_fits_filename: str, mask_2_fits_filename: str, mask_b_fits_filename: str, flat_c_fits_filename: str, flat_g_fits_filename: str, flat_r_fits_filename: str, flat_i_fits_filename: str, flat_z_fits_filename: str, flat_1_fits_filename: str, flat_2_fits_filename: str, flat_b_fits_filename: str, bias_fits_filename: str, dark_current_fits_filename: str, linearity_fits_filename: str) None[source]

Instantiation of the reduced Opihi data class.

Parameters:
  • mask_c_fits_filename (string) – The filename for the pixel mask in the clear filter stored in a fits file.

  • mask_g_fits_filename (string) – The filename for the pixel mask in the g filter stored in a fits file.

  • mask_r_fits_filename (string) – The filename for the pixel mask in the r filter stored in a fits file.

  • mask_i_fits_filename (string) – The filename for the pixel mask in the i filter stored in a fits file.

  • mask_z_fits_filename (string) – The filename for the pixel mask in the z filter stored in a fits file.

  • mask_1_fits_filename (string) – The filename for the pixel mask in the 1 filter stored in a fits file.

  • mask_2_fits_filename (string) – The filename for the pixel mask in the 2 filter stored in a fits file.

  • mask_b_fits_filename (string) – The filename for the pixel mask in the block filter stored in a fits file.

  • flat_c_fits_filename (string) – The filename for the flat field in the clear filter stored in a fits file.

  • flat_g_fits_filename (string) – The filename for the flat field in the g filter stored in a fits file.

  • flat_r_fits_filename (string) – The filename for the flat field in the r filter stored in a fits file.

  • flat_i_fits_filename (string) – The filename for the flat field in the i filter stored in a fits file.

  • flat_z_fits_filename (string) – The filename for the flat field in the z filter stored in a fits file.

  • flat_1_fits_filename (string) – The filename for the flat field in the 1 filter stored in a fits file.

  • flat_2_fits_filename (string) – The filename for the flat field in the 2 filter stored in a fits file.

  • flat_b_fits_filename (string) – The filename for the flat field in the block filter stored in a fits file.

bias_fits_filenamestring

The filename for the per-pixel bias values of the data, stored in a fits file.

dark_current_fits_filenamestring

The filename for the per-pixel rate values of the dark data, stored in a fits file.

linearity_fits_filenamestring

The filename for the linearity response of the CCD, stored as a text file.

Return type:

None

__init_read_flat_data() None

This function just reads all of the fits file data for the filter-dependent flat fields and puts it where it belongs per the documentation.

Parameters:

None

Return type:

None

__init_read_linearity_data()

This function reads all of the linearity data and creates a function for linearity. First order interpolation is done on this data.

It is expected that the data from the linearity filename is of high enough resolution that first order interpolation is good enough.

Parameters:

None

Return type:

None

__init_read_mask_data() None

This function just reads all of the fits file data for the filter-dependent pixel masks and puts it where it belongs per the documentation.

Parameters:

None

Return type:

None

preprocess_data_image(raw_data: ndarray, exposure_time: float, filter_name: str) ndarray[source]

The formal reduction algorithm for data from Opihi. It follows preprocessing instructions for CCDs.

Parameters:
  • data (array-like) – The raw image data from the Opihi telescope.

  • exposure_time (float) – The exposure time of the image in seconds.

  • filter_name (string) – The name of the filter which the image was taken in, used to select the correct flat and mask file.

Returns:

preprocess_data – The data, after it has been preprocessed.

Return type:

array

preprocess_fits_file(raw_filename: str, out_filename: str = None, overwrite: bool = False) tuple[Header, ndarray][source]

Preprocess an Opihi image, the provided fits filename is read, the needed information extracted from it, and it is processed using historical archive calibration files created per the documentation and specified by the configuration files.

Parameters:
  • raw_filename (str) – The filename of the raw fits file image from Opihi.

  • out_filename (str, default = None) – The filename to save the reduced image as a fits file. Some added entries are added to the header. If this is not provided as defaults to None, no file is saved.

  • overwrite (bool, default = False) – If overwrite is True, the filename is overwritten in the event of a collision.

Returns:

  • preprocess_header (Astropy Header) – The header of the fits file after preprocessing. Some added entries are present to document information from preprocessing.

  • preprocess_data (array) – The data array of the image after the raw image went through the preprocess reduction.