gridcells.core.common - common/shared definitions¶
The common module is a collection of basic classes used
throughout the package:
Pair2D(x, y) |
A pair of x and y attributes. |
Position2D(x, y, dt) |
Positional information with a constant time step. |
twisted_torus_distance(a, others, dim) |
Calculate a distance between a and others on a twisted torus. |
-
class
gridcells.core.common.Position2D(x, y, dt)[source]¶ Bases:
gridcells.core.common.Pair2DPositional information with a constant time step.
-
gridcells.core.common.twisted_torus_distance(a, others, dim)[source]¶ Calculate a distance between
aandotherson a twisted torus.Take
awhich is a 2D position and others, which is a vector of 2D positions and compute the distances between them based on the topology of the twisted torus.If you just want to remap a function of (X, Y), set a==[[0, 0]].
Parameters: a :
Pair2DSpecifies the initial position.
a.xanda.ymust be convertible to floatsothers :
Pair2DPositions for which to compute the distance.
dim :
Pair2DDimensions of the torus.
dim.xanddim.ymust be convertible to floats.Returns: An array of positions, always of the length of others