Dakota utilities
Helper functions for processing Dakota parameter and results files.
-
dakotathon.utils.add_dyld_library_path()[source]
Add the DYLD_LIBRARY_PATH environment variable for Dakota.
-
dakotathon.utils.compute_statistic(statistic, array)[source]
Compute the statistic used in a Dakota response function.
- statistic : str
- A string with the name of the statistic to compute (‘mean’,
‘median’, etc.).
- array : array_like
- An array data structure, such as a numpy array.
- float
- The value of the computed statistic.
-
dakotathon.utils.configure_parameters(params)[source]
Preprocess Dakota parameters prior to committing to a config file.
- params : dict
- Configuration parameters for a Dakota experiment that map to the
items in the Dakota configuration file, dakota.yaml.
- (dict, dict)
- An updated dict of Dakota configuration parameters, and a dict
of substitutions used to create the Dakota template (“dtmpl”)
file.
-
dakotathon.utils.deserialize(config_file)[source]
Load settings from a YAML configuration file.
- dict
- Configuration settings in a dict.
-
dakotathon.utils.get_attributes(obj)[source]
Get and format the attributes of an object.
- section
- An object that has attributes.
- dict
- The object’s attributes.
-
dakotathon.utils.get_configuration_file(params_file)[source]
Extract the configuration filepath from a Dakota parameters file.
- params_file : str
- The path to a Dakota parameters file.
- str
- The path to the configuration file for the Dakota experiment.
-
dakotathon.utils.get_response_descriptors(params_file)[source]
Extract response descriptors from a Dakota parameters file.
- params_file : str
- The path to a Dakota parameters file.
- list
- A list of response descriptors for the Dakota experiment.
-
dakotathon.utils.is_dakota_installed()[source]
Check whether Dakota is installed and in the execution path.
- bool
- True if Dakota is callable.
-
dakotathon.utils.to_iterable(x)[source]
Get an iterable version of an input.
- x
- Anything.
If the input isn’t iterable, or is a string, then a tuple; else,
the input.
Courtesy http://stackoverflow.com/a/6711233/1563298
-
dakotathon.utils.which(prog, env=None)[source]
Call the OS which function.
- prog : str
- The command name.
- env : str, optional
- An environment variable.
The path to the command, or None if the command is not found.
-
dakotathon.utils.which_dakota()[source]
Locate the Dakota executable.
The path to the Dakota executable, or None if Dakota is not found.
-
dakotathon.utils.write_results(results_file, values, labels)[source]
Write a Dakota results file from a set of input values.
- results_file : str
- The path to a Dakota results file.
- values : array_like
- A list or array of numeric values.
- labels : str
- A list of labels to attach to the values.