opticam.utils.fits_handlers

Functions

get_header_info(file, barycenter, logger)

Get the BMJD, filter, binning, and gain from a file header.

get_time(header, file)

Parse the time from the header of a FITS file.

get_data(file, flat_corrector, rebin_factor, ...)

Get the image data from a FITS file.

save_stacked_images(stacked_images, out_directory, ...)

Save the stacked images to a compressed FITS cube.

get_stacked_images(out_directory)

Unpacked the stacked catalog images from out_directory/cat.

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, return_error, 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.

return_errorbool

Whether to compute and return the error image.

remove_cosmic_raysbool

Whether to remove cosmic rays from the image.

Returns

NDArray | Tuple[NDArray, NDArray]

_description_

Raises

ValueError

If file could not be opened.

Parameters:
Return type:

numpy.typing.NDArray | Tuple[numpy.typing.NDArray, 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]