aotpy.io.fits package

Submodules

aotpy.io.fits.compat module

class aotpy.io.fits.compat.AOTVersion(major: int, minor: int, patch: int)[source]

Bases: object

classmethod from_string(version_string: str) AOTVersion[source]
major: int
minor: int
patch: int

aotpy.io.fits.reader module

class aotpy.io.fits.reader.AOTFITSReader(filename, **kwargs)[source]

Bases: SystemReader

get_extra_data()[source]

Return a tuple of extra data that may have been in AOTFITS file.

get_system() AOSystem[source]

Return AOSystem that has been read.

aotpy.io.fits.utils module

This module contains classes and functions that aid in handling AOT FITS files.

class aotpy.io.fits.utils.FITSFileImage(path: str | PathLike, index: int | None = None, *, read_data=True, **kwargs)[source]

Bases: _FITSExternalImage

Describes an external FITS file present locally, containing multidimensional data and metadata related to it.

FITSFileImage remembers the path from which the data came from, enabling future referencing of that path.

Parameters:
  • path – Path to FITS file that contains multidimensional data.

  • index (int, optional) – Index of the HDU that contains the image data. If omitted, the first HDU containing image data is assumed.

  • **kwargs – Keyword arguments passed on as options to the file handling function.

class aotpy.io.fits.utils.FITSURLImage(url: str, index: int | None = None, *, read_data=True, **kwargs)[source]

Bases: _FITSExternalImage

Describes an external FITS file available via URL, containing multidimensional data and metadata related to it.

FITSURLImage remembers the URL from which the data came from, enabling future referencing of that URL.

Parameters:
  • url – URL to FITS file that contains multidimensional data.

  • index (int, optional) – Index of the HDU that contains the image data. If omitted, the first HDU containing image data is assumed.

  • **kwargs – Keyword arguments passed on as options to the file handling function.

aotpy.io.fits.utils.card_from_metadatum(md: Metadatum) Card[source]

Get Card from Metadatum.

Parameters:

mdMetadatum to convert to Card.

aotpy.io.fits.utils.image_from_fits_file(path: str | PathLike, index: int | None = None, *, name: str | None = None, **kwargs) Image[source]

Get Image from FITS file specified on path or URL.

Parameters:
  • path – Path/URL to FITS file that contains multidimensional data.

  • index (int, optional) – Index of the HDU that contains the image data. If omitted, the first HDU containing image data is assumed.

  • name (str, optional) – Name of the Image. If None, the name is the same as in the file.

  • **kwargs – Keyword arguments passed on as options to the file handling function.

aotpy.io.fits.utils.image_from_hdu(hdu: ImageHDU, *, name: str | None = None) Image[source]

Get Image from specified HDU.

Parameters:
  • hdu – HDU from which Image is to be extracted.

  • name (str, optional) – Name of the Image. If None, the name is the same as in the HDU.

aotpy.io.fits.utils.image_from_hdus(hdus: HDUList, index: int | None = None, *, name: str | None = None) Image[source]

Get Image from specified path or URL.

Parameters:
  • hdus – List of HDUs from which Image is to be extracted.

  • index (int, optional) – Index of the HDU that contains the image data. If omitted, the first HDU containing image data is assumed.

  • name (str, optional) – Name of the Image. If None, the name is the same as in the HDU.

aotpy.io.fits.utils.metadata_from_hdu(hdu: ImageHDU) list[Metadatum][source]

Get metadata (list of Metadatum) from HDU. Only relevant keywords are extracted.

Parameters:

hdu – HDU from which to extract metadata.

aotpy.io.fits.utils.metadatum_from_card(card: Card) Metadatum[source]

Get Metadatum from Card.

Parameters:

cardCard to convert to Metadatum.

aotpy.io.fits.writer module

This module contains classes and functions that enable writing AOT FITS files.

class aotpy.io.fits.writer.AOTFITSWriter(system: AOSystem)[source]

Bases: SystemWriter

get_hdulist()[source]

Get the HDUList that produces the AOT FITS file for the initialized system.

write(filename, **kwargs) None[source]

Write the initialized system into the specified filename.

Parameters:
  • filename – Path to the file that will be written.

  • **kwargs – Keyword arguments passed on as options to the file handling function.

Module contents

A package for handling FITS files using the AOT format.