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.Pair2D
Positional information with a constant time step.
-
gridcells.core.common.
twisted_torus_distance
(a, others, dim)[source]¶ Calculate a distance between
a
andothers
on a twisted torus.Take
a
which 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 :
Pair2D
Specifies the initial position.
a.x
anda.y
must be convertible to floatsothers :
Pair2D
Positions for which to compute the distance.
dim :
Pair2D
Dimensions of the torus.
dim.x
anddim.y
must be convertible to floats.Returns: An array of positions, always of the length of others