English Français

Documentation / User's manual in Python : PDF version

Chapter XIV. Use-cases in python

Chapter XIV. Use-cases in python

version v4.9.0

Table of Contents

XIV.1. Introduction
XIV.2. Macros Python HowTo
XIV.2.1. Macro "howtoConvertTDataServerArray.py"
XIV.2.2. Macro "howtoConvertTMatrixDArray.py"
XIV.2.3. Macro "howtoLoadFunction.py"
XIV.2.4. Macro "howtoPassReference.py"
XIV.3. Macros DataServer
XIV.3.1. Macro "dataserverAttributes.py"
XIV.3.2. Macro "dataserverMerge.py"
XIV.3.3. Macro "dataserverLoadASCIIFilePasture.py"
XIV.3.4. Macro "dataserverLoadASCIIFile.py"
XIV.3.5. Macro "dataserverLoadASCIIFileYoungsModulus.py"
XIV.3.6. Macro "dataserverLoadASCIIFileIonosphere.py"
XIV.3.7. Macro "dataserverLoadASCIIFileCornell.py"
XIV.3.8. Macro "dataserverComputeQuantile.py"
XIV.3.9. Macro "dataserverGeyserStat.py"
XIV.3.10. Macro "dataserverGeyserRank.py"
XIV.3.11. Macro "dataserverNormaliseVector.py"
XIV.3.12. Macro "dataserverComputeStatVector.py"
XIV.3.13. Macro "dataserverComputeCorrelationMatrixVector.py"
XIV.3.14. Macro "dataserverComputeQuantileVec.py"
XIV.3.15. Macro "dataserverDrawQQPlot.py"
XIV.3.16. Macro "dataserverDrawPPPlot.py"
XIV.3.17. Macro "dataserverPCAExample.py"
XIV.4. Macros Sampler
XIV.4.1. Macro "samplingFlowrate.py"
XIV.4.2. Macro "samplingLHS.py"
XIV.4.3. Macro "samplingLHSCorrelation.py"
XIV.4.4. Macro "samplingQMC.py"
XIV.4.5. Macro "samplingBasicSampling.py"
XIV.4.6. Macro "samplingOATRegular.py"
XIV.4.7. Macro "samplingOATRandom.py"
XIV.4.8. Macro "samplingOATMulti.py"
XIV.4.9. Macro "samplingOATRange.py"
XIV.4.10. Macro "samplingSpaceFilling.py"
XIV.4.11. Macro "samplingMaxiMinLHSFromLHSGrid.py"
XIV.4.12. Macro "samplingConstrLHSLinear.py"
XIV.4.13. Macro "samplingConstrLHSEllipses.py"
XIV.4.14. Macro "samplerSingularCorrelationCase.py"
XIV.5. Macros Launcher
XIV.5.1. Macro "launchFunctionDataBase.py"
XIV.5.2. Macro "launchFunctionSampling.py"
XIV.5.3. Macro "launchFunctionSamplingGraphs.py"
XIV.5.4. Macro "launchCodeFlowrateKeyDataBase.py"
XIV.5.5. Macro "launchCodeFlowrateKeySampling.py"
XIV.5.6. Macro "launchCodeFlowrateXMLSampling.py"
XIV.5.7. Macro "launchCodeFlowrateKeySamplingKey.py"
XIV.5.8. Macro "launchCodeFlowrateKeyRecreateSampling.py"
XIV.5.9. Macro "launchCodeFlowrateKeyRecreateSamplingOutputDataServer.py"
XIV.5.10. Macro "launchCodeFlowrateRowRecreateSamplingOutputDataServer.py"
XIV.5.11. Macro "launchCodeFlowrateFlagSampling.py"
XIV.5.12. Macro "launchCodeFlowrateFlagSamplingKey.py"
XIV.5.13. Macro "launchCodeFlowrateKeyFlagSampling.py"
XIV.5.14. Macro "launchCodeFlowrateKeywithFlagSampling.py"
XIV.5.15. Macro "launchCodeFlowrateKeyFailure.py"
XIV.5.16. Macro "launchCodeFlowrateFlagFailure.py"
XIV.5.17. Macro "launchCodeFlowrateKeyOATMinMax.py"
XIV.5.18. Macro "launchCodeFlowrateFlagOATMinMax.py"
XIV.5.19. Macro "launchCodeLevelEOutputColumn.py"
XIV.5.20. Macro "launchCodeLevelEOutputRow.py"
XIV.5.21. Macro "launchCodeLevelEOutputKey.py"
XIV.5.22. Input/Output with vector and string: introduction to macros with multitype
XIV.5.23. Macro "launchCodeMultiTypeKey.py"
XIV.5.24. Macro "launchCodeMultiTypeKeyCondensate.py"
XIV.5.25. Macro "launchCodeMultiTypeDataServer.py"
XIV.5.26. Macro "launchCodeMultiTypeColumn.py"
XIV.5.27. Macro "launchCodeMultiTypeRow.py"
XIV.5.28. Macro "launchCodeMultiTypeXML.py"
XIV.5.29. Macro "launchCodeReadMultiTypeKey.py"
XIV.5.30. Macro "launchCodeReadMultiTypeDataServer.py"
XIV.5.31. Macro "launchCodeReadMultiTypeColumn.py"
XIV.5.32. Macro "launchCodeReadMultiTypeRow.py"
XIV.5.33. Macro "launchCodeReadMultiTypeXML.py"
XIV.5.34. Macro "launchCodeFilesWithBlank.py"
XIV.6. Macros Sensitivity
XIV.6.1. Macro "sensitivityBrutForceMethodFlowrate.py"
XIV.6.2. Macro "sensitivityFiniteDifferencesFunctionFlowrate.py"
XIV.6.3. Macro "sensitivityDataBaseFlowrate.py"
XIV.6.4. Macro "sensitivityFASTFunctionFlowrate.py"
XIV.6.5. Macro "sensitivityRBDFunctionFlowrate.py"
XIV.6.6. Macro "sensitivityMorrisFunctionFlowrate.py"
XIV.6.7. Macro "sensitivityMorrisFunctionFlowrateRunner.py"
XIV.6.8. Macro "sensitivityRegressionFunctionFlowrate.py"
XIV.6.9. Macro "sensitivitySobolFunctionFlowrate.py"
XIV.6.10. Macro "sensitivitySobolFunctionFlowrateRunner.py"
XIV.6.11. Macro "sensitivityRegressionLeveLE.py"
XIV.6.12. Macro "sensitivitySobolLeveLE.py"
XIV.6.13. Macro "sensitivitySobolRe-estimation.py"
XIV.6.14. Macro "sensitivitySobolWithData.py"
XIV.6.15. Macro "sensitivitySobolLoadFile.py"
XIV.6.16. Macro "sensitivityJohnsonRWFunctionFlowrate.py"
XIV.6.17. Macro "sensitivityJohnsonRWCorrelatedFunctionFlowrate.py"
XIV.6.18. Macro "sensitivityJohnsonRWJustCorrelationFakeFlowrate.py"
XIV.6.19. Macro "sensitivityHSICFunctionFlowrate.py"
XIV.6.20. Macro "sensitivitySobolRankFunctionFlowrate.py"
XIV.7. Macros Modeler
XIV.7.1. Macro "modelerCornellLinearRegression.py"
XIV.7.2. Macro "modelerFlowrateLinearRegression.py"
XIV.7.3. Macro "modelerFlowrateMultiLinearRegression.py"
XIV.7.4. Macro "modelerFlowrateNeuralNetworks.py"
XIV.7.5. Macro "modelerFlowrateNeuralNetworksLoadingPMML.py"
XIV.7.6. Macro "modelerClassificationNeuralNetworks.py"
XIV.7.7. Macro "modelerFlowratePolynChaosRegression.py"
XIV.7.8. Macro "modelerFlowratePolynChaosIntegration.py"
XIV.7.9. Macro "modelerbuildSimpleGP.py"
XIV.7.10. Macro "modelerbuildGPInitPoint.py"
XIV.7.11. Macro "modelerbuildGPWithAPriori.py"
XIV.7.12. Macro "modelerbuildSimpleGPEstim.py"
XIV.7.13. Macro "modelerbuildSimpleGPEstimWithCov.py"
XIV.7.14. Macro "modelerTestKriging.py"
XIV.8. Macros Optimizer
XIV.8.1. Macro "optimizeFunctionRosenbrock.py"
XIV.8.2. Macro "optimizeFunctionRosenbrockNewInputOutput.py"
XIV.8.3. Macro "optimizeCodeRosenbrockKey.py"
XIV.8.4. Macro "optimizeCodeRosenbrockKeyNewInputOutput.py"
XIV.8.5. Macro "optimizeCodeRosenbrockRow.py"
XIV.8.6. Macro "optimizeCodeRosenbrockKeyRowRecreate.py"
XIV.8.7. Macro "optimizeCodeRosenbrockRowRecreate.py"
XIV.8.8. Macro "optimizeCodeRosenbrockRowRecreateOutputDataServer.py"
XIV.8.9. Example of optimisation with a code that can compute several values at each run
XIV.8.10. Macro "optimizeRosenbrockMulti.py"
XIV.8.11. Macro "optimizeRosenbrockError.py"
XIV.9. Macros Relauncher
XIV.9.1. Macro "relauncherFunctionFlowrateCInt.py"
XIV.9.2. Macro "relauncherFunctionFlowratePython.py"
XIV.9.3. Macro "relauncherCodeFlowrateSequential.py"
XIV.9.4. Macro "relauncherCodeFlowrateSequential_ConstantVar.py"
XIV.9.5. Macro "relauncherCodeFlowrateThreaded.py"
XIV.9.6. Macro "relauncherCodeFlowrateMPI.py"
XIV.9.7. Macro "relauncherCodeFlowrateSequentialFailure.py"
XIV.9.8. Macro "relauncherCodeMultiTypeKey.py"
XIV.9.9. Macro "relauncherCodeMultiTypeKeyEmptyVectors.py"
XIV.9.10. Macro "relauncherCodeMultiTypeKeyEmptyVectorsAsFailure.py"
XIV.9.11. Macro "relauncherCodeReadMultiType.py"
XIV.9.12. Macro "relauncherComposeMultitypeAndReadMultiType.py"
XIV.9.13. Macro "relauncherCodeFlowrateSequential_TemporaryVar.py"
XIV.10. Macros Reoptimizer
XIV.10.1. Macro "reoptimizeHollowBarCode.py"
XIV.10.2. Macro "reoptimizeHollowBarCodeMultiStart.py"
XIV.10.3. Macro "reoptimizeHollowBarCodevizir.py"
XIV.10.4. Macro "reoptimizeHollowBarVizirMoead.py"
XIV.10.5. Macro "reoptimizeHollowBarVizirSplitRuns.py"
XIV.10.6. Macro "reoptimizeZoningBiSubMpi.py"
XIV.10.7. Macro "reoptimizeZoneBiFunMpi.py"
XIV.11. Macros MetaModelOptim
XIV.11.1. Macro "metamodoptEgoHimmel.py"
XIV.12. Macros Calibration
XIV.12.1. Macro "calibrationMinimisationFlowrate1D.py"
XIV.12.2. Macro "calibrationLinBayesFlowrate1D.py"
XIV.12.3. Macro "calibrationRejectionABCFlowrate1D.py"
XIV.12.4. Macro "calibrationMetropHastingFlowrate1D.py"
XIV.12.5. Macro "calibrationMetropHastingLinReg.py"
XIV.12.6. Macro "calibrationMinimisationFlowrate2DVizir.py"
XIV.13. Macros UncertModeler
XIV.13.1. Macro "uncertModelerTestsYoungsModulus.py"
XIV.13.2. Macro "uncertModelerCirce.py"
XIV.14. Macros Reliability
XIV.14.1. Macro "reliabilityFormSorm.py"

XIV.1. Introduction

Several use-cases of Uranie are described in this chapter with a small description of the implemented methods in the Uranie platform. These macros are located in the sub-directory "/share/uranie/macros" of the installation folder of Uranie ($URANIESYS).

In this chapter, inside each macro, the Uranie specific namespaces might not always be specified anymore. These specifications are gathered in the rootlogon.py file, introduced in Section I.2.4, which is automatically loaded when executing python. An example would be:

import ROOT

# Create shortcuts if uranie exists
urasys = ROOT.TString(ROOT.gSystem.Getenv("URANIESYS"))
if not urasys.EqualTo(""):
    from ROOT.URANIE import DataServer as DataServer
    from ROOT.URANIE import Sampler as Sampler
    from ROOT.URANIE import Launcher as Launcher
    from ROOT.URANIE import Relauncher as Relauncher
    from ROOT.URANIE import Reoptimizer as Reoptimizer
    from ROOT.URANIE import Sensitivity as Sensitivity
    from ROOT.URANIE import Optimizer as Optimizer
    from ROOT.URANIE import Modeler as Modeler
    from ROOT.URANIE import Calibration as Calibration
    from ROOT.URANIE import UncertModeler as UncertModeler
    from ROOT.URANIE import Reliability as Reliability
    from ROOT.URANIE import XMLProblem as XMLProblem
    from ROOT.URANIE import MpiRelauncher as MpiRelauncher
    pass

# General graphical style
white = 0

# PlotStyle
ROOT.gStyle.SetPalette(1)
ROOT.gStyle.SetOptDate(21)

# Legend
ROOT.gStyle.SetLegendBorderSize(0)
ROOT.gStyle.SetFillStyle(0)

# Pads
ROOT.gStyle.SetPadColor(white)
ROOT.gStyle.SetTitleFillColor(white)
ROOT.gStyle.SetStatColor(white)

#  ====================  Hint ====================
#
#    Might be practical to store this in a convenient place (for instance
#    the ".python" folder in your home directory) or any other place where
#    your $PYTHONPATH is pointing.
#
#    example : export PYTHONPATH=$PYTHONPATH:${HOME}/.mypython/
#
#    It should then be called as "from rootlogon import " + the list of module
#    This would replace the shortcuts created and import done in the rest of
#    the scripts
#
#    Many style issue can be set once and for all here.
#    toto=DataServer.TDataServer()
#

All the use case macros, shown in this chapter, are tested with pylint to check their consistency with python standard, such as PEP-8, most of which obtains now (from version 4.8.0) a score of 10 out of 10. To do this, three options are used:

  • --module-naming-style=camelCase: this option is used so that evey file name can be written as their C++ counterpart (in order to overcome the default sneak_case);

  • --const-naming-style=any: since our use-case macros are standalone scripts (meaning without classes) all their variables are global ones and should be written in upper case according to pylint default. We choose not to follow this convention;

  • --ignored-module=ROOT: as ROOT is loaded from the $PYTHONPATH and not installed as a system library, many error might pop-up from the use of ROOT;

Figure XIV.1. Distribution of the pylint score for the following use-case macros

Distribution of the pylint score for the following use-case macros


/language/en