CalibrationAnalysis

class persalys.CalibrationAnalysis(*args)

Run a calibration analysis.

Parameters:

name : str

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

GetMethodNames() Get the list of available method names.
getBootStrapSize() Accessor to the bootstrap size used to sample the posterior distribution.
getCalibratedInputs() Inputs to calibrate accessor.
getClassName() Accessor to the object’s name.
getConfidenceIntervalLength() Confidence interval length accessor.
getErrorCovariance() Accessor to the output observations error covariance.
getErrorMessage() Error message accessor.
getFixedInputs() Fixed inputs accessor.
getId() Accessor to the object’s id.
getInterestVariables() Get the variables to analyse.
getMethodName() Accessor to the method name
getName() Accessor to the object’s name.
getObservations() Accessor to the data to be fitted.
getOptimizationAlgorithm() Accessor to the optimization algorithm used by non linear algorithms.
getPhysicalModel() Physical model accessor.
getPriorDistribution() Accessor to the prior distribution.
getPythonScript() Physical model accessor.
getResult() Result accessor.
getShadowedId() Accessor to the object’s shadowed id.
getVisibility() Accessor to the object’s visibility state.
getWarningMessage() Warning message accessor.
hasName() Test if the object is named.
hasValidResult() Whether the analysis has been run.
hasVisibleName() Test if the object has a distinguishable name.
isReliabilityAnalysis() Whether the analysis involves reliability.
isRunning() 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.
setConfidenceIntervalLength(arg2) 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.
__init__(*args)
static GetMethodNames()

Get the list of available method names.

Returns:

names : Description

List of available calibration method names.

getBootStrapSize()

Accessor to the bootstrap size used to sample the posterior distribution.

Returns:

size : int

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

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

The object class name (object.__class__.__name__).

getConfidenceIntervalLength()

Confidence interval length accessor.

Returns:

length : float

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.

getErrorMessage()

Error message accessor.

Returns:

message : str

Error message if the analysis failed

getFixedInputs()

Fixed inputs accessor.

Returns:

inputs : openturns.PointWithDescription

Fixed input names and values

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getInterestVariables()

Get the variables to analyse.

Returns:

variablesNames : sequence of str

Names of the variables to analyse

getMethodName()

Accessor to the method name

Returns:

method : str

Method name. Default is ‘LeastSquaresLinear’. Use GetMethodNames() to list available names.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getObservations()

Accessor to the data to be fitted.

Returns:

data : Sample

The data to be fitted.

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.

getPhysicalModel()

Physical model accessor.

Returns:

model : PhysicalModel

Physical model

getPriorDistribution()

Accessor to the prior distribution.

Returns:

distribution : openturns.Distribution

Prior distribution

getPythonScript()

Physical model accessor.

Returns:

script : str

Python script to replay the analysis

getResult()

Result accessor.

Returns:

result : CalibrationAnalysisResult

Result

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

getWarningMessage()

Warning message accessor.

Returns:

message : str

Warning message which can appear during the analysis computation

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasValidResult()

Whether the analysis has been run.

Returns:

hasValidResult : bool

Whether the analysis has already been run

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

True if the name is not empty and not the default one.

isReliabilityAnalysis()

Whether the analysis involves reliability.

Returns:

isReliabilityAnalysis : bool

Whether the analysis involves a reliability analysis

isRunning()

Whether the analysis is running.

Returns:

isRunning : bool

Whether the analysis is running

run()

Launch the analysis.

setBootStrapSize(arg2)

Accessor to the bootstrap size used to sample the posterior distribution.

Parameters:

size : int

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:

calibratedInput : sequence 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

fixedInputs : sequence of str, optional

Names of the input variables to fix

values : sequence of float, optional

Values of the fixed inputs

setConfidenceIntervalLength(arg2)

Confidence interval length accessor.

Parameters:

length : float

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.

setInterestVariables(variablesNames)

Set the variables to analyse.

Parameters:

variablesNames : sequence of str

Names of the variables to analyse

setMethodName(name)

Accessor to the method name

Parameters:

method : str

Method name. Default is ‘LeastSquaresLinear’. Use GetMethodNames() to list available names.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

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.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.