News 〉Releases

Helipad 1.5 Supports Polar Spatial Models

Helipad 1.5 comes with the big improvement of supporting multiple coordinate systems with model.patches now defining a coordinate system with subclasses of Patches2D. 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) or wrap=(False, True) to model.spatial().
  • agent.orientTo() and agent.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.angle, which can be set to 'deg' or 'rad'. (This does not modify individual agent objects: orientation is stored internally in radians either way, but agent.orientation will report the angle in the units specified by the setting.)
  • agent.orientation and agent.rotate are now available and can be set before a spatial model is initialized. Patches return an orientation of None rather than raising a RuntimeError (though a RuntimeError will still be raised when trying to set a patch orientation).
  • The diag argument of model.spatial() has been renamed to corners, as this generalizes better to non-rectangular geometries. The diag argument has been deprecated, but aliases corners.
  • 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 the dim and wrap parameters of model.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.
  • Fixed a bug where selected=False would sometimes be ignored when adding a plot to the Charts visualizer.
  • Localization now no longer installs _ into the global scope.

API Changes in Version 1.5

  • ⚠️ spatialRenamed the diag argument to corners in order to accommodate non-square grids.
    Allowed Agent.orientation to be expressed in either degrees or radians depending on the value of Agent.angle.
    The wrap argument can now take (True, False) or (False, True) values to set horizontal and vertical wrapping independently.
    Added the shape argument.
  • baseAgentAdded the angle static property.
  • patchDataReturns a Numpy array rather than a Pandas dataframe.
  • checkEntryRenamed the type argument to datatype to avoid name conflict.
  • Patches2DIntroduced.
  • PatchesRectIntroduced.
  • PatchesPolarIntroduced.