Back to index

salome-kernel  6.5.0
Functions
KERNEL_PY.kernel.parametric.pyscript_utils Namespace Reference

Functions

def create_input_dict
def create_normal_parametric_output
def create_error_parametric_output

Function Documentation

This function returns a dictionary describing the output of the
computation code in parametric studies in case of error.

:type  error_message: string
:param error_message: the error message.

:return: a dictionary describing the error.

Definition at line 81 of file pyscript_utils.py.

00081 
00082 def create_error_parametric_output(error_message):
00083     """
00084     This function returns a dictionary describing the output of the
00085     computation code in parametric studies in case of error.
00086     
00087     :type  error_message: string
00088     :param error_message: the error message.
00089 
00090     :return: a dictionary describing the error.
00091     """
00092     return {"outputValues" : [],
00093             "specificOutputInfos" : [],
00094             "returnCode" : 1,
00095             "errorMessage" : error_message}
def KERNEL_PY.kernel.parametric.pyscript_utils.create_input_dict (   deterministic_dict,
  parametric_input 
)
This function returns a dictionary containing the input values to be used
in the computation code.

:type  deterministic_dict: dict
:param deterministic_dict: dictionary containing the fixed values (i.e.
                           non-parametric). This dictionary can be empty
                           if all variables are parametric.

:type  parametric_input: dict
:param parametric_input: dictionary containing the description and values
                         of the parametric variables.

:return: a dictionary containing the input values for the computation code.

Definition at line 28 of file pyscript_utils.py.

00028 
00029 def create_input_dict(deterministic_dict, parametric_input):
00030     """
00031     This function returns a dictionary containing the input values to be used
00032     in the computation code.
00033     
00034     :type  deterministic_dict: dict
00035     :param deterministic_dict: dictionary containing the fixed values (i.e.
00036                                non-parametric). This dictionary can be empty
00037                                if all variables are parametric.
00038 
00039     :type  parametric_input: dict
00040     :param parametric_input: dictionary containing the description and values
00041                              of the parametric variables.
00042 
00043     :return: a dictionary containing the input values for the computation code.
00044     """
00045     # Simply get the first point from input (no time series, single observation)
00046     input_point = parametric_input["inputValues"][0][0]
00047 
00048     if len(input_point) != len(parametric_input["inputVarList"]):
00049         raise Exception("Size mismatch between inputVarList and point to evaluate")
00050 
00051     input_dict = deterministic_dict.copy()
00052     for i in range(len(input_point)):
00053         input_dict[parametric_input["inputVarList"][i]] = input_point[i][0]
00054 
00055     return input_dict

This function returns a dictionary describing the output of the
computation code in parametric studies.

:type  output_dict: dict
:param output_dict: dictionary containing the output values of the
                    computation code (the keys are the variable names, the
                    values are the variable values).

:type  parametric_input: dict
:param parametric_input: dictionary containing the description and values
                         of the parametric variables.

:return: a dictionary containing the representation of the output of the
         computation code.

Definition at line 56 of file pyscript_utils.py.

00056 
00057 def create_normal_parametric_output(output_dict, parametric_input):
00058     """
00059     This function returns a dictionary describing the output of the
00060     computation code in parametric studies.
00061     
00062     :type  output_dict: dict
00063     :param output_dict: dictionary containing the output values of the
00064                         computation code (the keys are the variable names, the
00065                         values are the variable values).
00066 
00067     :type  parametric_input: dict
00068     :param parametric_input: dictionary containing the description and values
00069                              of the parametric variables.
00070 
00071     :return: a dictionary containing the representation of the output of the
00072              computation code.
00073     """
00074     output_values = [[[]]]
00075     for output_var in parametric_input["outputVarList"]:
00076         output_values[0][0].append([output_dict[output_var]])
00077     return {"outputValues" : output_values,
00078             "specificOutputInfos" : [],
00079             "returnCode" : 0,
00080             "errorMessage" : ""}