bundles / astropy 7.0.1 / astropy / utils / shapes / NDArrayShapeMethods
class
astropy.utils.shapes:NDArrayShapeMethods
source: /astropy/utils/shapes.py :43
Signature
class NDArrayShapeMethods ( ) Members
Summary
Mixin class to provide shape-changing methods.
Extended Summary
The class proper is assumed to have some underlying data, which are arrays or array-like structures. It must define a shape property, which gives the shape of those data, as well as an _apply method that creates a new instance in which a ndarray method has been applied to those.
Furthermore, for consistency with ndarray, it is recommended to define a setter for the shape property, which, like the ~numpy.ndarray.shape property allows in-place reshaping the internal data (and, unlike the reshape method raises an exception if this is not possible).
This class only provides the shape-changing methods and is meant in particular for ndarray subclasses that need to keep track of other arrays. For other classes, ShapedLikeNDArray is recommended.
Aliases
-
astropy.utils.NDArrayShapeMethods