Box

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

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

Box design of experiments.

Available constructor:
Box(levels)
Parameters:

levels : sequence of int or float

Sequence specifying the number of intermediate points on each direction which regularly discretize [0,1]. In direction i, the points number is levels[i]+2: the extreme bounds 0 and 1 are always taken.

Notes

Box is a stratified design of experiments enabling to create a points grid by regularly discretizing the unit pavement [0,1]^n with the number of intermediate points specified for each direction. The number of points generated is \prod_{i=1}^n (2+levels[i]).

In order to scale each direction and translate the grid structure onto the proper center, use the operator *= and += of NumericalSample.

Examples

>>> import openturns as ot
>>> levels = [4.0, 2.0]
>>> # Here : direction 1 will be discretized with 4 intermediate points
>>> # and direction 2 with 2 intermediate points
>>> myCenteredReductedGrid = ot.Box(levels)
>>> mySample = myCenteredReductedGrid.generate()
>>> # Translate the grid
>>> mySample+=4
>>> # Scale each direction
>>> mySample*=2

Methods

generate() Generate points according to the type of the experiment.
getCenter() Get the center of the stratified experiment.
getClassName() Accessor to the object’s name.
getId() Accessor to the object’s id.
getLevels() Get the levels of the stratified experiment.
getName() Accessor to the object’s name.
getShadowedId() Accessor to the object’s shadowed id.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setCenter(center) Set the center of the stratified experiment.
setLevels(levels) Set the levels of the stratified experiment.
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)
generate()

Generate points according to the type of the experiment.

Returns:

sample : Sample

The points which constitute the design of experiments. The sampling method is defined by the nature of the experiment.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> myExperiment = ot.Experiment(ot.MonteCarloExperiment(ot.Normal(2),5))
>>> print(myExperiment.generate())
    [ X0        X1        ]
0 : [  0.608202 -1.26617  ]
1 : [ -0.438266  1.20548  ]
2 : [ -2.18139   0.350042 ]
3 : [ -0.355007  1.43725  ]
4 : [  0.810668  0.793156 ]
getCenter()

Get the center of the stratified experiment.

Returns:

center : NumericalPoint

Sequence which has different meanings according to the nature of the stratified experiment: Axial, Composite, Factorial or Box (see corresponding documentation).

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getLevels()

Get the levels of the stratified experiment.

Returns:

levels : NumericalPoint

Sequence which has different meanings according to the nature of the stratified experiment: Axial, Composite, Factorial or Box (see corresponding documentation).

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.

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.

setCenter(center)

Set the center of the stratified experiment.

Parameters:

center : sequence of float

Sequence which has different meanings according to the nature of the stratified experiment: Axial, Composite, Factorial or Box (see corresponding documentation).

setLevels(levels)

Set the levels of the stratified experiment.

Parameters:

levels : sequence of float

Sequence which has different meanings according to the nature of the stratified experiment: Axial, Composite, Factorial or Box (see corresponding documentation).

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.