astropy 5.0

BackRef

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 :None:None:`~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 also defines default implementations for ndim and size properties, calculating those from the shape . These can be overridden by subclasses if there are faster ways to obtain those numbers.

Mixin class to provide shape-changing methods.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

astropy.utils.shapes.NDArrayShapeMethods

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /astropy/utils/shapes.py#137
type: <class 'abc.ABCMeta'>
Commit: