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.
getBootStrapSize
(self)Accessor to the bootstrap size used to sample the posterior distribution.
getCalibratedInputs
(self)Inputs to calibrate accessor.
getClassName
(self)Accessor to the object’s name.
Confidence interval length accessor.
getErrorCovariance
(self)Accessor to the output observations error covariance.
getErrorMessage
(self)Error message accessor.
getFixedInputs
(self)Fixed inputs accessor.
getId
(self)Accessor to the object’s id.
getInterestVariables
(self)Get the variables to analyse.
getMethodName
(self)Accessor to the method name
getName
(self)Accessor to the object’s name.
getObservations
(self)Accessor to the data to be fitted.
getOptimizationAlgorithm
(self)Accessor to the optimization algorithm used by non linear algorithms.
getPhysicalModel
(self)Physical model accessor.
getPriorDistribution
(self)Accessor to the prior distribution.
getPythonScript
(self)Physical model accessor.
getResult
(self)Result accessor.
getShadowedId
(self)Accessor to the object’s shadowed id.
getVisibility
(self)Accessor to the object’s visibility state.
getWarningMessage
(self)Warning message accessor.
hasName
(self)Test if the object is named.
hasValidResult
(self)Whether the analysis has been run.
hasVisibleName
(self)Test if the object has a distinguishable name.
isReliabilityAnalysis
(self)Whether the analysis involves reliability.
isRunning
(self)Whether the analysis is running.
run
(self)Launch the analysis.
setBootStrapSize
(self, arg2)Accessor to the bootstrap size used to sample the posterior distribution.
setCalibratedInputs
(self, *args)Accessor to the inputs to calibrate and the fixed inputs.
setConfidenceIntervalLength
(self, arg2)Confidence interval length accessor.
setErrorCovariance
(self, matrix)Accessor to the output observations error covariance.
setInterestVariables
(self, variablesNames)Set the variables to analyse.
setMethodName
(self, name)Accessor to the method name
setName
(self, name)Accessor to the object’s name.
setOptimizationAlgorithm
(self, solver)Accessor to the optimization algorithm used by non linear algorithms.
setShadowedId
(self, id)Accessor to the object’s shadowed id.
setVisibility
(self, visible)Accessor to the object’s visibility state.
canBeLaunched
getElapsedTime
getParentObserver
-
__init__
(self, *args)¶ Initialize self. See help(type(self)) for accurate signature.
-
static
GetMethodNames
()¶ Get the list of available method names.
- Returns
- names
Description
List of available calibration method names.
- names
-
getBootStrapSize
(self)¶ 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
(self)¶ Inputs to calibrate accessor.
- Returns
- inputs
openturns.Description
Names of the input variables to calibrate
- inputs
-
getClassName
(self)¶ Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
-
getConfidenceIntervalLength
(self)¶ Confidence interval length accessor.
- Returns
- lengthfloat
Length of the confidence interval of the posterior distribution. It is set by default to 0.95.
-
getErrorCovariance
(self)¶ 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
(self)¶ Error message accessor.
- Returns
- messagestr
Error message if the analysis failed
-
getFixedInputs
(self)¶ Fixed inputs accessor.
- Returns
- inputs
openturns.PointWithDescription
Fixed input names and values
- inputs
-
getId
(self)¶ Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
-
getInterestVariables
(self)¶ Get the variables to analyse.
- Returns
- variablesNamessequence of str
Names of the variables to analyse
-
getMethodName
(self)¶ Accessor to the method name
- Returns
- methodstr
Method name. Default is ‘LeastSquaresLinear’. Use
GetMethodNames()
to list available names.
-
getName
(self)¶ Accessor to the object’s name.
- Returns
- namestr
The name of the object.
-
getOptimizationAlgorithm
(self)¶ 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
(self)¶ Physical model accessor.
- Returns
- model
PhysicalModel
Physical model
- model
-
getPriorDistribution
(self)¶ Accessor to the prior distribution.
- Returns
- distribution
openturns.Distribution
Prior distribution
- distribution
-
getPythonScript
(self)¶ Physical model accessor.
- Returns
- scriptstr
Python script to replay the analysis
-
getResult
(self)¶ Result accessor.
- Returns
- result
CalibrationAnalysisResult
Result
- result
-
getShadowedId
(self)¶ Accessor to the object’s shadowed id.
- Returns
- idint
Internal unique identifier.
-
getVisibility
(self)¶ Accessor to the object’s visibility state.
- Returns
- visiblebool
Visibility flag.
-
getWarningMessage
(self)¶ Warning message accessor.
- Returns
- messagestr
Warning message which can appear during the analysis computation
-
hasName
(self)¶ Test if the object is named.
- Returns
- hasNamebool
True if the name is not empty.
-
hasValidResult
(self)¶ Whether the analysis has been run.
- Returns
- hasValidResultbool
Whether the analysis has already been run
-
hasVisibleName
(self)¶ Test if the object has a distinguishable name.
- Returns
- hasVisibleNamebool
True if the name is not empty and not the default one.
-
isReliabilityAnalysis
(self)¶ Whether the analysis involves reliability.
- Returns
- isReliabilityAnalysisbool
Whether the analysis involves a reliability analysis
-
isRunning
(self)¶ Whether the analysis is running.
- Returns
- isRunningbool
Whether the analysis is running
-
run
(self)¶ Launch the analysis.
-
setBootStrapSize
(self, 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
(self, *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
(self, 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
(self, 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
(self, variablesNames)¶ Set the variables to analyse.
- Parameters
- variablesNamessequence of str
Names of the variables to analyse
-
setMethodName
(self, name)¶ Accessor to the method name
- Parameters
- methodstr
Method name. Default is ‘LeastSquaresLinear’. Use
GetMethodNames()
to list available names.
-
setName
(self, name)¶ Accessor to the object’s name.
- Parameters
- namestr
The name of the object.
-
setOptimizationAlgorithm
(self, 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
(self, id)¶ Accessor to the object’s shadowed id.
- Parameters
- idint
Internal unique identifier.
-
setVisibility
(self, visible)¶ Accessor to the object’s visibility state.
- Parameters
- visiblebool
Visibility flag.