CalibrationAnalysis¶
- class persalys.CalibrationAnalysis(*args)¶
Run a calibration analysis.
- Parameters:
- namestr
Name
- observations
Observations
Observations of at least one input and one output
Examples
>>> import openturns as ot >>> import persalys
Create the Chaboche model:
>>> R = persalys.Input('R', 700e6, ot.LogNormalMuSigma(750e6, 11e6).getDistribution(), 'Parameter R') >>> C = persalys.Input('C', 2500e6, ot.Normal(2750e6, 250e6), 'Parameter C') >>> gamma = persalys.Input('gam', 8., ot.Normal(10, 2), 'Parameter gamma') >>> dist_strain = ot.Uniform(0, 0.07) >>> strain = persalys.Input('strain', 0., dist_strain, 'Strain') >>> sigma = persalys.Output('sigma', 'Stress (Pa)')
>>> model = persalys.SymbolicPhysicalModel('model1', [R, C, gamma, strain], [sigma], ['R + C / gam * (1 - exp(-gam * strain))'])
Generate observations:
>>> nbObs = 100 >>> strainObs = dist_strain.getSample(nbObs) >>> strainObs.setDescription(['strain']) >>> stressSampleNoise = ot.Normal(0., 40.e6).getSample(nbObs) >>> stressSample = ot.ParametricFunction(model.getFunction(), [0, 1, 2], [750e6, 2750e6, 10.])(strainObs) >>> stressObs = stressSample + stressSampleNoise
>>> observations = persalys.Observations('obs1', model, strainObs, stressObs)
Process a calibration analysis:
>>> analysis = persalys.CalibrationAnalysis('myAnalysis', observations) >>> analysis.run()
Get the result:
>>> result = analysis.getResult() >>> thetaStar = result.getCalibrationResult().getParameterMAP()
Methods
Get the list of available method names.
Accessor to the bootstrap size used to sample the posterior distribution.
Inputs to calibrate accessor.
Accessor to the object's name.
Confidence interval length accessor.
Accessor to the output observations error covariance.
Error message accessor.
Fixed inputs accessor.
getId
()Accessor to the object's id.
Get the variables to analyse.
Accessor to the method name
getName
()Accessor to the object's name.
Accessor to the data to be fitted.
Accessor to the optimization algorithm used by non linear algorithms.
Physical model accessor.
Accessor to the prior distribution.
Physical model accessor.
Result accessor.
Accessor to the object's shadowed id.
Accessor to the object's visibility state.
Warning message accessor.
hasName
()Test if the object is named.
Whether the analysis has been run.
Test if the object has a distinguishable name.
Whether the analysis involves reliability.
Whether the analysis is running.
run
()Launch the analysis.
setBootStrapSize
(arg2)Accessor to the bootstrap size used to sample the posterior distribution.
setCalibratedInputs
(*args)Accessor to the inputs to calibrate and the fixed inputs.
Confidence interval length accessor.
setErrorCovariance
(matrix)Accessor to the output observations error covariance.
setInterestVariables
(variablesNames)Set the variables to analyse.
setMethodName
(name)Accessor to the method name
setName
(name)Accessor to the object's name.
setOptimizationAlgorithm
(solver)Accessor to the optimization algorithm used by non linear algorithms.
setShadowedId
(id)Accessor to the object's shadowed id.
setVisibility
(visible)Accessor to the object's visibility state.
canBeLaunched
getElapsedTime
getParentObserver
- __init__(*args)¶
- static GetMethodNames()¶
Get the list of available method names.
- Returns:
- names
Description
List of available calibration method names.
- names
- getBootStrapSize()¶
Accessor to the bootstrap size used to sample the posterior distribution.
- Returns:
- sizeint
Bootstrap size used to sample the posterior distribution by the non linear algorithms. A value of 0 means that no bootstrap has been done but a linear approximation has been used to get the posterior distribution, using the GaussianLinearCalibration or LinearLeastSquaresCalibration algorithm at the maximum a posteriori estimate. The value 1 is not allowed at this time.
- getCalibratedInputs()¶
Inputs to calibrate accessor.
- Returns:
- inputs
openturns.Description
Names of the input variables to calibrate
- inputs
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getConfidenceIntervalLength()¶
Confidence interval length accessor.
- Returns:
- lengthfloat
Length of the confidence interval of the posterior distribution. It is set by default to 0.95.
- getErrorCovariance()¶
Accessor to the output observations error covariance.
- Returns:
- matrix
openturns.CovarianceMatrix
The covariance matrix of the gaussian distribution of the output observations error. Used by the gaussian algorithms.
- matrix
- getErrorMessage()¶
Error message accessor.
- Returns:
- messagestr
Error message if the analysis failed
- getFixedInputs()¶
Fixed inputs accessor.
- Returns:
- inputs
openturns.PointWithDescription
Fixed input names and values
- inputs
- getId()¶
Accessor to the object’s id.
- Returns:
- idint
Internal unique identifier.
- getInterestVariables()¶
Get the variables to analyse.
- Returns:
- variablesNamessequence of str
Names of the variables to analyse
- getMethodName()¶
Accessor to the method name
- Returns:
- methodstr
Method name. Default is ‘LeastSquaresLinear’. Use
GetMethodNames()
to list available names.
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getOptimizationAlgorithm()¶
Accessor to the optimization algorithm used by non linear algorithms.
- Returns:
- algorithm
openturns.OptimizationAlgorithm
Optimization algorithm used by non linear algorithms. The optimization problem and the starting point are not taken into account.
- algorithm
- getPhysicalModel()¶
Physical model accessor.
- Returns:
- model
PhysicalModel
Physical model
- model
- getPriorDistribution()¶
Accessor to the prior distribution.
- Returns:
- distribution
openturns.Distribution
Prior distribution
- distribution
- getPythonScript()¶
Physical model accessor.
- Returns:
- scriptstr
Python script to replay the analysis
- getResult()¶
Result accessor.
- Returns:
- result
CalibrationAnalysisResult
Result
- result
- getShadowedId()¶
Accessor to the object’s shadowed id.
- Returns:
- idint
Internal unique identifier.
- getVisibility()¶
Accessor to the object’s visibility state.
- Returns:
- visiblebool
Visibility flag.
- getWarningMessage()¶
Warning message accessor.
- Returns:
- messagestr
Warning message which can appear during the analysis computation
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- hasValidResult()¶
Whether the analysis has been run.
- Returns:
- hasValidResultbool
Whether the analysis has already been run
- hasVisibleName()¶
Test if the object has a distinguishable name.
- Returns:
- hasVisibleNamebool
True if the name is not empty and not the default one.
- isReliabilityAnalysis()¶
Whether the analysis involves reliability.
- Returns:
- isReliabilityAnalysisbool
Whether the analysis involves a reliability analysis
- isRunning()¶
Whether the analysis is running.
- Returns:
- isRunningbool
Whether the analysis is running
- run()¶
Launch the analysis.
- setBootStrapSize(arg2)¶
Accessor to the bootstrap size used to sample the posterior distribution.
- Parameters:
- sizeint
Bootstrap size used to sample the posterior distribution by the non linear algorithms. A value of 0 means that no bootstrap has been done but a linear approximation has been used to get the posterior distribution, using the GaussianLinearCalibration or LinearLeastSquaresCalibration algorithm at the maximum a posteriori estimate. The value 1 is not allowed at this time.
- setCalibratedInputs(*args)¶
Accessor to the inputs to calibrate and the fixed inputs.
- Parameters:
- calibratedInputsequence of str
Names of the input variables to calibrate
- priorDistribution
openturns.Distribution
Prior distribution. Its dimension must equal to the number of variables to calibrate
- fixedInputssequence of str, optional
Names of the input variables to fix
- valuessequence of float, optional
Values of the fixed inputs
- setConfidenceIntervalLength(arg2)¶
Confidence interval length accessor.
- Parameters:
- lengthfloat
Length of the confidence interval of the posterior distribution. It is set by default to 0.95.
- setErrorCovariance(matrix)¶
Accessor to the output observations error covariance.
- Parameters:
- matrix
openturns.CovarianceMatrix
The covariance matrix of the gaussian distribution of the output observations error. Used by the gaussian algorithms.
- matrix
- setInterestVariables(variablesNames)¶
Set the variables to analyse.
- Parameters:
- variablesNamessequence of str
Names of the variables to analyse
- setMethodName(name)¶
Accessor to the method name
- Parameters:
- methodstr
Method name. Default is ‘LeastSquaresLinear’. Use
GetMethodNames()
to list available names.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setOptimizationAlgorithm(solver)¶
Accessor to the optimization algorithm used by non linear algorithms.
- Parameters:
- algorithm
openturns.OptimizationAlgorithm
Optimization algorithm used by non linear algorithms. The optimization problem and the starting point are not taken into account.
- algorithm
- setShadowedId(id)¶
Accessor to the object’s shadowed id.
- Parameters:
- idint
Internal unique identifier.
- setVisibility(visible)¶
Accessor to the object’s visibility state.
- Parameters:
- visiblebool
Visibility flag.