Reference 〉 Class

PatchesPolar( tuple(int, int) dim )

A coordinate system class defining a two-dimensional polar grid. It assigns inward, outward, clockwise, and counterclockwise properties to patches, and moveInward(), moveOutward(), moveClockwise(), and moveCounterclockwise() methods to non-patch agents, and also defines distance and angle functions on a polar grid.

Patches are addressed by an θ,r index, both ints, where θ is the number of the patch starting at north, and moving clockwise, and r is the number of patches outward from the center. There will thus be θ×r patches. Coordinates are defined similarly, with the angle dimension ranging from 0 to θ (patch coordinate), rather than 0 to 2π (angle coordinate).

This class subclasses PatchesRect since it shares the quality that columns have equal length. It should not be initialized in user code; it is initialized automatically with model.spatial(geometry='polar').

Initialization Parameters

  • dim tuple(int, int), required

    The θ,r dimensions of the grid. θ is the number of patches around; r is the number of patches out.


Click a method name for more detailed documentation.

  • neighbors( patch, corners )

    Defines the spatial network among the patches. This function is called automatically during spatial setup and should not be called by user code.

  • place( patch )

    Organizes Patch objects internally. Takes a patch object when created by model.nUpdater(), places it in the appropriate list, and assigns its position property.

Object Properties

  • dim tuple(int, int)

    The θ,r dimensions of the grid. θ is the number of patches around; r is the number of patches out.

  • boundaries tuple(tuple(int,int), tuple(int,int))

    A tuple of tuples with the maximum and minimum coordinates that agents can take, given the grid dimensions. ((xmin, xmax), (ymin, ymax)).

  • wrap tuple(bool, bool)

    Whether each axis wraps around at the boundary. Fixed to (True, False) in polar geometry, since agents can move continuously around but will not wrap from the edge to the center.

Static Properties

  • geometry str

    The name of the patch geometry, to be set by subclasses.

    Initial value: ''

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.