Module: multi_extension_fits#

Standardizer for FITS files containing multiple extensions.

class kbmod.standardizers.fits_standardizers.multi_extension_fits.MultiExtensionFits(location=None, hdulist=None, config=None, set_processable=False, **kwargs)[source]#

Suppports processing of a single, multi-extension FITS file.

Extensions for which it’s possible to extract WCS, bounding boxes and masks are required to be places in the exts attribute. For single extension FITS files this is the primary header, as it contains the image data.

Parameters:
locationstr

Location of the FITS file, can be an URI or local filesystem path.

set_extsbool

When True, finds all HDUs that are image-like and sets them as elements of exts list. Note that using the default _isImageLike implementation is rather costly as it loads the whole data into memory.

Attributes:
hdulist~astropy.io.fits.HDUList

All HDUs found in the FITS file

primary~astropy.io.fits.PrimaryHDU

The primary HDU.

extslist

All HDUs from hdulist marked as “image-like” for further processing with KBMOD. Does not include the primary HDU, when it doesn’t contain any image data. Contains at least 1 entry.

wcslist

A list of WCS’s or None for each entry marked as processable.

bboxlist

A list of bounding boxes or None for each entry marked as processable.

Methods

canStandardize(tgt)

Returns True when the standardizer knows how to process the given upload (file) type.

close([output_verify, verbose, closed])

Close the associated FITS file and memmap object, if any.

get(tgt[, force, config])

Get the standardizer class that can handle given file.

resolveFromPath(tgt)

Successfully resolves FITS files on a local file system, that are readable by AstroPy.

resolveTarget(tgt)

Returns True if the target is a FITS file on a local filesystem, that can be read by AstroPy FITS module, or an ~astropy.io.fits.HDUList.

standardize()

Invokes standardize metadata, image, variance, mask and PSF and returns the results as a dictionary.

standardizeBBox()

Calculate the standardized bounding box, the world coordinates at image corner and image center.

standardizeMaskImage()

Standardizes the mask data as an simple 0 (not masked) and 1 (masked) bitmap.

standardizeMetadata()

Standardizes required and optional metadata from the given data.

standardizePSF()

Returns PSF for each extension marked as processable.

standardizeScienceImage()

Standardizes the science image data.

standardizeVarianceImage()

Standardizes the variance data.

standardizeWCS()

Creates an WCS for every processable science image.

toLayeredImage()

Returns a list of ~kbmod.search.layered_image objects for each entry marked as processable.

translateHeader(*args, **kwargs)

Maps the header keywords to the required and optional metadata.

configClass

configClass#

alias of FitsStandardizerConfig

classmethod resolveTarget(tgt)[source]#

Returns True if the target is a FITS file on a local filesystem, that can be read by AstroPy FITS module, or an ~astropy.io.fits.HDUList.

Parameters:
tgtstr

Path to FITS file.

Returns:
canStandardizebool

True if target is a FITS file readable by AstroPy. False otherwise.

resourcesdict, optional

An empty dictionary when canStandardize is False. A dict containing ~fits.HDUList when canStandardize is True.

Raises:
FileNotFoundError - when target is path to file that doesn’t exist
TypeError - when target is not HDUList or a filepath.