in3Utils.cfgUtils
Utilities for handling configuration files and simulation naming
This module provides functions for: - Configuration file reading, writing, and merging - Configuration comparison and hashing - Simulation name parsing and construction
Simulation Name Format
AvaFrame uses structured simulation names with two supported formats:
- New format (with module name):
relName_simHash_modName_defID_[frictIndi]_simType_modelType[_resType][_timeStep]
- Old format (without module name):
relName_simHash_[defID]_[frictIndi]_simType_modelType[_resType][_timeStep]
- Where:
relName: Release area scenario name (required)
simHash: Configuration hash (required, 10 characters)
modName: Short module name - “com1”, “com2”, etc. (new format only)
defID: Default indicator - “C” or “D” (defaults to “C”) (required)
frictIndi: Friction calibration - “S”, “M”, or “L” (optional)
simType: Simulation type - “null”, “ent”, “res”, “entres” (required)
modelType: Model type - “dfa”, etc. (required)
resType: Result type - “ppr”, “pft”, “pfv”, etc. (filename only)
timeStep: Time step value (filename only)
The module name in the new format uses SHORT form only (e.g., “com1” not “com1DFA”). This was implemented in 2025-12 to support better organization and filtering of simulations.
Use parseSimName() to extract components from any simulation name. Backward compatibility is maintained - old format names are still supported.
Functions
append simulation configuration to the simulation dataframe append all sections to the dataframe |
|
append Tcpu dictionary to the dataframe |
|
UID hash of a config. |
|
Convert configuration object to RCF format file (used by NGI MoT). |
|
compare locCfg to defCfg and return a cfg object and modification dict Values are merged from locCfg to defCfg: - parameters already in defCfg get the value from locCfg - additional values in locCfg get added in the resulting Cfg |
|
create dictionary from configparser object |
|
convert a string DF to a numerical one |
|
create configParser object from dict |
|
convert a list into a string where individual list items are separated by | |
|
Read configurations from all simulations configuration ini files from directory |
|
Returns the default configuration for a given module returns a configParser object |
|
Returns the general configuration for avaframe returns a configParser object |
|
get the path and name of a module from imported module |
|
Returns the configuration for a given module returns a configParser object OR pathlib.Path (when batchCfgDir is used) |
|
Determine how many CPU cores to take for parallel tasks |
|
Parse simulation name handling both old and new formats. |
|
Read allConfigurations.csv file as dataFrame from directory |
|
Read configuration from ini file, if module is provided, module configuration is read from Ouputs, if fileName is provided configuration is read from fileName |
|
Read and optionally compare configuration files (if a local and default are both provided) and inform user of the eventual differences. |
|
Check avaName/Outputs/com1DFA/configurationFilesDone and pass names of all files found in this directory and create corresponding simDF this is useful if e.g. |
|
Rename duplicate column names in the given DataFrame. |
|
set pandas element to np.nan if it is a string nan |
|
Write cfg configuration to allConfigurations.csv |
|
Save configuration used to text file in Outputs/moduleName/configurationFiles/modName.ini or optional to filePath and with fileName |
|
write a dictionary to a json file |
|
When release is time dependent, save time dependent release values in Outputs/configurationFiles. |