atomica.scenarios.Scenario¶
- class atomica.scenarios.Scenario(name, active=True, parsetname=None, progsetname=None)[source]¶
Bases:
NamedItemBase scenario class
All Scenario objects share this type. It is a NamedItem that also has an
activeproperty which represents whether the scenario should be run as part ofproject.Project.run_scenarios()The optional variables
parsetnameandprogsetnamereference the name of parsets and progsets to use viaScenario.run(). These should match the names of objects in the project passed intoScenario.run(). However,Scenario.run()can also take in a parset and/or progset directly, allowing the scenario to be used with other parsets and progsets on the fly. Ifparsetnameandprogsetnameare not set in theScenariothen they must be passed intoScenario.run().- Parameters:
name (
str) – The name of the scenario - also sets the result name viaScenario.run()parsetname (
str) – If running viaProject.run_scenariosthis identifies which parset to use from the projectprogsetname (
str) – If running viaProject.run_scenariosthis identifies which progset to use. If set toNonethen programs will not be usedactive (
bool) – If running viaProject.run_scenariosthis flags whether to run the scenario
NamedItem constructor
A name must be a string
- Parameters:
name (
str)
Attributes
Specify parset name when run via
Project.run_scenariosSpecify progset name when run via
Project.run_scenariosFlag whether the scenario should be run via
Project.run_scenariosMethods
copyGet scenario instructions
Get scenario parset
Get scenario progset
Run scenario
- active¶
Flag whether the scenario should be run via
Project.run_scenarios
- get_instructions(progset, project)[source]¶
Get scenario instructions
If the derived scenario class produces program instructions, return them here.
- Parameters:
progset (
ProgramSet) – InputProgramSet- Return type:
- Returns:
ProgramInstructionsinstance, or None if no instructions (in which case, programs will not be used)
- get_parset(parset, project)[source]¶
Get scenario parset
If the derived scenario class modifies the parset, return the modified version
- Parameters:
parset – Input
ParameterSet- Return type:
- Returns:
Modified parset for use in the simulation
- get_progset(progset, project)[source]¶
Get scenario progset
If the derived scenario class modifies the progset, return the modified version
- Parameters:
progset (
ProgramSet) – InputProgramSet- Return type:
- Returns:
Modified progset for use in the simulation
- parsetname¶
Specify parset name when run via
Project.run_scenarios
- progsetname¶
Specify progset name when run via
Project.run_scenarios
- run(project, parset=None, progset=None, store_results=True)[source]¶
Run scenario
- Parameters:
project – A
Projectinstanceparset (
ParameterSet) – Optionally aParameterSetinstance, otherwise will useself.parsetnameprogset (
ProgramSet) – Optionally aProgramSetinstance, otherwise will useself.progsetnamestore_results (
bool) – If True, the results will be copied into the project
- Return type:
- Returns:
A
Resultobject