fitsmgmt.io.load_ccd

fitsmgmt.io.load_ccd(
    path,
    extension=None,
    trimsec=None,
    ccddata=True,
    use_wcs=True,
    unit=None,
    extension_uncertainty='UNCERT',
    extension_mask='MASK',
    extension_flags=None,
    full=False,
    key_uncertainty_type='UTYPE',
    memmap=False,
    **kwd,
)

Load one FITS image, with optional uncertainty and mask extensions.

Parameters

path : path - like

FITS file to load.

extension : int, str, or (str, int) = None

FITS extension: a zero-based index, an EXTNAME string, or an (EXTNAME, EXTVER) tuple. None selects the first extension with data. Default: None.

trimsec : str = None

FITS-style section to apply after loading the selected image. Default: None.

ccddata : bool = True

Return ~astropy.nddata.CCDData when True (default). When False, return only the image array unless full=True.

use_wcs : bool = True

Build the WCS with ~astropy.io.fits.getheader instead of Astropy’s CCDData reader. This keeps TPV WCS usable but can be slower. Used only for the Astropy/CCDData path. Default: True.

unit : ~astropy.units.Unit = None

Override the image unit. If omitted, BUNIT is used when present; otherwise Astropy falls back to ADU. Used for CCDData loading only.

full : bool = False

Return (data, unc, mask, flag) for raw loading, or (ccd, uncertainty, mask, flags) when ccddata=True. Missing extensions produce None. Default: False.

extension_uncertainty : extension selector or None = 'UNCERT'

Extensions used to initialize the corresponding CCDData components or raw arrays. Defaults are "UNCERT", "MASK", and None. Flags are not supported by Astropy’s CCDData reader.

extension_mask : extension selector or None = 'UNCERT'

Extensions used to initialize the corresponding CCDData components or raw arrays. Defaults are "UNCERT", "MASK", and None. Flags are not supported by Astropy’s CCDData reader.

extension_flags : extension selector or None = 'UNCERT'

Extensions used to initialize the corresponding CCDData components or raw arrays. Defaults are "UNCERT", "MASK", and None. Flags are not supported by Astropy’s CCDData reader.

key_uncertainty_type : str = 'UTYPE'

Header key naming the uncertainty class. Used only for CCDData loading. Default: "UTYPE".

memmap : bool = False

Whether Astropy should memory-map FITS data. Default: False (the opposite of Astropy’s default configuration).

****kwd** : = {}

Additional keywords passed to ~astropy.nddata.CCDData.read in the Astropy path. They are ignored by the direct fitsio path used when ccddata=False and fitsio is installed.

Returns

: ~astropy.nddata.CCDData, ~numpy.ndarray, or tuple

The selected image, or the full tuple requested by full.

Notes

When fitsio is installed and ccddata=False, the direct reader uses extension, trimsec, full, and the three extension selectors; WCS, unit, uncertainty-class, and memory-map options do not apply in that branch.