opticam.utils.fits_handlers

Functions

get_header_info(file, instrument, barycenter)

Get the timestamp, exposure length, filter, and binning of the file.

get_data(file, instrument, rebin_factor, ...[, ...])

Get the (calibrated) image data from a file.

save_stacked_images(stacked_images, out_directory, ...)

Save the stacked images to a compressed multi-extension FITS file.

get_stacked_images(out_directory)

Unpacked the stacked catalog images from out_directory/cat/stacked_images.fits.gz.

Module Contents

opticam.utils.fits_handlers.get_header_info(file, instrument, barycenter)

Get the timestamp, exposure length, filter, and binning of the file.

Parameters

fileMEFSlice

The MEFSlice instance representing the file.

instrumentInstrument

The instrument that created the file.

barycenterbool

Whether to apply a Barycentric correction to the image’s timestamp.

Returns

Tuple[float, float, str, str, str, float]

The timestamp, exposure length, camera, filter, and binning of the image.

Parameters:
Return type:

tuple[float, float, str, str, str]

opticam.utils.fits_handlers.get_data(file, instrument, rebin_factor, remove_cosmic_rays, bias_corrector=None, dark_corrector=None, flat_corrector=None)

Get the (calibrated) image data from a file.

Parameters

fileMEFSlice

The MEFSlice instance representing the file.

instrumentInstrument

The instrument that created the file.

rebin_factorint

The image rebinning factor.

remove_cosmic_raysbool

Whether to remove cosmic rays from the image.

bias_correctorBiasCorrector | None, optional

The bias corrector, by default None. If None, no bias corrections are performed.

dark_correctorDarkNoiseCorrector | None, optional

The dark noise corrector, by default None. If None, no dark noise corrections are performed.

flat_correctorFlatFieldCorrector | None, optional

The flat-field corrector, by default None. If None, no flat-field corrections are performed.

Returns

Tuple[NDArray[np.float64], float | NDArray[np.float64], float | NDArray[np.float64], float | NDArray[np.float64]]

The corrected image and the master bias, dark, and flat variances. If any of the correctors are undefined, the variance of that corrector is set to 0.

Parameters:
Return type:

tuple[numpy.typing.NDArray[numpy.float64], float | numpy.typing.NDArray[numpy.float64], float | numpy.typing.NDArray[numpy.float64], float | numpy.typing.NDArray[numpy.float64]]

opticam.utils.fits_handlers.save_stacked_images(stacked_images, out_directory, overwrite)

Save the stacked images to a compressed multi-extension FITS file.

Parameters

stacked_imagesdict[str, NDArray]

The stacked images {filter: stacked image}.

out_directoryPath

The path to the directory in which the stacked images will be saved.

overwritebool

Whether to overwrite the file if it already exists.

Parameters:
  • stacked_images (dict[str, numpy.typing.NDArray])

  • out_directory (pathlib.Path)

  • overwrite (bool)

Return type:

None

opticam.utils.fits_handlers.get_stacked_images(out_directory)

Unpacked the stacked catalog images from out_directory/cat/stacked_images.fits.gz.

Parameters

out_directoryPath

The path to the directory containing the stacked images.

Returns

Dict[str, NDArray[np.float64]]

The stacked images {filter: image}.

Parameters:

out_directory (pathlib.Path)

Return type:

dict[str, numpy.typing.NDArray[numpy.float64]]