--- myst: substitutions: macro: python: 1-5,17-51,54-62,65-68,71-77 cpp: 6-8,14-44,47-61,64-65 bloc1: python: "30" cpp: "24" bloc2: python: 45-51,54 cpp: 39-44,47 bloc3: python: 56-62,65-68,71-77 cpp: 49-61,64-65 console: python: 2-19,22-23 cpp: 6-25 --- (use_cases_macro_calibration_abc)= # Macro "**calibrationRejectionABCFlowrate1D.{{extension}}**" ## Objective The goal here is to calibrate the parameter $H_l$ within the `flowrate` model, while varying only two inputs ($r_{\omega}$ and $L$). The remaining variables are fixed to the following values: $r=25050$, $T_u=89335$, $T_l=89.55$, $H_u=1050$, $K_{\omega}=10950$. The context of this example has already been presented in [](#calibration_classes_functions_observations_use_case), including the model (implemented here as a C++ function) and the initial lines defining the {{tds}} objects. This macro demonstrates how to apply a rejection ABC method using a **Relauncher**-based architecture. ## Macro {{uranie}} {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/calibration/use_cases/" + language + "/calibrationRejectionABCFlowrate1D." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[language] + "\n" + "```" }} Much of this code has already been covered in the previous section [](#use_cases_macro_calibration_minimisation) (up to the sequential run). The main difference here is that the input parameter is now defined as a `TStochasticDistribution`, representing the *a priori* chosen distribution. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/calibration/use_cases/" + language + "/calibrationRejectionABCFlowrate1D." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} The model is defined (from a `TCIntEval` instance with the three input variables discussed above, in the **correct order**) along with the computation distribution method (sequential). The calibration object is then created by specifying both the number of elements in the final sample (`nABC = 100`) and the percentile of events retained (`eps = 0.05`, meaning that 2000 locations will be tested). Since the code is deterministic, uncertainty is introduced by adding random Gaussian noise. The standard deviation of this noise is defined on an event-by-event basis using a variable from the observation dataserver. Finally, the distance function is specified, and the estimation process is performed. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/calibration/use_cases/" + language + "/calibrationRejectionABCFlowrate1D." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} The final part demonstrates how to display the results. Since this method produces samples of the *a posteriori* distributions, basic statistical information are directly displayed on screen, as shown in [](#use_cases_macro_calibration_rejection_abc_console). Two additional pieces of *a posteriori* information are presented as plots: the residuals ({numref}`usecases_calibrationRejectionABCFlowrate1D_Res`), which show the expected normal distribution behavior, as discussed in {{metho}} and the posterior distribution ({numref}`usecases_calibrationRejectionABCFlowrate1D_Par`). {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/calibration/use_cases/" + language + "/calibrationRejectionABCFlowrate1D." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc3[language] + "\n" + "```" }} (use_cases_macro_calibration_rejection_abc_console)= ## Console {{ "```{literalinclude} " + parent_dir + "/roottest/build/uranie/doc/calibration/use_cases/" + language + "/calibrationRejectionABCFlowrate1D_clean.log" + "\n" + ":language: none\n" + ":lines: " + console[language] + "\n" + "```" }} ## Graphs {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/calibration/use_cases/" + language + "/rejection_abc/calibrationRejectionABCFlowrate1D_Res.png\n" ":align: center\n" ":name: usecases_calibrationRejectionABCFlowrate1D_Res\n" + figure_scale + "\n" "\n" "Residuals graph of the macro **\"calibrationRejectionABCFlowrate1D." + extension + "\"**\n" "```" }} {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/calibration/use_cases/" + language + "/rejection_abc/calibrationRejectionABCFlowrate1D_Par.png\n" ":align: center\n" ":name: usecases_calibrationRejectionABCFlowrate1D_Par\n" + figure_scale + "\n" "\n" "Parameter graph of the macro **\"calibrationRejectionABCFlowrate1D." + extension + "\"**\n" "```" }}