parameter_sweep.reader
Module Contents
Classes
Functions
|
Creates a dictionary of swept model parameters specified via yaml file |
|
Sets default model values using values stored in a yaml file |
- class parameter_sweep.reader.ParameterSweepReader
- get_sweep_params_from_yaml(m, yaml_filename)
Creates a dictionary of swept model parameters specified via yaml file
This function creates a dictionary of the items to vary during a parameter sweep where the variable name, model attribute, and sweeping domain are specified in a YAML file. The YAML file should have the following format:
A_comp: type: NormalSample param: fs.RO.A_comp mean: 4.0e-12 std: 0.5e-12
where the top-level keyword can be any short, easily understood identifier for the parameter.
typemust be one ofLinearSample,UniformSample,NormalSample, orLatinHypercubeSample.parammust be a valid dot-sperated string path to the object attribute (in this case, an RO attribute on the flowsheetm) that you wish to vary. The remaining arguments are dependent on the sample type selected. ForNormalSampleinformation about the mean and standard deviation is required. Consult theparameter_sweephelp for more information on the different sample classes.
- set_defaults_from_yaml(m, yaml_filename, verbose=False)
Sets default model values using values stored in a yaml file
This function reads a yaml file with the structure:
fs.path.to.attribute_1: 0.123 fs.path.to.attribute_2: 1.234 ...
and uses the (key, default_value) pairs to set default values for the attributes in model
m.- Parameters:
m (pyomo model) – The flowsheet containing the model to set default values for
yaml_filename (str) – The path to the yaml file.
- Returns:
N/A
- parameter_sweep.reader.get_sweep_params_from_yaml(m, yaml_filename)
Creates a dictionary of swept model parameters specified via yaml file
This function creates a dictionary of the items to vary during a parameter sweep where the variable name, model attribute, and sweeping domain are specified in a YAML file. The YAML file should have the following format:
A_comp: type: NormalSample param: fs.RO.A_comp mean: 4.0e-12 std: 0.5e-12
where the top-level keyword can be any short, easily understood identifier for the parameter.
typemust be one ofLinearSample,UniformSample,NormalSample, orLatinHypercubeSample.parammust be a valid dot-sperated string path to the object attribute (in this case, an RO attribute on the flowsheetm) that you wish to vary. The remaining arguments are dependent on the sample type selected. ForNormalSampleinformation about the mean and standard deviation is required. Consult theparameter_sweephelp for more information on the different sample classes.
- parameter_sweep.reader.set_defaults_from_yaml(m, yaml_filename, verbose=False)
Sets default model values using values stored in a yaml file
This function reads a yaml file with the structure:
fs.path.to.attribute_1: 0.123 fs.path.to.attribute_2: 1.234 ...
and uses the (key, default_value) pairs to set default values for the attributes in model
m.- Parameters:
m (pyomo model) – The flowsheet containing the model to set default values for
yaml_filename (str) – The path to the yaml file.
- Returns:
N/A