Example #1
0
    0.0114128746587,
    montecarloResult.getStandardDeviation()[3][0], 1e-13)

meanCI = montecarloResult.getMeanConfidenceInterval()
openturns.testing.assert_almost_equal(0.0590036320343,
                                      meanCI.getLowerBound()[3], 1e-13)
openturns.testing.assert_almost_equal(0.0604183606379,
                                      meanCI.getUpperBound()[3], 1e-13)
stdCi = montecarloResult.getStdConfidenceInterval()
openturns.testing.assert_almost_equal(0.0109336748621,
                                      stdCi.getLowerBound()[3], 1e-13)
openturns.testing.assert_almost_equal(0.0119363302339,
                                      stdCi.getUpperBound()[3], 1e-13)

# Sobol ##
sobol = persalys.SobolAnalysis('mySobol', model)
sobol.setReplicationSize(200)
sobol.setMaximumCalls(1000)
myStudy.add(sobol)
sobol.run()
sobolResult = sobol.getResult()

# Comparaison
firstOrderIndicesValues = [[0.643987, 0.0183602, 0.255834]]
totalIndicesValues = [[0.610267, 0.0494237, 0.280706]]
openturns.testing.assert_almost_equal(firstOrderIndicesValues,
                                      sobolResult.getFirstOrderIndices(), 1e-6)
openturns.testing.assert_almost_equal(totalIndicesValues,
                                      sobolResult.getTotalIndices(), 1e-6)

# SRC ##
# Model
x0 = persalys.Input('x0', ot.Normal())
x1 = persalys.Input('x1', ot.Normal())
y00 = persalys.Output('fake_y0')
y00.setIsSelected(False)
y0 = persalys.Output('y0')

formula_y00 = 'x0'
formula_y0 = '10+3*x0+x1'
model = persalys.SymbolicPhysicalModel('aModel', [x0, x1], [y00, y0],
                                       [formula_y00, formula_y0])
myStudy.add(model)

# Sobol ##
analysis = persalys.SobolAnalysis('aSobol', model)
analysis.setMaximumCalls(1000)
analysis.setMaximumConfidenceIntervalLength(-1)
analysis.setMaximumElapsedTime(30)
analysis.setSeed(2)
analysis.setReplicationSize(250)
analysis.setBlockSize(4)
myStudy.add(analysis)
print(analysis)

analysis.run()

print("result=", analysis.getResult())

# Sobol ##
analysis2 = persalys.SobolAnalysis('aSobol2', model)
Example #3
0
myStudy.add(form_is)

# 3-c FORM ##
form = persalys.FORMAnalysis('FORM', limitState)
form.setOptimizationAlgorithm(optimAlgo)
myStudy.add(form)

# 3-d SORM ##
sorm = persalys.SORMAnalysis('SORM', limitState)
sorm.setOptimizationAlgorithm(optimAlgo)
myStudy.add(sorm)

# 4- sensitivity ##

# 4-a Sobol ##
sobol = persalys.SobolAnalysis('Sobol', model1)
sobol.setMaximumConfidenceIntervalLength(-1)
sobol.setMaximumElapsedTime(1000)
sobol.setMaximumCalls(20)
sobol.setReplicationSize(3)
sobol.setBlockSize(1)
sobol.setSeed(2)
sobol.setInterestVariables(['y0', 'y1'])
myStudy.add(sobol)

# 4-b SRC ##
src = persalys.SRCAnalysis('SRC', model1)
src.setSimulationsNumber(20)
src.setSeed(2)
src.setInterestVariables(['y0', 'y1'])
myStudy.add(src)