armi.settings package¶
Settings are various key-value pairs that determine a bunch of modeling and simulation behaviors.
They are one of the key inputs to an ARMI run. They say which modules to run and which modeling approximations to apply and how many cycles to run and at what power and availability fraction and things like that.
Notes
Originally, these were just a Python module settings.py that had Python types in it.
We transitioned to XML because it was trendy. Later, we wanted better uniformity across
our input formats so we made it do YAML, too. We then added the ability to provide new
Settings from plugins, which introduced the setting2 module. As a result of this
history, there are now two implementations of the Setting class, which, while they
are not related through inheritance, do expose very similar interfaces and can largely
be used interchangeably. There are no insances of the old Setting format, but we are
leaving it in the code for now to facilitate input migrations from older versions of
ARMI. We plan to remove the old implementation, and replace it with the new
implementation in setting2 very soon.
-
armi.settings.isBoolSetting(setting: Union[armi.settings.setting.Setting, armi.settings.setting2.Setting]) → bool[source]¶ Return whether the passed setting represents a boolean value.
This is useful during the transition from old to new settings. The old settings used to be “strongly” typed, wheras the new once are a little bit looser in that their types are largely enforced by their schemas. In situations where we want to treat bool-y settings special (e.g., when we want to make command-line toggles out of them), this provides the appropriate logic depending on which Setting class is being used.
-
armi.settings.recursivelyLoadSettingsFiles(rootDir, patterns, recursive=True, ignorePatterns=None, handleInvalids=True)[source]¶ Scans path for valid xml files and returns their paths.
- Parameters
rootDir (str) – The base path to scan for settings files
patterns (list) – file patterns to match file names
recursive (bool (optional)) – load files recursively
ignorePatterns (list (optional)) – list of filename patterns to ignore
handleInvalids (bool) – option to suppress errors generated when finding files that appear to be settings files but fail to load. This may happen when old settings are present.
- Returns
csFiles – list of
Settingsobjects.- Return type
list
-
armi.settings.promptForSettingsFile(choice=None)[source]¶ Allows the user to select an ARMI input from the input files in the directory
- Parameters
choice (int, optional) – The item in the list of valid XML files to load
-
armi.settings.getMasterCs()[source]¶ Return the global case-settings object (cs).
This can be called at any time to create or obtain the master Cs, a module-level CS intended to be shared by many other objects.
It can have multiple instances in multiprocessing cases.
- Returns
cs – The loaded cs object
- Return type
-
armi.settings.setMasterCs(cs)[source]¶ Set the master Cs to be the one that is passed in.
These are kept track of independently on a PID basis to allow independent multiprocessing.