sierra.core.variables.batch_criteria#
Base classes used to define Batch Experiments.
Classes#
Defines experiments via lists of sets of changes to make to an expdef. |
|
Mixin interface for criteria which can be queried during stage {1,2}. |
|
Base class for a univariate batch criteria. |
|
N-dimensional multiple |
Module Contents#
- class sierra.core.variables.batch_criteria.BaseBatchCriteria(cli_arg: str, main_config: sierra.core.types.YAMLDict, batch_input_root: pathlib.Path)[source]#

Defines experiments via lists of sets of changes to make to an expdef.
- cli_arg#
Unparsed batch criteria string from command line.
- main_config#
Parsed dictionary of main YAML configuration.
- batch_input_root#
Absolute path to the directory where batch experiment directories should be created.
- arena_dims(cmdopts: sierra.core.types.Cmdopts) list[sierra.core.utils.ArenaExtent][source]#
Get the arena dimensions used for each experiment in the batch.
Not applicable to all criteria.
Must be implemented on a per-engine basis, as different engines have different means of computing the size of the arena.
- gen_attr_changelist() list[sierra.core.experiment.definition.AttrChangeSet][source]#
Generate expdef attributes to change in a batch experiment definition.
Modifications are sets, one per experiment in the batch, because the order you apply them doesn't matter.
- gen_element_addlist() list[sierra.core.experiment.definition.ElementAddList][source]#
Generate expdef elelemnts to add to the batch experiment definition.
Modifications are lists, one per experiment in the batch, because the order you apply them matters.
- gen_files() None[source]#
Generate files to add to the batch experiment definition.
Presumably, the created files will be referenced in the
--expdef-templatefile by path.
- gen_tag_rmlist() list[sierra.core.experiment.definition.ElementRmList][source]#
Generate expdef tags to remove from the batch experiment definition.
Modifications are lists, one per experiment in the batch, because the order you apply them matters.
- scaffold_exps(batch_def: sierra.core.experiment.definition.BaseExpDef, cmdopts: sierra.core.types.Cmdopts) None[source]#
Scaffold a batch experiment.
Takes the raw template input file and apply expdef modifications from the batch criteria for all experiments, and save the result in each experiment's input directory.
- class sierra.core.variables.batch_criteria.IQueryableBatchCriteria[source]#
Mixin interface for criteria which can be queried during stage {1,2}.
Used to extract additional information needed for configuring some Engines and execution environments.
- abstract n_agents(exp_num: int) int[source]#
Return the # of agents used for a given Experiment.
- class sierra.core.variables.batch_criteria.UnivarBatchCriteria(cli_arg: str, main_config: sierra.core.types.YAMLDict, batch_input_root: pathlib.Path)[source]#

Base class for a univariate batch criteria.
- arena_dims(cmdopts: sierra.core.types.Cmdopts) list[sierra.core.utils.ArenaExtent]#
Get the arena dimensions used for each experiment in the batch.
Not applicable to all criteria.
Must be implemented on a per-engine basis, as different engines have different means of computing the size of the arena.
- gen_attr_changelist() list[sierra.core.experiment.definition.AttrChangeSet]#
Generate expdef attributes to change in a batch experiment definition.
Modifications are sets, one per experiment in the batch, because the order you apply them doesn't matter.
- gen_element_addlist() list[sierra.core.experiment.definition.ElementAddList]#
Generate expdef elelemnts to add to the batch experiment definition.
Modifications are lists, one per experiment in the batch, because the order you apply them matters.
- gen_files() None#
Generate files to add to the batch experiment definition.
Presumably, the created files will be referenced in the
--expdef-templatefile by path.
- gen_tag_rmlist() list[sierra.core.experiment.definition.ElementRmList]#
Generate expdef tags to remove from the batch experiment definition.
Modifications are lists, one per experiment in the batch, because the order you apply them matters.
- populations(cmdopts: sierra.core.types.Cmdopts, exp_names: list[str] | None = None) list[int][source]#
Calculate system sizes used the batch experiment, sorted.
- Parameters:
cmdopts -- Dictionary of parsed command line options.
exp_names -- If is not None, then these directories will be used to calculate the system sizes, rather than the results of
gen_exp_names().
- scaffold_exps(batch_def: sierra.core.experiment.definition.BaseExpDef, cmdopts: sierra.core.types.Cmdopts) None#
Scaffold a batch experiment.
Takes the raw template input file and apply expdef modifications from the batch criteria for all experiments, and save the result in each experiment's input directory.
- class sierra.core.variables.batch_criteria.XVarBatchCriteria(criterias: list[BaseBatchCriteria])[source]#

N-dimensional multiple
sierra.core.variables.batch_criteria.UnivarBatchCriteria.Changed in version 1.2.20: Batch criteria can be compound: one criteria can create and the other modify expdef elements to create an experiment definition.
- arena_dims(cmdopts: sierra.core.types.Cmdopts) list[sierra.core.utils.ArenaExtent]#
Get the arena dimensions used for each experiment in the batch.
Not applicable to all criteria.
Must be implemented on a per-engine basis, as different engines have different means of computing the size of the arena.
- exp_scenario_name(exp_num: int) str[source]#
Given the experiment number, compute a parsable scenario name.
It is necessary to query this function after generating the changelist in order to create generator classes for each experiment in the batch with the correct name and definition in some cases.
Can only be called if constant density is one of the sub-criteria.
- gen_attr_changelist() list[sierra.core.experiment.definition.AttrChangeSet][source]#
Generate expdef attributes to change in a batch experiment definition.
Modifications are sets, one per experiment in the batch, because the order you apply them doesn't matter.
- gen_element_addlist() list[sierra.core.experiment.definition.ElementAddList][source]#
Generate expdef elelemnts to add to the batch experiment definition.
Modifications are lists, one per experiment in the batch, because the order you apply them matters.
- gen_exp_names() list[str][source]#
Generate a SORTED list of strings for all experiment names.
These will be used as directory LEAF names, and don't include the parents. Basically, this is a flattened list of permutations of all
gen_exp_names()for each batch criteria.
- gen_files() None#
Generate files to add to the batch experiment definition.
Presumably, the created files will be referenced in the
--expdef-templatefile by path.
- gen_tag_rmlist() list[sierra.core.experiment.definition.ElementRmList][source]#
Generate expdef tags to remove from the batch experiment definition.
Modifications are lists, one per experiment in the batch, because the order you apply them matters.
- graph_info(cmdopts: sierra.core.types.Cmdopts, batch_output_root: pathlib.Path | None = None, exp_names: list[str] | None = None) sierra.core.graphs.bcbridge.GraphInfo[source]#
Generate graph info for generating graphs from Batch Criteria.
- Parameters:
exp_names -- Needed as an optional for bivariate batch criteria. When calculating say yticks using criteria2, if criteria2 uses
populations()in the process, the criteria's OWNgen_exp_names()will be used, which will result in bad directory name calculations. This can be overcome by passing the list of exp names to use at THIS level, which should override the value otherwise present inGraphInfo.
- n_agents(exp_num: int) int[source]#
Return the # of agents used for a given Experiment.
- populations(cmdopts: sierra.core.types.Cmdopts) list[source]#
Generate a N-D array of system sizes used the batch experiment.
Sizes are in the same order as the directories returned from
gen_exp_names()for each criteria along each axis.
- scaffold_exps(batch_def: sierra.core.experiment.definition.BaseExpDef, cmdopts: sierra.core.types.Cmdopts) None#
Scaffold a batch experiment.
Takes the raw template input file and apply expdef modifications from the batch criteria for all experiments, and save the result in each experiment's input directory.