SymbolicPhysicalModel

class persalys.SymbolicPhysicalModel(*args)

Create a physical model defined by analytical formulas.

Parameters:

name : str

Name

inputs : sequence of Input

Input variables (optional)

outputs : sequence of Output

Output variables (optional)

formulas : sequence of str

List of analytical formulas between the inputs and the outputs (optional). The function is defined by ouputs = formulas(inputs).

Examples

>>> import openturns as ot
>>> import persalys
>>> R = persalys.Input('R', 0., ot.LogNormalMuSigma(300., 30., 0.).getDistribution(), 'Yield strength')
>>> F = persalys.Input('F', 0., ot.Normal(75000., 5000.), 'Traction load')
>>> G = persalys.Output('G', 'deviation')
>>> model = persalys.SymbolicPhysicalModel('myPhysicalModel', [R, F], [G], ['R-F/(pi_*100.0)'])
>>> y = model.getFunction()([300.0,75000.0])

Methods

addInput(input) Add an input variable.
addOutput(output) Add an output variable.
clearInputs() Remove all the input variables.
clearOutputs() Remove all the output variables.
getClassName() Accessor to the object’s name.
getCopula() Copula accessor.
getDistribution() Distribution accessor.
getFormula(outputName) Output formula accessor.
getFormulas() Formulas accessor.
getFunction(*args) Accessor to the underlying function.
getId() Accessor to the object’s id.
getInputByName(*args) Input variable accessor.
getInputDimension() Number of input variables accessor.
getInputNames() Input variable names accessor.
getInputRandomVector() Input random vector accessor.
getInputs() Input variables accessor.
getMeshModel() Mesh model accessor.
getName() Accessor to the object’s name.
getOutputByName(*args) Output variable accessor.
getOutputDimension() Number of output variables accessor.
getOutputNames() Output variable names accessor.
getOutputRandomVector(outputNames) Output random vector accessor.
getOutputs() Output variables accessor.
getPointToFieldFunction(*args) Accessor to the underlying function.
getPythonScript() Python script accessor.
getRestrictedFunction(*args) Accessor to the function restricted to its stochastic inputs.
getRestrictedPointToFieldFunction(outputNames) Accessor to the field function restricted to its stochastic inputs.
getSelectedOutputsNames() Accessor to the selected outputs names.
getShadowedId() Accessor to the object’s shadowed id.
getStochasticInputNames() Accessor to the names of the stochastic input variables.
getVisibility() Accessor to the object’s visibility state.
hasInputNamed(inputName) Check if an input has the given name.
hasMesh() Whether the model has a mesh.
hasName() Test if the object is named.
hasOutputNamed(outputName) Check if an output has the given name.
hasStochasticInputs() Whether it contains stochastic variables.
hasVisibleName() Test if the object has a distinguishable name.
isParallel() Whether the evaluations of the model are parallelized.
isValid() Whether it is valid.
removeInput(inputName) Remove an input variable.
removeOutput(outputName) Remove an output variable.
selectOutput(outputName, selected) Select output.
setCopula(inputNames, copula) Copula accessor.
setDistribution(inputName, distribution) Input distribution accessor.
setDistributionParametersType(inputName, …) Input distribution parameter type accessor.
setFiniteDifferenceStep(inputName, step) Finite difference step accessor.
setFormula(outputName, formula) Output formula accessor.
setFormulas(formulas) Formulas accessor.
setInputDescription(inputName, description) Input description accessor.
setInputName(inputName, newName) Input variable name accessor.
setInputStochastic(inputName, stoch) Whether the input variable is stochastic.
setInputValue(inputName, value) Input variable value accessor.
setInputs(inputs) Input variables accessor.
setMeshModel(meshModel) Mesh model accessor.
setName(name) Accessor to the object’s name.
setOutputDescription(outputName, description) Output description accessor.
setOutputName(outputName, newName) Output variable name accessor.
setOutputValue(outputName, value) Output variable name accessor.
setOutputs(outputs) Output variables accessor.
setParallel(flag) Whether the evaluations of the model are parallelized.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
addInput(input)

Add an input variable.

Parameters:

input : Input

New variable

addOutput(output)

Add an output variable.

Parameters:

output : Output

New variable

clearInputs()

Remove all the input variables.

clearOutputs()

Remove all the output variables.

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getCopula()

Copula accessor.

Parameters:

copula : openturns.Copula

The copula

getDistribution()

Distribution accessor.

Parameters:

Distribution : openturns.ComposedDistribution

The composed distribution (marginals and dependence)

getFormula(outputName)

Output formula accessor.

Parameters:

name : str

Variable name

Returns:

formula : str

Formula text

getFormulas()

Formulas accessor.

Returns:

formulas : openturns.Description

Output formulas

getFunction(*args)

Accessor to the underlying function.

Parameters:

outputNames : sequence of str

Names of the outputs to be evaluated (optional)

Returns:

function : openturns.Function

Function evaluating the outputs

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getInputByName(*args)

Input variable accessor.

Parameters:

name : str

Variable name

Returns:

input : Input

Input variable

getInputDimension()

Number of input variables accessor.

Returns:

dimension : int

Number of input variables

getInputNames()

Input variable names accessor.

Returns:

names : openturns.Description

Input variable names

getInputRandomVector()

Input random vector accessor.

Returns:

names : openturns.RandomVector

Input random vector

getInputs()

Input variables accessor.

Returns:

inputs : sequence of Input

Input variables

getMeshModel()

Mesh model accessor.

Returns:

mesh : MeshModel

Mesh model

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getOutputByName(*args)

Output variable accessor.

Parameters:

name : str

Variable name

Returns:

input : Output

Output variable

getOutputDimension()

Number of output variables accessor.

Returns:

dimension : int

Number of output variables

getOutputNames()

Output variable names accessor.

Returns:

names : openturns.Description

Ouput variable names

getOutputRandomVector(outputNames)

Output random vector accessor.

Returns:

names : openturns.RandomVector

Output random vector

getOutputs()

Output variables accessor.

Returns:

outputs : sequence of Output

Output variables

getPointToFieldFunction(*args)

Accessor to the underlying function.

Parameters:

outputNames : sequence of str

Names of the outputs to be evaluated (optional)

Returns:

function : openturns.PointToFieldFunction

Function evaluating the outputs along the mesh nodes

getPythonScript()

Python script accessor.

Returns:

script : str

Python script to replay the model

getRestrictedFunction(*args)

Accessor to the function restricted to its stochastic inputs.

Parameters:

outputNames : sequence of str

Output variables (optional)

Returns:

restricted : openturns.Function

Stochastic function

getRestrictedPointToFieldFunction(outputNames)

Accessor to the field function restricted to its stochastic inputs.

Parameters:

outputNames : sequence of str

Output variables (optional)

Returns:

restricted : openturns.PointToFieldFunction

Stochastic field function (for model with mesh)

getSelectedOutputsNames()

Accessor to the selected outputs names.

Returns:

names : openturns.Description

Selected outputs names

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getStochasticInputNames()

Accessor to the names of the stochastic input variables.

Returns:

names : openturns.Description

Names of the stochastic input variables

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasInputNamed(inputName)

Check if an input has the given name.

Parameters:

name : str

Variable name

Returns:

has : bool

Whether an input has the given name

hasMesh()

Whether the model has a mesh.

Returns:

hasMesh : bool

Whether the model has a mesh

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasOutputNamed(outputName)

Check if an output has the given name.

Parameters:

name : str

Variable name

Returns:

has : bool

Whether an output has the given name

hasStochasticInputs()

Whether it contains stochastic variables.

Returns:

has : bool

Whether it contains stochastic variables

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

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

isParallel()

Whether the evaluations of the model are parallelized.

Returns:

isParallel : bool

Whether the evaluations of the model are parallelized (available only for the Python model)

isValid()

Whether it is valid.

Returns:

isValid : bool

Whether it is valid

removeInput(inputName)

Remove an input variable.

Parameters:

name : str

Variable name

removeOutput(outputName)

Remove an output variable.

Parameters:

name : str

Variable name

selectOutput(outputName, selected)

Select output.

Parameters:

name : str

Output name

isSelected : bool

Whether it is selected

setCopula(inputNames, copula)

Copula accessor.

Parameters:

copula : openturns.Copula

The copula

setDistribution(inputName, distribution)

Input distribution accessor.

Parameters:

name : str

Variable name

distribution : openturns.Distribution

Variable distribution

setDistributionParametersType(inputName, distributionParametersType)

Input distribution parameter type accessor.

Parameters:

name : str

Variable name

parametersType : int

Distribution parameter type accessor

setFiniteDifferenceStep(inputName, step)

Finite difference step accessor.

Parameters:

name : str

Variable name

step : float

Finite difference step used to define the gradient of the model’s function

setFormula(outputName, formula)

Output formula accessor.

Parameters:

name : str

Variable name

formula : str

Formula text

setFormulas(formulas)

Formulas accessor.

Parameters:

formulas : sequence of str

Output formulas

setInputDescription(inputName, description)

Input description accessor.

Parameters:

name : str

Variable name

description : str

Description text

setInputName(inputName, newName)

Input variable name accessor.

Parameters:

name : str

Variable name

newName : str

New name

setInputStochastic(inputName, stoch)

Whether the input variable is stochastic.

Parameters:

name : str

Variable name

isStochastic : bool

Whether the input variable is stochastic

setInputValue(inputName, value)

Input variable value accessor.

Parameters:

name : str

Variable name

value : float

New value

setInputs(inputs)

Input variables accessor.

Parameters:

inputs : sequence of Input

Input variables

setMeshModel(meshModel)

Mesh model accessor.

Parameters:

mesh : MeshModel

Mesh model

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setOutputDescription(outputName, description)

Output description accessor.

Parameters:

name : str

Variable name

description : str

Description text

setOutputName(outputName, newName)

Output variable name accessor.

Parameters:

name : str

Variable name

newName : str

New name

setOutputValue(outputName, value)

Output variable name accessor.

Parameters:

name : str

Variable name

value : float

New value

setOutputs(outputs)

Output variables accessor.

Parameters:

outputs : sequence of Output

Output variables

setParallel(flag)

Whether the evaluations of the model are parallelized.

Parameters:

isParallel : bool

Whether the evaluations of the model are parallelized (available only for the Python model)

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.