:py:mod:`parameter_sweep.reader` ================================ .. py:module:: parameter_sweep.reader Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: parameter_sweep.reader.ParameterSweepReader Functions ~~~~~~~~~ .. autoapisummary:: parameter_sweep.reader.get_sweep_params_from_yaml parameter_sweep.reader.set_defaults_from_yaml .. py:class:: ParameterSweepReader .. py:method:: 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. ``type`` must be one of ``LinearSample``, ``UniformSample``, ``NormalSample``, or ``LatinHypercubeSample``. ``param`` must be a valid dot-sperated string path to the object attribute (in this case, an RO attribute on the flowsheet ``m``) that you wish to vary. The remaining arguments are dependent on the sample type selected. For ``NormalSample`` information about the mean and standard deviation is required. Consult the ``parameter_sweep`` help for more information on the different sample classes. :param m: The flowsheet containing the model to deploy with the parameter sweep tool. :type m: pyomo model :param yaml_filename: The path to the yaml file. :type yaml_filename: str :returns: A dictionary containing different instances of parameter sweep samples :rtype: sweep_params (dict) .. py:method:: 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``. :param m: The flowsheet containing the model to set default values for :type m: pyomo model :param yaml_filename: The path to the yaml file. :type yaml_filename: str :returns: N/A .. py:function:: 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. ``type`` must be one of ``LinearSample``, ``UniformSample``, ``NormalSample``, or ``LatinHypercubeSample``. ``param`` must be a valid dot-sperated string path to the object attribute (in this case, an RO attribute on the flowsheet ``m``) that you wish to vary. The remaining arguments are dependent on the sample type selected. For ``NormalSample`` information about the mean and standard deviation is required. Consult the ``parameter_sweep`` help for more information on the different sample classes. :param m: The flowsheet containing the model to deploy with the parameter sweep tool. :type m: pyomo model :param yaml_filename: The path to the yaml file. :type yaml_filename: str :returns: A dictionary containing different instances of parameter sweep samples :rtype: sweep_params (dict) .. py:function:: 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``. :param m: The flowsheet containing the model to set default values for :type m: pyomo model :param yaml_filename: The path to the yaml file. :type yaml_filename: str :returns: N/A