Module: kbmodv05#

Class for standardizing FITS files produced by deccam as they were specified during the KBMOD V0.5 development.

class kbmod.standardizers.fits_standardizers.kbmodv05.KBMODV0_5(location=None, hdulist=None, config=None, **kwargs)[source]#

Standardizer for the legacy FITS files used in the v0.5 runs.

This standardizer exists for backward compatibility purposes. Its use is not recommended. Use ButlerStandardizer instead.

Parameters:
locationstr or None, optional

Location of the file (if any) that is standardized. Required if hdulist is not provided.

hdulistastropy.io.fits.HDUList or None, optional

HDUList to standardize. Required if location is not provided. If provided, and location is not given, defaults to :memory:.

configStandardizerConfig, dict or None, optional

Configuration key-values used when standardizing the file.

Attributes:
hdulist~astropy.io.fits.HDUList

All HDUs found in the FITS file

primary~astropy.io.fits.PrimaryHDU

The primary HDU.

processablelist

Any additional extensions marked by the standardizer for further processing. Does not include the primary HDU if 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()

Returns at least the following metadata, read from the primary header,

configClass

can_volunteer = False#

This standardizer can be automatically detected and used. If set to False the standardizer can only be used with manual specification.

configClass#

alias of KBMODV0_5Config

name = 'KBMODV0_5'#

Processor’s name. Only named standardizers will be registered.

priority = -1#

Priority. Standardizers with high priority are prefered over standardizers with low priority when processing an upload.

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.
standardizeMaskImage()[source]#

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

For FITS files, this is sometimes a trivial no-op operation returning the correct FITS extension. In other cases, the mask has to be constructed from external data, such as pixel masks and catalogs, or downloaded/read from a different file at the data source.

Returns:
masklist[~np.array]

Mask images.

standardizeVarianceImage()[source]#

Standardizes the variance data.

For FITS files, this is sometimes a trivial no-op operation returning the correct FITS extension. In other cases, this has to be calculated if sufficient information is provided in the header or a different file needs to be downloaded/read.

Note

Refer to the manual for the originating dataset, whether the instrument or processing pipeline reference, as some variance planes store the inverse of variance.

Returns:
variancelist[`np.array]

Variance images.

translateHeader()[source]#
Returns at least the following metadata, read from the primary header,

as a dictionary:

Key

Header Key

Description

mjd

DATE-AVG

Decimal MJD timestamp of the middle of the exposure (UTC)

filter

FILTER

Filter band

visit

EXPID

Exposure ID

class kbmod.standardizers.fits_standardizers.kbmodv05.KBMODV0_5Config(config=None, **kwargs)[source]#

Methods

items()

A set-like object providing a view on config's items.

keys()

A set-like object providing a view on config's keys.

toDict()

Return this config as a dict.

update([conf])

Update this config from dict/other config/iterable.

values()

A set-like object providing a view on config's values.

bit_flag_map = {'BAD': 1, 'CLIPPED': 512, 'CR': 8, 'CROSSTALK': 1024, 'DETECTED': 32, 'DETECTED_NEGATIVE': 64, 'EDGE': 16, 'INEXACT_PSF': 2048, 'INTRP': 4, 'NOT_DEBLENDED': 4096, 'NO_DATA': 256, 'REJECTED': 8192, 'SAT': 2, 'SENSOR_EDGE': 16384, 'SUSPECT': 128, 'UNMASKEDNAN': 32768}#

Mapping between the flag meaning to its value.

brightness_treshold = 10#

Pixels with value greater than this threshold will be masked.

do_bitmask = True#

Mask mask_flags from the mask plane in the FITS file.

do_mask = True#

Perform masking if True, otherwise return an empty mask.

do_threshold = False#

Mask all pixels above the given count threshold.

grow_kernel_shape = (10, 10)#

Size of the symmetric square kernel by which mask footprints will be increased by.

grow_mask = True#

Grow mask footprint by grow_kernel_shape

mask_flags = ['BAD', 'EDGE', 'NO_DATA', 'SUSPECT', 'UNMASKEDNAN']#

List of flags that will be used when masking.