NDDataArray¶

class
astropy.nddata.
NDDataArray
(data, *args, flags=None, **kwargs)[source]¶ Bases:
astropy.nddata.NDArithmeticMixin
,astropy.nddata.NDSlicingMixin
,astropy.nddata.NDIOMixin
,astropy.nddata.NDData
An
NDData
object with arithmetic. This class is functionally equivalent toNDData
in astropy versions prior to 1.0.The key distinction from raw numpy arrays is the presence of additional metadata such as uncertainties, a mask, units, flags, and/or a coordinate system.
See also: http://docs.astropy.org/en/stable/nddata/
 Parameters
 data
ndarray
orNDData
The actual data contained in this
NDData
object. Not that this will always be copies by reference , so you should make copy thedata
before passing it in if that’s the desired behavior. uncertainty
NDUncertainty
, optional Uncertainties on the data.
 mask
ndarray
like, optional Mask for the data, given as a boolean Numpy array or any object that can be converted to a boolean Numpy array with a shape matching that of the data. The values must be
False
where the data is valid andTrue
when it is not (like Numpy masked arrays). Ifdata
is a numpy masked array, providingmask
here will causes the mask from the masked array to be ignored. flags
ndarray
like orFlagCollection
, optional Flags giving information about each pixel. These can be specified either as a Numpy array of any type (or an object which can be converted to a Numpy array) with a shape matching that of the data, or as a
FlagCollection
instance which has a shape matching that of the data. wcsundefined, optional
WCSobject containing the world coordinate system for the data.
Warning
This is not yet defined because the discussion of how best to represent this class’s WCS system generically is still under consideration. For now just leave it as None
 meta
dict
like object, optional Metadata for this object. “Metadata” here means all information that is included with this object but not part of any other attribute of this particular object. e.g., creation date, unique identifier, simulation parameters, exposure time, telescope name, etc.
 unit
UnitBase
instance or str, optional The units of the data.
 data
 Raises
 ValueError :
If the
uncertainty
ormask
inputs cannot be broadcast (e.g., match shape) ontodata
.
Attributes Summary
numpy.dtype
of this object’s data.any type : Mask for the dataset, if any.
integer dimensions of this object’s data
shape tuple of this object’s data.
integer size of this object’s data.
any type : Uncertainty in the dataset, if any.
Unit
: Unit for the dataset, if any.Methods Summary
convert_unit_to
(self, unit[, equivalencies])Returns a new
NDData
object whose values have been converted to a new unit.Attributes Documentation

dtype
¶ numpy.dtype
of this object’s data.

flags
¶

mask
¶ any type : Mask for the dataset, if any.
Masks should follow the
numpy
convention that valid data points are marked byFalse
and invalid ones withTrue
.

ndim
¶ integer dimensions of this object’s data

shape
¶ shape tuple of this object’s data.

size
¶ integer size of this object’s data.

uncertainty
¶ any type : Uncertainty in the dataset, if any.
Should have an attribute
uncertainty_type
that defines what kind of uncertainty is stored, such as'std'
for standard deviation or'var'
for variance. A metaclass defining such an interface isNDUncertainty
but isn’t mandatory.
Methods Documentation

convert_unit_to
(self, unit, equivalencies=[])[source]¶ Returns a new
NDData
object whose values have been converted to a new unit. Parameters
 unit
astropy.units.UnitBase
instance or str The unit to convert to.
 equivalencieslist of equivalence pairs, optional
A list of equivalence pairs to try if the units are not directly convertible. See Equivalencies.
 unit
 Returns
 result
NDData
The resulting dataset
 result
 Raises
 UnitsError
If units are inconsistent.