opticam.utils.fits_handlers
Functions
|
Get the BMJD, filter, binning, and gain from a file header. |
|
Parse the time from the header of a FITS file. |
|
Get the image data from a FITS file. |
|
Save the stacked images to a compressed FITS cube. |
|
Unpacked the stacked catalog images from out_directory/cat. |
|
Given a FITS file, get the image and corresponding filter, exposure time, dark current, and gain. |
Module Contents
- opticam.utils.fits_handlers.get_header_info(file, barycenter, logger)
Get the BMJD, filter, binning, and gain from a file header.
Parameters
- filestr
The file path.
- barycenterbool
Whether to apply a Barycentric correction to the image time stamps.
- loggerLogger | None
The logger.
Returns
- Tuple[float, str, str, float]
The BMJD, filter, binning, and gain dictionaries.
- Parameters:
file (str)
barycenter (bool)
logger (logging.Logger | None)
- Return type:
Tuple[numpy.typing.ArrayLike | None, str | None, str | None, float | None]
- opticam.utils.fits_handlers.get_time(header, file)
Parse the time from the header of a FITS file.
Parameters
- header
The FITS file header.
- filestr
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.
- Parameters:
header (Dict)
file (str)
- Return type:
float
- opticam.utils.fits_handlers.get_data(file, flat_corrector, rebin_factor, remove_cosmic_rays)
Get the image data from a FITS file.
Parameters
- filestr
The file.
- flat_correctorFlatFieldCorrector | None
The FlatFieldCorrector instance (if specified).
- rebin_factorint
The rebin factor.
- remove_cosmic_raysbool
Whether to remove cosmic rays from the image.
Returns
- NDArray
The data.
Raises
- ValueError
If file could not be opened.
- Parameters:
file (str)
flat_corrector (opticam.correctors.flat_field_corrector.FlatFieldCorrector | None)
rebin_factor (int)
remove_cosmic_rays (bool)
- Return type:
numpy.typing.NDArray
- opticam.utils.fits_handlers.save_stacked_images(stacked_images, out_directory, overwrite)
Save the stacked images to a compressed FITS cube.
Parameters
- stacked_imagesDict[str, NDArray]
The stacked images (filter: stacked image).
- Parameters:
stacked_images (Dict[str, numpy.typing.NDArray])
out_directory (str)
overwrite (bool)
- Return type:
None
- opticam.utils.fits_handlers.get_stacked_images(out_directory)
Unpacked the stacked catalog images from out_directory/cat.
Parameters
- out_directorystr
The directory path to the reduction output.
Returns
- Dict[str, NDArray]
The stacked images {filter: image}.
- Parameters:
out_directory (str)
- Return type:
Dict[str, numpy.typing.NDArray]
- opticam.utils.fits_handlers.get_image_noise_info(file_path)
Given a FITS file, get the image and corresponding filter, exposure time, dark current, and gain.
Parameters
- file_pathstr
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.
- Parameters:
file_path (str)
- Return type:
Tuple[numpy.typing.NDArray, astropy.units.Quantity, astropy.units.Quantity, astropy.units.Quantity]