ProcessSample

(Source code, png, hires.png, pdf)

../../_images/ProcessSample.png
class ProcessSample(*args)

Collection of fields.

Available constructors:

ProcessSample(mesh, K, d)

ProcessSample(K, field)

Parameters:

mesh : Mesh

The mesh shared by all the fields in the collection.

K : int

Number of fields in the collection.

d : int

Dimension of the values of the field.

field : Field

One field.

Notes

A ProcessSample stores a sample of fields. We note K the number of fields contained in the process sample and d the dimension of the values associated to each vertex of the common mesh \cM \in \Rset^n.

These fields can be generated by a stochastic process.

  • In the first usage, we fix the common mesh with mesh, the number of fields contained in the sample with K and the dimension of the values with d. The values of the fields are by default fixed to zero.
  • In the second usage, the collection of fields is filled with K copies of the given field field.

We note \vect{x}_i^k \in \Rset^d the value of the field k at the vertex i. We note N the number of vertices of \cM, with 0 \leq i \leq N-1 and 1 \leq k \leq K.

Examples

Create a bi dimensional mesh as a box:

>>> import openturns as ot
>>> myIndices = [10, 5]
>>> myMesher = ot.IntervalMesher(myIndices)
>>> lowerBound = [0.0, 0.0]
>>> upperBound = [2.0, 1.0]
>>> myInterval = ot.Interval(lowerBound, upperBound)
>>> myMesh = myMesher.build(myInterval)

Create a second order normal porcess of dimension 3:

>>> amplitude = [5]
>>> scale = [3, 3]
>>> model = ot.ExponentialModel(scale, amplitude)
>>> myProcess = ot.TemporalNormalProcess(model, myMesh)

Generate a sample of different fields:

>>> n = 10
>>> mySampleFields = myProcess.getSample(n)

Duplicate the same field:

>>> myField = myProcess.getRealization()
>>> n = 10
>>> mySampleFields2 = ot.ProcessSample(n, myField)

Methods

add(*args) Add a field to the collection.
computeMean() Compute the mean field of the collection of fields.
computeQuantilePerComponent(prob) Compute the temporal mean of the values of the fields.
computeSpatialMean() Compute the spatial mean of the values of the fields.
computeTemporalMean() Compute the temporal mean of the values of the fields.
drawMarginal([index]) Draw the selected field.
getClassName() Accessor to the object’s name.
getDimension() Get the dimension of the values of fields.
getId() Accessor to the object’s id.
getMarginal(*args)
getMesh() Get the mesh of the fields.
getName() Accessor to the object’s name.
getShadowedId() Accessor to the object’s shadowed id.
getSize() Get the size of the collection of fields.
getTimeGrid() Get the time grid of the fields.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
add(*args)

Add a field to the collection.

Parameters:

field : Field

A new field to add. This field shares the same mesh and the same dimension as the other fields of the collection.

computeMean()

Compute the mean field of the collection of fields.

Returns:

mean : Field

The mean field has the same dimension d and the same mesh as the fields contained in the collection. At each vertex of the mesh, we calculate the mean of the values at this vertex of the K fields contained in the process sample:

\forall i \in [0,N-1], \quad \dfrac{1}{K} \sum_{k=1}^K \vect{x}_i^k

computeQuantilePerComponent(prob)

Compute the temporal mean of the values of the fields.

Parameters:

p : float, 0 \leq p \leq 1

Order of the quantile.

Returns:

quantileField : Field

This field has the same size and the same dimension as the fields of the collection. At each vertex of the mesh, we estimate the component-wise quantile of order p, using the empirical quantile.

computeSpatialMean()

Compute the spatial mean of the values of the fields.

Returns:

spatialMean : NumericalSample

Its size is the number K of fields in the collection. Its dimension is d. The k numerical point is the spatial mean of the field k:

\forall k \in [1,K], \quad \dfrac{1}{N}\sum_{i=0}^{N-1} \vect{x}_i^k

computeTemporalMean()

Compute the temporal mean of the values of the fields.

Returns:

spatialMean : NumericalSample

Its size is the number K of fields in the collection. Its dimension is d. The k numerical point is the temporal mean of the field k:

\forall k \in [1,K], \quad \dfrac{1}{N}\sum_{i=0}^{N-1} \vect{x}_i^k

This method can be used only when the mesh can be interpreted as a regular grid.

drawMarginal(index=0)

Draw the selected field.

Parameters:

indice : int

Index of the field that is drawn in the graph.

Returns:

graph : Graph

The graph of the selected field using the interpolate method.

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getDimension()

Get the dimension of the values of fields.

Returns:

d : int

Dimension of the values of the fields.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getMesh()

Get the mesh of the fields.

Returns:

mesh : Mesh

The mesh shared by all the fields of the collection.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getSize()

Get the size of the collection of fields.

Returns:

K : int

Number of fields in the collection.

getTimeGrid()

Get the time grid of the fields.

Returns:

mesh : RegularGrid

The time grid shared by all the fields of the collection. Can be used only if the mesh can be interpreted as a regular time grid.

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.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

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

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

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.