opticam.utils.fits_handlers =========================== .. py:module:: opticam.utils.fits_handlers Functions --------- .. autoapisummary:: opticam.utils.fits_handlers.get_header_info opticam.utils.fits_handlers.get_time opticam.utils.fits_handlers.get_data opticam.utils.fits_handlers.save_stacked_images opticam.utils.fits_handlers.get_stacked_images opticam.utils.fits_handlers.get_image_noise_info Module Contents --------------- .. py:function:: get_header_info(file, barycenter, logger) Get the BMJD, filter, binning, and gain from a file header. Parameters ---------- file : str The file path. barycenter : bool Whether to apply a Barycentric correction to the image time stamps. logger : Logger | None The logger. Returns ------- Tuple[float, str, str, float] The BMJD, filter, binning, and gain dictionaries. .. py:function:: get_time(header, file) Parse the time from the header of a FITS file. Parameters ---------- header The FITS file header. file : str The path to the file. Returns ------- float The time of the observation in MJD. Raises ------ ValueError If the time cannot be parsed from the header. KeyError If neither 'GPSTIME' nor 'UT' keys are found in the header. .. py:function:: get_data(file, flat_corrector, rebin_factor, remove_cosmic_rays) Get the image data from a FITS file. Parameters ---------- file : str The file. flat_corrector : FlatFieldCorrector | None The `FlatFieldCorrector` instance (if specified). rebin_factor : int The rebin factor. remove_cosmic_rays : bool Whether to remove cosmic rays from the image. Returns ------- NDArray The data. Raises ------ ValueError If `file` could not be opened. .. py:function:: save_stacked_images(stacked_images, out_directory, overwrite) Save the stacked images to a compressed FITS cube. Parameters ---------- stacked_images : Dict[str, NDArray] The stacked images (filter: stacked image). .. py:function:: get_stacked_images(out_directory) Unpacked the stacked catalog images from out_directory/cat. Parameters ---------- out_directory : str The directory path to the reduction output. Returns ------- Dict[str, NDArray] The stacked images {filter: image}. .. py:function:: get_image_noise_info(file_path) Given a FITS file, get the image and corresponding filter, exposure time, dark current, and gain. Parameters ---------- file_path : str The path to the FITS file. Returns ------- Tuple[NDArray, Quantity, Quantity, Quantity] The image, exposure time, dark current, and gain. Raises ------ ValueError If the file could not be parsed.