Helipad 1.6 is out now, with a number of new visualization capabilities and model types.
Geospatial Models
Helipad now supports spatial models with arbitrary polygonal patches, using geometry='geo'
when initializing a spatial model. Geospatial models are common in a variety of fields where actual geographic borders matter.
The model.patches
container will be instantiated as the new PatchesGeo
class, which stores patches as a list and allows new patches to be added one by one. Patch shapes can be imported from a GeoJSON or other GIS format using GeoPandas. As with the rectangular and polar geometries, patches are connected by a 'spatial'
network to their bordering neighbors and (optionally) to patches they are connected to only by a corner. Agents can optionally be confined to patches, or wander into non-patch areas, with the offmap
argument.
Geospatial models require Shapely, which can be installed with pip install shapely
.
Scatterplot Visualizer
The visualizer formerly known as NetworkPlot
– which was merged with the spatial visualizer in Helipad 1.3 – has been renamed to AgentsPlot
to reflect its variety of layouts, all of which plot individual agents in one way or another.
In addition to spatial layout and a variety of network layouts, AgentsPlot
now also features a scatterplot layout. A scatterplot can be initialized by passing a scatter=('prop1','prop2')
argument to Charts.addPlot()
, which will plot agent.prop1
and agent.prop2
on a scatterplot with an optional regression line. The usual network and spatial layouts can also be rotated through as usual by pressing L
, if applicable (though network layouts will now be skipped if there is no network specified). Agent holdings of a good can also be plotted by passing 'good:goodname'
as the property name.
New Agents
Container
A number of model-level functions have been moved to model.agents
, which now not only stores agents by primitive as a dict
of lists, but also provides an interface to interact with and control agents. This comes with a number of improvements:
- More logical function organization. A number of top-level methods and properties pertaining to agents – for example
model.order
ormodel.createNetwork()
– have been moved to theAgents
container:model.agents.order
andmodel.agents.createNetwork()
. Old code will continue to work per the deprecation policy, but aliases to the original functions will be removed in Helipad 1.8. - Merged Primitives container. The
Primitive
data object now resides inmodel.agents
and contains the agents of that primitive as a subclass oflist
. The dedicatedmodel.primitives
container is now deprecated, and primitives can be added withmodel.agents.addPrimitive()
. BecauseAgents
subclassesdict
andPrimitive
subclasseslist
, theAgents
container stores agents in the exact same way as adict
oflist
s organized by primitive. - More flexible agent access. A list of agents of a primitive can be gotten as usual by
model.agents['primitive']
, but agents can also be retrieved individually by ID with a numeric index, e.g.model.agents[123]
, replacing themodel.agent()
function. A list of all agents can be retrieved withmodel.agents.all
. Agents can be retrieved by breed with a double index, e.g.model.agents['primitive']['breedname']
.
Other Improvements
- Patches can now die. This removes the patch from the map and optionally prevents agents from moving to the corresponding area with the
offmap
argument. Since they are a fixed primitive, patches can also be revived. - Patches have
center
,area
, andvertices
properties. - Helipad modules and methods now have docstrings with links to full documentation, which will be helpful for users working with IDEs like Pylance or Visual Studio Code.
- New
Edges
container. Network edges can be added and retrieved withagent.edges.add()
,agent.edges['networkname']
,agent.edges.inbound()
,agent.edges.all
, etc.
API Changes in Version 1.6
- ⚠️ addBreedMoved from
Model.addBreed()
. - ⚠️ MPLVisualizationRenamed the
keys
property tokeyListeners
and theupdate()
method torefresh
to avoid collisions withdict
methods.sendEvent()
is no longer a bound method due to a Matplotlib bug.
Deprecated theplots
property. Plots can now be retrieved directly from the visualization object, likemodel.visual['plotName']
. - ⚠️ refreshRenamed from
update()
to avoid a collision withdict
methods. - ⚠️ paramSimplified the parameter identification tuple from
(paramName, itemType, itemName, Primitive)
to(paramName, itemName)
. - ⚠️ baseAgentMoved
Agent.alledges
toAgent.edges.all
. - ⚠️ addSimplified the parameter identification tuple from
(paramName, itemType, itemName, Primitive)
to(paramName, itemName)
. - ⚠️ paramSweepSimplified the parameter identification tuple from
(paramName, itemType, itemName, Primitive)
to(paramName, itemName)
. - ⚠️ createNetworkMoved from
Model.createNetwork()
. - ⚠️ networkMoved from
Model.network()
. - ⚠️ AgentsMerged the
Primitives
container object into theAgents
dict and took on a number of agent-relevant properties and methods from the main model object.
Allow retrieval of individual agents with anint
dict key. - ⚠️ addPrimitiveMoved from
Primitives.add()
with the merging of thePrimitives
andAgents
objects. - ⚠️ removePrimitiveMoved from
Primitives.remove()
with the merging of thePrimitives
andAgents
objects. - ⚠️ HelipadMerged
model.primitives
intomodel.agents
.
Deprecatedmodel.allagents
in favor ofmodel.agents.all
.
Movedmodel.addBreed()
toAgents.addBreed()
.
Movedmodel.order
toAgents.order
.
Moved network methods and propertiesmodel.network()
,model.createNetwork()
, andmodel.allEdges
to theAgents
object.
Deprecatedmodel.agent(id)
in favor ofmodel.agents[id]
andmodel.agent(breed, prim)
in favor ofmodel.agents[prim][breed]
. - ⚠️ AgentsPlotRenamed from
NetworkPlot
toAgentsPlot
in order to encompass the variety of layouts now supported.
Now supports scatterplot layouts and geospatial models.
Renamed thekind
argument and property tonetwork
. - showIntroduced.
- hideIntroduced.
- showIntroduced.
- renderParamIntroduced.
- hideIntroduced.
- configAdded the
mapBg
and regression parameters. - rotateLayoutSkips the NetworkX layouts if no network exists.
- PatchesGeoIntroduced.
- neighborsChanged from a per-patch function to establishing patch edges all at once.
- EdgesIntroduced.
- MultiDictIntroduced.
- PrimitiveNow stores
Agent
objects as a list.
Agents can be retrieved by breed usingPrimitive[breed]
. - initializeMoved from
Model.nUpdater()
. - basePatchesChanged to an abstract base class.
Added theoffmap
property. - atIntroduced.
- PatchIntroduced the
center
,area
, andvertices
properties.
Patches can die now. - spatialAdded the
offmap
argument.