Reference/API#

astropy.nddata Package#

The astropy.nddata subpackage provides the NDData class and related tools to manage n-dimensional array-based data (e.g. CCD images, IFU Data, grid-based simulation data, …). This is more than just numpy.ndarray objects, because it provides metadata that cannot be easily provided by a single array.

Functions#

add_array(array_large, array_small, position)

Add a smaller array at a given position in a larger array.

bitfield_to_boolean_mask(bitfield[, ...])

Converts an array of bit fields to a boolean (or integer) mask array according to a bit mask constructed from the supplied bit flags (see ignore_flags parameter).

block_reduce(data, block_size[, func])

Downsample a data array by applying a function to local blocks.

block_replicate(data, block_size[, conserve_sum])

Upsample a data array by block replication.

extend_bit_flag_map(cls_name[, base_cls])

A convenience function for creating bit flags maps by subclassing an existing map and adding additional flags supplied as keyword arguments.

extract_array(array_large, shape, position)

Extract a smaller array of the given shape and position from a larger array.

fits_ccddata_reader(filename[, hdu, unit, ...])

Generate a CCDData object from a FITS file.

fits_ccddata_writer(ccd_data, filename[, ...])

Write CCDData object to FITS file.

interpret_bit_flags(bit_flags[, flip_bits, ...])

Converts input bit flags to a single integer value (bit mask) or None.

overlap_slices(large_array_shape, ...[, mode])

Get slices for the overlapping part of a small and a large array.

reshape_as_blocks(data, block_size)

Reshape a data array into blocks.

subpixel_indices(position, subsampling)

Convert decimal points to indices, given a subsampling factor.

support_nddata([_func, accepts, repack, ...])

Decorator to wrap functions that could accept an NDData instance with its properties passed as function arguments.

Classes#

BitFlagNameMap()

A base class for bit flag name maps used to describe data quality (DQ) flags of images by provinding a mapping from a mnemonic flag name to a flag value.

CCDData(*args, **kwd)

A class describing basic CCD data.

Conf()

Configuration parameters for astropy.nddata.

Cutout2D(data, position, size[, wcs, mode, ...])

Create a cutout object from a 2D array.

FlagCollection(*args, **kwargs)

The purpose of this class is to provide a dictionary for containing arrays of flags for the NDData class.

IncompatibleUncertaintiesException

This exception should be used to indicate cases in which uncertainties with two different classes can not be propagated.

InvalidBitFlag

Indicates that a value is not an integer that is a power of 2.

InverseVariance([array, copy, unit])

Inverse variance uncertainty assuming first order Gaussian error propagation.

MissingDataAssociationException

This exception should be used to indicate that an uncertainty instance has not been associated with a parent NDData object.

NDArithmeticMixin()

Mixin class to add arithmetic to an NDData object.

NDData(data[, uncertainty, mask, wcs, meta, ...])

A container for numpy.ndarray-based datasets, using the NDDataBase interface.

NDDataArray(data, *args[, flags])

An NDData object with arithmetic.

NDDataBase()

Base metaclass that defines the interface for N-dimensional datasets with associated meta information used in astropy.

NDDataRef(data[, uncertainty, mask, wcs, ...])

Implements NDData with all Mixins.

NDIOMixin()

Mixin class to connect NDData to the astropy input/output registry.

NDSlicingMixin()

Mixin to provide slicing on objects using the NDData interface.

NDUncertainty([array, copy, unit])

This is the metaclass for uncertainty classes used with NDData.

NoOverlapError

Raised when determining the overlap of non-overlapping arrays.

PartialOverlapError

Raised when arrays only partially overlap.

StdDevUncertainty([array, copy, unit])

Standard deviation uncertainty assuming first order gaussian error propagation.

UnknownUncertainty([array, copy, unit])

This class implements any unknown uncertainty type.

VarianceUncertainty([array, copy, unit])

Variance uncertainty assuming first order Gaussian error propagation.

astropy.nddata.bitmask Module#

A module that provides functions for manipulating bit masks and data quality (DQ) arrays.

Functions#

bitfield_to_boolean_mask(bitfield[, ...])

Converts an array of bit fields to a boolean (or integer) mask array according to a bit mask constructed from the supplied bit flags (see ignore_flags parameter).

interpret_bit_flags(bit_flags[, flip_bits, ...])

Converts input bit flags to a single integer value (bit mask) or None.

extend_bit_flag_map(cls_name[, base_cls])

A convenience function for creating bit flags maps by subclassing an existing map and adding additional flags supplied as keyword arguments.

Classes#

BitFlagNameMap()

A base class for bit flag name maps used to describe data quality (DQ) flags of images by provinding a mapping from a mnemonic flag name to a flag value.

InvalidBitFlag

Indicates that a value is not an integer that is a power of 2.

astropy.nddata.utils Module#

This module includes helper functions for array operations.

Functions#

extract_array(array_large, shape, position)

Extract a smaller array of the given shape and position from a larger array.

add_array(array_large, array_small, position)

Add a smaller array at a given position in a larger array.

subpixel_indices(position, subsampling)

Convert decimal points to indices, given a subsampling factor.

overlap_slices(large_array_shape, ...[, mode])

Get slices for the overlapping part of a small and a large array.

Classes#

NoOverlapError

Raised when determining the overlap of non-overlapping arrays.

PartialOverlapError

Raised when arrays only partially overlap.

Cutout2D(data, position, size[, wcs, mode, ...])

Create a cutout object from a 2D array.