Open hanjinliu opened 2 years ago
Space
should also implement array constructors.
space = Space(["z", "y", "x"])
arr = space.zeros((10, 20, 30), dtype=np.float32) # 3D array with zyx-axes
Specifying the type of axis may be useful.
space = Space(angle="periodic", channel="category", y="linear", x="linear")
arr = space.zeros((10, 3, 20, 30))
arr = space.zeros((10, 3, 20, 30), channel=["R", "G", "B"]) # ??
Terminologies
Axis
is a named object with anIndex
. Implements "slice", "size" becauseIndex
implements these.Index
defines how to measure an axis (scale, offset, labels etc.). Implements "slice" and "size".Space
is a collection of multiple names. It is unsized. When a shape (and additional arguments such as scale and offset) is passed, it builds aCoordinates
. Implements "ndim", "get_coords" and "get_axis". ASpace
may have aMetric
that defines relationship between axes.Coordinates
is a collection of multipleAxis
objects. This is actually used in arrays.Expected API
arr = cr.array([...], coords=coords)
,coords
should be an object equivalent toSpace
, rather than aCoordinates
.arr.coords
should return aCoordinates
because it is already sized.arr.coords = ...
can also be aSpace
.