NDDataArray¶
- class astropy.nddata.NDDataArray(data, *args, flags=None, **kwargs)[source]¶
Bases:
NDArithmeticMixin,NDSlicingMixin,NDIOMixin,NDDataAn
NDDataobject with arithmetic. This class is functionally equivalent toNDDatain 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: https://docs.astropy.org/en/stable/nddata/
- Parameters:
- data
ndarrayorNDData The actual data contained in this
NDDataobject. Not that this will always be copies by reference , so you should make copy thedatabefore passing it in if that’s the desired behavior.- uncertainty
NDUncertainty, optional Uncertainties on the data.
- maskarray_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
Falsewhere the data is valid andTruewhen it is not (like Numpy masked arrays). Ifdatais a numpy masked array, providingmaskhere will causes the mask from the masked array to be ignored.- flagsarray_like or
FlagCollection, 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
FlagCollectioninstance which has a shape matching that of the data.- wcs
None, optional WCS-object 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
dictastropy:-likeobject, 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
UnitBaseinstance orstr, optional The units of the data.
- data
- Raises:
ValueErrorIf the
uncertaintyormaskinputs cannot be broadcast (e.g., match shape) ontodata.
Attributes Summary
numpy.dtypeof 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(unit[, equivalencies])Returns a new
NDDataobject whose values have been converted to a new unit.Attributes Documentation
- dtype¶
numpy.dtypeof this object’s data.
- flags¶
- mask¶
- 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¶
- unit¶
Methods Documentation
- convert_unit_to(unit, equivalencies=[])[source]¶
Returns a new
NDDataobject whose values have been converted to a new unit.- Parameters:
- unit
astropy.units.UnitBaseinstance orstr The unit to convert to.
- equivalencies
listoftuple 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:
UnitsErrorIf units are inconsistent.