
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.orientationwill report the angle in the units specified by the setting.) agent.orientationandagent.rotateare now available and can be set before a spatial model is initialized. Patches return an orientation ofNonerather than raising aRuntimeError(though aRuntimeErrorwill still be raised when trying to set a patch orientation).- The
diagargument ofmodel.spatial()has been renamed tocorners, as this generalizes better to non-rectangular geometries. Thediagargument 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 thedimandwrapproperties 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.timerwill 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.tomlfor packaging rather than the legacysetup.py. - Fixed a bug where
selected=Falsewould sometimes be ignored when adding a plot to theChartsvisualizer. - Localization now no longer installs
_into the global scope.
API Changes in Version 1.5
- ⚠️ spatialRenamed the
diagargument tocornersin order to accommodate non-square grids.
AllowedAgent.orientationto be expressed in either degrees or radians depending on the value ofAgent.angle.
Thewrapargument can now take(True, False)or(False, True)values to set horizontal and vertical wrapping independently.
Added thegeometryargument. - baseAgentAdded the
angleUnitstatic property. - checkEntryRenamed the
typeargument todatatypeto avoid name conflict. - basePatchesIntroduced.
- PatchesRectIntroduced.
- PatchesPolarIntroduced.