Reference 〉Function

Helipad.paramSweep( str|tuple|list param, list reporters = None )

Repeatedly runs the model while systematically varying one or more parameter values. This function can generate a great deal of data, and is intended to be used without the control panel. ParamSweep, therefore, should be used instead of launching the control panel.

The possible values to be swept are specified when the parameter is initialized, either with model.addParam(), model.addBreedParam(), or model.addGoodParam(). The values will differ according to their type, even though they will not be displayed in the GUI. A checkbox parameter will run with the parameter set to True and False; a menu parameter will run with all the options specified in the opts parameter, and a slider parameter will run in increments of the step value between the minimum and the maximum. See Param.range.

The function allows multiple parameters to be swept in an n-dimensional space. This can entail very large numbers of runs. For example, specifying a checkbox and two slider parameters with 50 possible values each will run the model for every combination of the three parameters, or 5,000 times (2×50×50).

Each run will go until the model time equals the value of model.param('stopafter'), which can either be an integer (in which case each run will be that many periods), or the name of an event in order to stop the model at an open-ended stop condition.


  • param str|tuple|list, required

    A parameter or list of parameters to sweep. A string value indicates a global parameter. Per-good parameters can be indicated with a three-item tuple, ('paramName', 'good', 'goodName'). A per-breed parameter can be indicated with a three- or four-item tuple, ('paramName', 'breed', 'breedName', 'primitive'), with the last element optional if there is only one primitive. The argument can also take a list of these strings and/or tuples to sweep across multiple parameter dimensions.

  • reporters list, optional

    A list of reporter names to be included in the data output. If not specified, all data columns will be included.

    Default value: None

Return Value list[Item]

A list of the results of each run. Each Item object has three properties:

  • vars: A dict with the parameter values under which that run was conducted.
  • data: A Pandas dataframe with the data from that run, with rows totaling either len(reporters) or the number of total reporters, and columns totaling t.
  • events: A list of truncated Event objects containing the name, triggered, and data properties. The latter corresponds to a row of the whole dataframe at the time represented by triggered.

Fatal error: Uncaught TypeError: Unsupported operand types: string - string in /home/dh_nzhxm7/ Stack trace: #0 [internal function]: {closure}(Object(WP_Comment), Object(WP_Comment)) #1 /home/dh_nzhxm7/ usort(Array, Object(Closure)) #2 /home/dh_nzhxm7/ {closure}(Array) #3 /home/dh_nzhxm7/ WP_Hook->apply_filters(Array, Array) #4 /home/dh_nzhxm7/ apply_filters('comments_array', Array, 472) #5 /home/dh_nzhxm7/ comments_template() #6 /home/dh_nzhxm7/ include('/home/dh_nzhxm7...') #7 /home/dh_nzhxm7/ require_once('/home/dh_nzhxm7...') #8 /home/dh_nzhxm7/ require('/home/dh_nzhxm7...') #9 {main} thrown in /home/dh_nzhxm7/ on line 200