Observations¶
-
class
persalys.
Observations
(*args)¶ Create observations for variables of a model.
- Available constructors:
Observations(name, physicalModel, fileName, inputColumns, outputColumns, inputNames, outputNames)
Observations(name, inputSample, outputSample)
Parameters: name : str
Name
physicalModel :
PhysicalModel
Physical model
fileName : str
Name of a data file (.txt ot .csv) to load
inputColumns : sequence of int
Indices of columns of the input variables in file to consider
outputColumns : sequence of int
Indices of columns of the output variables in file to consider (optional)
inputNames : sequence of str
Names of the input variables (optional)
outputNames : sequence of str
Names of the output variables (optional)
inputSample :
openturns.Sample
Input sample (its description must be a list of input variable names)
outputSample :
openturns.Sample
Output sample (its description must be a list of output variable names)
Examples
>>> import openturns as ot >>> import persalys >>> ot.RandomGenerator.SetSeed(0)
Create the model:
>>> X0 = persalys.Input('X0') >>> X1 = persalys.Input('X1') >>> X2 = persalys.Input('X2') >>> X3 = persalys.Input('X3') >>> Y0 = persalys.Output('Y0') >>> Y1 = persalys.Output('Y1') >>> model = persalys.SymbolicPhysicalModel('aModelPhys', [X0, X1, X2, X3], [Y0, Y1], ['sin(X0)+8*X1', 'X2 + X3'])
Create the observations:
>>> filename = 'data.csv' >>> ot.Normal(8).getSample(10).exportToCSVFile(filename) >>> aObs = persalys.Observations('anObs', model, filename, [2, 7], [3], ['X0', 'X2'], ['Y1'])
Methods
getClassName
()Accessor to the object’s name. getFileName
()File name accessor. getId
()Accessor to the object’s id. getInputColumns
()Columns of the input variables accessor. getInputNames
()Names of the input variables accessor. getInputSample
()Input sample accessor. getListXMax
()List of input values. getListXMin
()List of input values. getName
()Accessor to the object’s name. getOutputColumns
()Columns of the ouput variables accessor. getOutputNames
()Names of the ouput variables accessor. getOutputSample
()Output sample accessor. getPhysicalModel
()Physical model accessor. getPythonScript
()Python script accessor. getSample
()Sample accessor. getSampleFromFile
()Sample from the file accessor. getShadowedId
()Accessor to the object’s shadowed id. getVisibility
()Accessor to the object’s visibility state. hasName
()Test if the object is named. hasPhysicalModel
()Whether it contains a physical model. hasVisibleName
()Test if the object has a distinguishable name. initialize
()Empty the input and output samples. isValid
()Whether the model is valid. setColumns
(inputColumns, inputNames, …)Columns and names of variables accessor. setFileName
(fileName)File name accessor. setInputSample
(sample)Input sample accessor. setName
(name)Accessor to the object’s name. setOutputSample
(sample)Output sample accessor. setShadowedId
(id)Accessor to the object’s shadowed id. setVisibility
(visible)Accessor to the object’s visibility state. -
__init__
(*args)¶
-
getClassName
()¶ Accessor to the object’s name.
Returns: class_name : str
The object class name (object.__class__.__name__).
-
getFileName
()¶ File name accessor.
Returns: fileName : str
Name of the file containing data
-
getId
()¶ Accessor to the object’s id.
Returns: id : int
Internal unique identifier.
-
getInputColumns
()¶ Columns of the input variables accessor.
Returns: columns :
openturns.Indices
Columns of the input variables
-
getInputNames
()¶ Names of the input variables accessor.
Returns: names :
openturns.Description
Names of the input variables
-
getInputSample
()¶ Input sample accessor.
Returns: sample :
openturns.Sample
Input sample
-
getListXMax
()¶ List of input values.
Returns: list : SampleCollection
List of input values
-
getListXMin
()¶ List of input values.
Returns: list : SampleCollection
List of input values
-
getName
()¶ Accessor to the object’s name.
Returns: name : str
The name of the object.
-
getOutputColumns
()¶ Columns of the ouput variables accessor.
Returns: columns :
openturns.Indices
Columns of the output variables
-
getOutputNames
()¶ Names of the ouput variables accessor.
Returns: names :
openturns.Description
Names of the output variables
-
getOutputSample
()¶ Output sample accessor.
Returns: sample :
openturns.Sample
Output sample
-
getPhysicalModel
()¶ Physical model accessor.
Returns: model :
PhysicalModel
Physical model
-
getPythonScript
()¶ Python script accessor.
Returns: script : str
Python script to rebuild the design of experiments
-
getSample
()¶ Sample accessor.
Returns: sample :
openturns.Sample
Input sample and output sample
-
getSampleFromFile
()¶ Sample from the file accessor.
Returns: sample :
openturns.Sample
Sample from the file
-
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.
-
hasName
()¶ Test if the object is named.
Returns: hasName : bool
True if the name is not empty.
-
hasPhysicalModel
()¶ Whether it contains a physical model.
Returns: hasPhysicalModel : bool
Whether it contains a physical model
-
hasVisibleName
()¶ Test if the object has a distinguishable name.
Returns: hasVisibleName : bool
True if the name is not empty and not the default one.
-
initialize
()¶ Empty the input and output samples.
-
isValid
()¶ Whether the model is valid.
Returns: isValid : bool
Whether the model is valid
-
setColumns
(inputColumns, inputNames, outputColumns, outputNames)¶ Columns and names of variables accessor.
Parameters: inputColumns : sequence of int
Columns of input variables
inNames : sequence of str
Names of input variables
outputColumns : sequence of int, optional
Columns of output variables
outNames : sequence of str
Names of output variables
-
setFileName
(fileName)¶ File name accessor.
Parameters: fileName : str
Name of the file containing data
-
setInputSample
(sample)¶ Input sample accessor.
Parameters: sample :
openturns.Sample
Input sample
-
setName
(name)¶ Accessor to the object’s name.
Parameters: name : str
The name of the object.
-
setOutputSample
(sample)¶ Output sample accessor.
Parameters: sample :
openturns.Sample
Output sample
-
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.