idmtools_platform_comps.utils.sweeping module#

idmtools utility.

Copyright 2025, Gates Foundation. All rights reserved.

idmtools_platform_comps.utils.sweeping.set_param(simulation: Simulation, param: str, value: Any) Dict[str, Any][source]#

Set a specific parameter value on the simulation task config.

Parameters:
  • simulation (Simulation) – idmtools Simulation object.

  • param (str) – Name of the parameter to modify.

  • value (Any) – New value to set.

Returns:

A dictionary containing the parameter name and value.

Return type:

Dict[str, Any]

idmtools_platform_comps.utils.sweeping.sweep_functions(simulation: Simulation, func_list: List) Dict[str, Any][source]#

Apply a list of sweep functions to a simulation.

Parameters:
  • simulation (Simulation) – The simulation to update.

  • func_list (List[Callable]) – List of functions that apply sweeps to the simulation.

Returns:

A dictionary of aggregated metadata from each sweep function.

Return type:

Dict[str, Any]

class idmtools_platform_comps.utils.sweeping.ItvFn(func, *args, **kwargs)[source]#

Bases: object

Sweeping utility for modifying interventions (campaign layer) during sweeps.

Requirements:
  • func must accept an emod-api campaign object as its first argument.

  • func must return a dictionary of metadata (i.e: tags).

Returns:

Metadata returned by the intervention function, with numpy types cast to Python types.

Return type:

Dict[str, Any]

__init__(func, *args, **kwargs)[source]#
class idmtools_platform_comps.utils.sweeping.CfgFn(func, *args, **kwargs)[source]#

Bases: object

Sweeping utility for modifying simulation configuration parameters.

Requirements:
  • func must accept simulation.task.config as the first parameter.

  • func must return a dictionary for tagging.

Returns:

Metadata dictionary with Python-native types.

Return type:

Dict[str, Any]

__init__(func, *args, **kwargs)[source]#
class idmtools_platform_comps.utils.sweeping.SwpFn(func, *args, **kwargs)[source]#

Bases: object

Sweeping utility for modifying task-level elements (e.g., reports, demographics, climate).

Requirements:
  • func must accept simulation.task as the first parameter.

  • func must return a metadata dictionary (tags).

Returns:

Metadata with numpy types cast to Python-native types.

Return type:

Dict[str, Any]

__init__(func, *args, **kwargs)[source]#