astropy:docs

NDData

class astropy.nddata.NDData(data, uncertainty=None, mask=None, wcs=None, meta=None, unit=None)[source] [edit on github]

Bases: astropy.nddata.NDDataBase

A basic class for array-based data.

The key distinction from raw numpy arrays is the presence of additional metadata such as uncertainties, a mask, units, and/or a coordinate system.

Parameters:

data : ndarray, ndarray-like, or NDData

The actual data contained in this NDData object. If possible, data will not be copied`data`, so you should make copy the data before passing it in if that’s the desired behavior.

uncertainty : any type, optional

Uncertainty on the data. The uncertainty must have a string attribute named uncertainty_type, but there is otherwise no restriction.

mask : ndarray-like, optional

Mask for the data. The values must be False where the data is valid and True when it is not (like Numpy masked arrays). If data is a numpy masked array, providing mask here will causes the mask from the masked array to be ignored.

wcs : undefined, optional

WCS-object containing the world coordinate system for the data.

meta : dict-like object, optional

Metadata for this object. Must be dict-like but no further restriction is placed on meta.

unit : UnitBase instance or str, optional

The units of the data. If data is an Quantity then unit is set to the unit of the data; is a unit is also explicitly provided an error is raised.

Notes

The data in a NDData object should be accessed through the data attribute.

For example:

>>> from astropy.nddata import NDData
>>> x = NDData([1,2,3])
>>> x.data
array([1, 2, 3])

Attributes Summary

data
mask
meta
unit
wcs

Attributes Documentation

data
mask
meta
unit
wcs

Page Contents