Helipad 1.5 comes with the big improvement of supporting multiple coordinate systems with model.patches
now defining a coordinate system with subclasses of basePatches
. Helipad comes bundled with a rectangular and (now) a polar coordinate system, along with visualizers for each. Spatial models are initialized by default with rectangular geometry, but can be changed to polar by passing geometry='polar'
to model.spatial()
. Pictured right is the standard sheep and grass population model, but on an 8×16 polar rather than a rectangular grid.
In addition, Helipad 1.5 comes with numerous other improvements to spatial models and more.
Spatial improvements
- For rectangular geometries, wrapping can now be toggled on a per-axis basis (allowing cylindrical geometries in addition to toroidal) by passing
wrap=(True, False)
orwrap=(False, True)
tomodel.spatial()
. agent.orientTo()
andagent.distanceFrom()
now take the shorter path if they can cross a wrap boundary.- A new setting allows angles to be expressed and set using either degrees or radians. This can be set globally with the static property
baseAgent.angleUnit
, which can be set to'deg'
or'rad'
. (This does not modify individual agent objects: orientation is stored internally in radians either way, butagent.orientation
will report the angle in the units specified by the setting.) agent.orientation
andagent.rotate
are now available and can be set before a spatial model is initialized. Patches return an orientation ofNone
rather than raising aRuntimeError
(though aRuntimeError
will still be raised when trying to set a patch orientation).- The
diag
argument ofmodel.spatial()
has been renamed tocorners
, as this generalizes better to non-rectangular geometries. Thediag
argument has been deprecated, but aliasescorners
. - Rows of patches can be retrieved with
model.patches[None, rownum]
. Columns and individual patches continue to be accessed as before using one or two arguments respectively. - The
'x'
,'y'
, and'wrap'
parameters are deprecated. These settings are now stored in thedim
andwrap
properties ofmodel.patches
. They are thus no longer settable in the control panel by default, though this behavior can be restored with an additional two lines of code.
Console improvements
- Helipad objects now have more informative
__repr__
methods. For example, calling a patch will now display<Patch at 5,5>
rather than<helipad.agent.Patch object at 0x120c9e490>
. model.timer
will now update the same line when launched from an interactive console, rather than accumulating lines.
Misc improvements
- Helipad now remembers the size and position of the visualization window for new model runs.
- Helipad now uses
pyproject.toml
for packaging rather than the legacysetup.py
. - Fixed a bug where
selected=False
would sometimes be ignored when adding a plot to theCharts
visualizer. - Localization now no longer installs
_
into the global scope.
API Changes in Version 1.5
- ⚠️ spatialRenamed the
diag
argument tocorners
in order to accommodate non-square grids.
AllowedAgent.orientation
to be expressed in either degrees or radians depending on the value ofAgent.angle
.
Thewrap
argument can now take(True, False)
or(False, True)
values to set horizontal and vertical wrapping independently.
Added thegeometry
argument. - baseAgentAdded the
angleUnit
static property. - checkEntryRenamed the
type
argument todatatype
to avoid name conflict. - basePatchesIntroduced.
- PatchesRectIntroduced.
- PatchesPolarIntroduced.