Read and Write Functions


cmos_noise_map.utils.read_write_utils.read_write_utils.read_bias_frames(self)

A function to open up fits files with memory mapping.

Parameters:
  • path (str) – DESCRIPTION. The path to your fits files without the .fits at the end

  • data_ext (integer or string, optional) – DESCRIPTION. The default is 0. This is the extension to the data header data unit (hdu) that is to be processed.

Returns:

ims – DESCRIPTION. And array of opened, memory mapped, fits hdus. Not the data itself.

Return type:

array



cmos_noise_map.utils.read_write_utils.read_write_utils.write_file(self, data, fpack=True)

A function to write an output file depending on which method was used to generate it.

Parameters:
  • data ((NxN array of floats)) – DESCRIPTION. he data to be written out into the fits file. This is where the readnoise map or the parameter map goes.

  • filename (str) – DESCRIPTION. Name of the file to be written out. This is without the file ending.

  • hduname (str, optional) – DESCRIPTION. The name of the hdu in case of writing out a fits file. The default is None.

  • data_type (TYPE, optional) – DESCRIPTION. Type of data to be written out. This is determined by the program depending on what method was used. The default is “image”. If the method used was “param” then the type is “table”

Return type:

None.



cmos_noise_map.utils.read_write_utils.read_parameter_table(csv_file)

A utility function to read in a parameter map

Parameters:

csv_file (.csv file) – The csv file containing the parameter data output.

Returns:

  • means (TYPE: list(float), length = num_peaks) – DESCRIPTION: The means of each of the Gaussian modes calculated by GMM

  • var (TYPE: list(float), length = num_peaks) – DESCRIPTION: The covariance of each Gaussian mode calculated by GMM

  • num_peaks (TYPE: int) – DESCRIPTION: The number of Gaussians used to model the distribution of values of the pixel

  • amps (TYPE: list(float)) – DESCRIPTION: The weights of each gaussian in the mixture. All weights sum to 1.


Data utility functions


cmos_noise_map.utils.data_utils.data_to_pixel(data)

Takes data in the form of a series of opened images (of whatever shape) and returns the data as a list of pixel values across images, along with data.

Parameters:

data (list, shape(N images, rows, columns) #Is this true?) – DESCRIPTION. A list of images or cutout of images

Returns:

pixels – DESCRIPTION. The list of pixel values across images, for all pixels given.

Return type:

list of shape(1, N images)



cmos_noise_map.utils.data_utils.check_input_data(images, method)

Ensure that data is all the same shape, and that there are at least 50 files. This is used in read_bias_frames