Reference 〉 Class
funcStore

Params(modelHelipad)

The dict-like container class for adding, storing, and removing parameters. This class can be interacted with as a dict via model.params but should not be instantiated by user code.

Getting and setting parameter values in code should be done by model.param(), but the whole param objects can be accessed here.

Initialization Parameters

  • model Helipad, required

    The model object.

Methods

Click a method name for more detailed documentation.

  • add( name, title, type, … )

    Registers a global parameter to be displayed in the control panel. Depending on the required data, possible parameter types include menus, sliders, checkboxes, checkentries, or checkgrids. The current value of the parameter can be retrieved with model.param().

    This function also replaces the previous model.addGoodParam() and model.addBreedParam() methods. Use the per argument instead to register per-good and per-breed parameters.

  • clear( )

    Clears all user-added parameters and removes them from the control panel if drawn. Built-in config parameters will not be cleared.

  • group( name, params, opened )

    For models with a large number of global parameters, this method allows them to be grouped into a collapsible section in the control panel and optionally hidden by default.

    This method is purely for display convenience, and does not otherwise affect the behavior of the grouped parameters.

  • hide( name )

    Hides a parameter after the control panel is drawn. Useful for callback functions, i.e. toggling the visibility of a parameter based on the value of another parameter. Hidden parameters can be re-shown with Params.show().

  • remove( name, fname, removeall )

    Removes data stored at a certain key.

  • show( name )

    Shows a previously hidden parameter after the control panel is drawn. Useful for callback functions, i.e. toggling the visibility of a parameter based on the value of another parameter.

Object Properties

  • model Helipad

    The model object.

  • groups list[ParamGroup]

    Global parameters put into a group.

    Initial value: []

  • globals dict{str: Param}

    The subset of global parameters, i.e. those with per=None.

    Initial value: {}

  • perBreed dict{str: Param}

    The subset of per-breed parameters, i.e. those with per='breed'.

    Initial value: {}

  • perGood dict{str: Param}

    The subset of per-good parameters, i.e. those with per='good'.

    Initial value: {}

Static Properties

  • multi bool

    Whether the dict values should store a function, or a list of functions. This is a static property and should be changed only by subclassing funcStore.

    Initial value: False

Notes and Examples

  1. charwick

    Jul 02, 2022 at 4:36

    Properties of already-registered parameters can be accessed through this object. For example, to hide the default population slider:

    heli.params['num_agent'].type='hidden'
  2. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.

History