ShapedLikeNDArray¶
- class astropy.utils.shapes.ShapedLikeNDArray[source]¶
Bases:
NDArrayShapeMethodsMixin class to provide shape-changing methods.
The class proper is assumed to have some underlying data, which are arrays or array-like structures. It must define a
shapeproperty, which gives the shape of those data, as well as an_applymethod that creates a new instance in which andarraymethod has been applied to those.Furthermore, for consistency with
ndarray, it is recommended to define a setter for theshapeproperty, which, like theshapeproperty allows in-place reshaping the internal data (and, unlike thereshapemethod raises an exception if this is not possible).This class also defines default implementations for
ndimandsizeproperties, calculating those from theshape. These can be overridden by subclasses if there are faster ways to obtain those numbers.Attributes Summary
The number of dimensions of the instance and underlying arrays.
The shape of the underlying data.
The size of the object, as calculated from its shape.
Attributes Documentation
- isscalar¶
- ndim¶
The number of dimensions of the instance and underlying arrays.
- shape¶
The shape of the underlying data.
- size¶
The size of the object, as calculated from its shape.