Helipad 1.4 has arrived, with the most important feature being a more consistent API for container classes. A new dict
-like funcStore
class now stores parameters, goods, primitives, shocks, hooks, and events. This provides a simple and standardized interface for adding, removing, and clearing all of the above.
Instead of … now use …
model.addParameter()
…model.params.add()
model.addGood()
…model.goods.add()
model.addHook()
…model.hooks.add()
(though the decorator syntax@model.hook
remains preferred)model.shocks.register()
…model.shocks.add()
(this one was similar to the new format already, but inconsistent with the others)model.addEvent()
…model.events.add()
model.addPrimitive()
…model.primitives.add()
model.removeHook()
…model.hooks.remove()
model.removeEvent()
…model.events.remove()
model.removePrimitive()
…model.primitives.remove()
model.clearEvents()
…model.events.clear()
In addition, standardization makes it possible to remove shocks, parameters, goods, and breeds, where this was not possible before.
Helipad 1.4 also has a number of smaller features and bugfixes:
- Installable from Conda. Helipad can now be installed with Conda instead of Pip, using
conda install -c charwick helipad
- Localization. Helipad can now be translated into and launched with other languages. While currently only an English localization exists, translators can contribute using the string template.
- Parameter groups. Global parameters can be grouped into expandable frames.
- Toggle-all buttons. Checkgrid parameters now have a button in the header for toggling on and off all the options at once.
model.cutStep()
. Allows agents to be skipped during a model step, e.g. when testing if any agent will succeed in a period, there is no need to step through further agents that period once one does.- Agent overdraft control. Helipad now provides options for what to do when
.trade()
or.pay()
has the agent giving up more than he has. Agents can either continue with existing balances (as was the default before), allow negative balances, or abort the trade, and the model can either continue, warn, or raise an error.- Shortage reporters are no longer kept track of in core, as shortages have no clear meaning for some overdraft settings. Models keeping track of shortages can do so by observing discrepancies between the input and output values of
.pay()
.
- Shortage reporters are no longer kept track of in core, as shortages have no clear meaning for some overdraft settings. Models keeping track of shortages can do so by observing discrepancies between the input and output values of
- Windows 11 compatibility.
- New
saveCSV
hook. CSV output can now be modified before saving. - New icon. Helipad now displays its own icon in the dock/taskbar when launching using the Tkinter frontend, rather than the default Python launcher’s icon.
- More reliable tooltips. Parameters registered with the
desc
argument now display tooltips in the Tkinter frontend even if PMW is not installed. Tooltips continue to display as normal in Jupyter notebooks. - Position and resize visualization windows.
MPLVisualization
s (i.e. all the built-in visualizations) now havedim
andpos
properties that can be set before launch. - More useful callback values. Checkgrid parameters now pass a
(name, val)
tuple to their callback function, indicating which checkbox was turned on or off, rather than just the value of that checkbox. - Better post-analysis. Models can now be run from the control panel with no visualizations selected if
stopafter
is set and aterminate
hook is registered. Previously, doing so requiredstopafter
to be set and CSV export to be enabled. - Namespace cleanup.
from helipad import *
no longer also imports Numpy into the namespace. - Cleaner spatial dimension-setting. The
spatial()
function takes a singledim=(x,y)
tuple or int, replacing the threex=x, y=y, square=bool
arguments. - Bug fixes.
- Fixed a bug where parameter sweeps wouldn’t run if a visualizer was registered, even if no plots were selected
- Fixed a bug where the
CpanelPostInit
hook wouldn’t run when launching a model with the debug console running. - Helipad 1.4.1 has updated for compatibility with breaking changes in Ipywidgets 8.0 and is not compatible with Ipywidgets 7 or earlier. If you need compatibility with Ipywidgets 7, you can use
pip install helipad==1.4
to install Helipad 1.4.0. The Tkinter frontend is not affected.
API Changes in Version 1.4
- ⚠️ HelipadThe
goodParams
,moneyGood
, andnonMoneyGoods
properties have been deprecated. Useparams.perGood
,goods.money
, andgoods.nonmonetary
instead.
Deprecated theaddParameter
,addGoodParameter
,addBreedParameter
,addEvent
,removeEvent
,clearEvents
,addHook
,removeHook
,clearHooks
,addPrimitive
,removePrimitive
, andaddGood
methods. These have been replaced by standard container interfacesParams
,Events
,Hooks
,Primitives
, andGoods
.
Added thelocale
argument. - ⚠️ addMoved from
model.addGood()
. - ⚠️ removeMoved from
model.removeHook
. - ⚠️ addMoved from
model.addHook()
. - ⚠️ PrimitiveRemoved the
breedParams
property as all parameters are now stored inmodel.params
. - ⚠️ addPrimitiveMoved from
model.addPrimitive()
. - ⚠️ removePrimitiveMoved from
model.removePrimitive()
. - ⚠️ addMoved from
model.addParameter()
. - ⚠️ addRenamed from
Shocks.register()
. - ⚠️ ShocksNow subclasses
funcStore
, which subclassesdict
. Theshocks
property has been removed, replaced by accessing the object directly with the index, e.g.Shocks[name]
. Thenumber
property has also been removed; uselen(model.shocks)
instead. - ⚠️ clearMoved from
model.clearEvents()
. - ⚠️ addMoved from
model.addEvent()
. - ⚠️ CpanelRemoved the
balloon
property, which had been used for tooltips with PMW in the Tkinter frontend. Tooltips are now handled through theTooltip
class with no dependency.
Removed theparent
property asCpanel
now subclassesTk
. Code that formerly pointed toCpanel.parent
can now simply useCpanel
. - ⚠️ ParamRenamed the
obj
parameter toper
for clarity.obj
is deprecated and will be removed in a future version.
For per-breed and per-good parameters, theelement
property is now the containing Tkinter or Ipywidgets widget. Thedict
of individual widgets is now in the newelements
property. - ⚠️ MultiLevelDeprecated the
dontStepAgents
property. Use thecutStep()
method instead. - ⚠️ spatialReplaced the
x
,y
, andsquare
arguments with a singledim
argument that can take an integer or a tuple. - ⚠️ removeMoved from
model.removeEvent()
. - ⚠️ baseAgentAdded the
overdraft
static property to allow more control over cases where trades cannot be accomplished as written.
Removed thecurrentShortage
property as it had no clear meaning for some values ofoverdraft
. This should be kept track of in individual models by comparing the input and return values ofAgent.buy()
and/orAgent.trade()
. - MPLVisualizationAdded the
dim
andpos
properties. - GoodsIntroduced to replace the bare
dict
previously used to store goods. - expandableFrameChanged the
open
parameter to a settablebool
that can also open and close the frame.
Added thebuttons
property for placing action buttons in the title. - HooksIntroduced to replace the bare
dict
previously used to store hooks. - AgentsIntroduced to replace the bare
dict
previously used to store primitives. - groupIntroduced.
- EventsIntroduced to replace the bare
dict
previously used to store events. - ParamsIntroduced to replace the bare
dict
previously used to store parameters. - darkenIntroduced.
- cutStepIntroduced.
- funcStoreIntroduced.
- saveCSVIntroduced.