# Macro "**relauncherFunctionFlowratePython.py**" ## Objective The goal of this macro is to show how to handle the Python-written function in a full python-script. This function has been presented, at least its equation (see {eq}`flowrate_function`) and would be interface through the `TPythonEval` class in the {{Relaun}} module. ## Macro {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherFunctionFlowratePython.py" + "\n" + ":language: python\n" + ":lines: 1-6,16-71\n" + "```" }} Obviously the code is now different from the other macros already introduced, but unless some python-specificity, the discussion has been largely done in [](#use_cases_macro_relauncher_cint_macro). The first interesting part is the definition of the function `flowrateModel`. It is a classical python-function, for which every input is either a double, a list (for vectors) or a string. Disregarding the inner part, where the computation is done, the other interesting part is the return line: it should always be a list of all the objects that should be returned. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherFunctionFlowratePython.py" + "\n" + ":language: python\n" + ":lines: 17-24\n" + "```" }} Apart from this, the only other difference is the assessor construction which is an instance of the `TPythonEval` class as shown here: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherFunctionFlowratePython.py" + "\n" + ":language: python\n" + ":lines: 44-45\n" + "```" }} The macro is also leading to the creation of the following plot. ## Graph {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/relauncher/use_cases/" + language + "/python/relauncherFunctionFlowratePython.png\n" ":align: center\n" ":name: usecases_relauncherFunctionFlowratePython\n" + figure_scale + "\n" "\n" "Representation of the output as a function of the first input with a colZ option\n" "```" }}