13.6.8. Macro “sensitivityRegressionFunctionFlowrate.py”
13.6.8.1. Objective
The objective of this macro is to perform a regression with “SRC” method on a database generated with
a function using sampling of parameters obeying uniform laws with 4000 patterns. flowrateModel is
a function defined in Presentation of the problem and “loaded” through the macro
UserFunctions.C (the file can be found in ${URANIESYS}/share/uranie/macros). Function
flowrateModel uses the eight variables defined in Presentation of the problem
and set in the main macro.
13.6.8.2. Macro Uranie
"""
Example of regression approach on the flowrate function
"""
from URANIE import DataServer, Launcher, Sampler, Sensitivity
import ROOT
ROOT.gROOT.LoadMacro("UserFunctions.C")
# Define the DataServer
tds = DataServer.TDataServer("tdsflowreate", "DataBase flowreate")
tds.addAttribute(DataServer.TUniformDistribution("rw", 0.05, 0.15))
tds.addAttribute(DataServer.TUniformDistribution("r", 100.0, 50000.0))
tds.addAttribute(DataServer.TUniformDistribution("tu", 63070.0, 115600.0))
tds.addAttribute(DataServer.TUniformDistribution("tl", 63.1, 116.0))
tds.addAttribute(DataServer.TUniformDistribution("hu", 990.0, 1110.0))
tds.addAttribute(DataServer.TUniformDistribution("hl", 700.0, 820.0))
tds.addAttribute(DataServer.TUniformDistribution("l", 1120.0, 1680.0))
tds.addAttribute(DataServer.TUniformDistribution("kw", 9855.0, 12045.0))
# Size of a sampling.
nS = 4000
sampling = Sampler.TSampling(tds, "lhs", nS)
sampling.generateSample()
tlf = Launcher.TLauncherFunction(tds, "flowrateModel")
tlf.setDrawProgressBar(False)
tlf.run()
treg = Sensitivity.TRegression(tds, "rw:r:tu:tl:hu:hl:l:kw",
"flowrateModel", "SRC")
treg.computeIndexes()
treg.getResultTuple().SetScanField(60)
treg.getResultTuple().Scan("Out:Inp:Method:Algo:Value:CILower:CIUpper",
"Order==\"First\"","colsize=5 col=6:8::9:8:8:8")
can = ROOT.TCanvas("c1", "Graph sensitivityRegressionFunctionFlowrate",
5, 64, 1270, 667)
treg.drawIndexes("Flowrate", "", "hist, first, nonewcanv")
Each attribute is related to a TAttribute obeying uniform laws on specific intervals:
tds.addAttribute(DataServer.TUniformDistribution("rw", 0.05, 0.15))
tds.addAttribute(DataServer.TUniformDistribution("r", 100.0, 50000.0))
tds.addAttribute(DataServer.TUniformDistribution("tu", 63070.0, 115600.0))
tds.addAttribute(DataServer.TUniformDistribution("tl", 63.1, 116.0))
tds.addAttribute(DataServer.TUniformDistribution("hu", 990.0, 1110.0))
tds.addAttribute(DataServer.TUniformDistribution("hl", 700.0, 820.0))
tds.addAttribute(DataServer.TUniformDistribution("l", 1120.0, 1680.0))
tds.addAttribute(DataServer.TUniformDistribution("kw", 9855.0, 12045.0))
The sampling is generated on 4000 patterns with a LHS method:
sampling = Sampler.TSampling(tds, "lhs", nS)
sampling.generateSample()
Function flowrateModel is set to perform calculation on the sampling:
tlf = Launcher.TLauncherFunction(tds, "flowrateModel")
tlf.run()
The regression is performed over all variables:
treg = Sensitivity.TRegression(tds, "rw:r:tu:tl:hu:hl:l:kw",
"flowrateModel", "SRC")
treg.computeIndexes()
Sensitivity indexes are then displayed through an histogram:
can = ROOT.TCanvas("c1", "Graph sensitivityRegressionFunctionFlowrate",
5, 64, 1270, 667)
treg.drawIndexes("Flowrate", "", "hist, first, nonewcanv")
13.6.8.3. Graph
Figure 13.24 Graph of the macro “sensitivityRegressionFunctionFlowrate.py”
13.6.8.4. Console
--- Uranie v4.11/0 --- Developed with ROOT (6.36.06)
Copyright (C) 2013-2026 CEA/DES
Contact: support-uranie@cea.fr
Date: Thu Feb 12, 2026
*************************************************************************************
* Row * Out * Inp * Metho * Algo * Value * CILower * CIUpper *
*************************************************************************************
* 0 * flowra * rw * SRC^2 * --first-- * 0.820265 * -1 * -1 *
* 2 * flowra * rw * SRC^2 * --rho^2-- * 0.81668 * 0.805846 * 0.826888 *
* 4 * flowra * r * SRC^2 * --first-- * 5.97e-06 * -1 * -1 *
* 6 * flowra * r * SRC^2 * --rho^2-- * 1.92e-06 * 2.65e-07 * 0.001339 *
* 8 * flowra * tu * SRC^2 * --first-- * 8.64e-06 * -1 * -1 *
* 10 * flowra * tu * SRC^2 * --rho^2-- * 4.03e-06 * 3.14e-07 * 0.001306 *
* 12 * flowra * tl * SRC^2 * --first-- * 5.73e-05 * -1 * -1 *
* 14 * flowra * tl * SRC^2 * --rho^2-- * 0.000209 * 7.34e-07 * 0.002085 *
* 16 * flowra * hu * SRC^2 * --first-- * 0.039645 * -1 * -1 *
* 18 * flowra * hu * SRC^2 * --rho^2-- * 0.037119 * 0.026221 * 0.049000 *
* 20 * flowra * hl * SRC^2 * --first-- * 0.040597 * -1 * -1 *
* 22 * flowra * hl * SRC^2 * --rho^2-- * 0.039708 * 0.028688 * 0.052470 *
* 24 * flowra * l * SRC^2 * --first-- * 0.040895 * -1 * -1 *
* 26 * flowra * l * SRC^2 * --rho^2-- * 0.041241 * 0.029896 * 0.054454 *
* 28 * flowra * kw * SRC^2 * --first-- * 0.009174 * -1 * -1 *
* 30 * flowra * kw * SRC^2 * --rho^2-- * 0.009090 * 0.004191 * 0.015767 *
* 32 * flowra * __sum__ * SRC^2 * --first-- * 0.95065 * -1 * -1 *
* 34 * flowra * __R2__ * SRC^2 * --first-- * 0.947296 * -1 * -1 *
* 36 * flowra * __R2A__ * SRC^2 * --first-- * 0.94719 * -1 * -1 *
*************************************************************************************
==> 19 selected entries