LevelSet

class LevelSet(*args)

Level set.

Available constructors:

LevelSet(dim=1)

LevelSet(function=ot.SymbolicFunction([‘x’], [‘1.0’]), operator=ot.LessOrEqual(), level=0.0)

Parameters
dimint, dim \geq 0

Dimension of the LevelSet.

functionFunction

A function such that: f: \Rset^{dim} \mapsto \Rset defining the LevelSet.

operatorComparisonOperator

Comparison operator against the level.

levelfloat

Level s defining the LevelSet.

Notes

A LevelSet is a Domain defined as follows:

\{ \vect{x} \in \Rset^{dim} \, | \, f(\vect{x}) \leq s \}

Examples

>>> import openturns as ot
>>> function = ot.SymbolicFunction(['x1', 'x2'], ['x1^4 + x2^4'])
>>> s = 1.0
>>> op = ot.LessOrEqual()
>>> levelSet = ot.LevelSet(function, op, s)

Methods

contains(self, \*args)

Check if the given point is inside of the domain.

getClassName(self)

Accessor to the object’s name.

getDimension(self)

Get the dimension of the domain.

getFunction(self)

Get the function defining the level set.

getId(self)

Accessor to the object’s id.

getLevel(self)

Get the level defining the level set.

getLowerBound(self)

Get the lower bound of the bounding box.

getName(self)

Accessor to the object’s name.

getOperator(self)

Operator accessor.

getShadowedId(self)

Accessor to the object’s shadowed id.

getUpperBound(self)

Get the upper bound of the bounding box.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

intersect(self, other)

Return the levelSet equals to the intersection between the LevelSet and another one.

join(self, other)

Return the levelSet equals to the union between the LevelSet and another one.

setFunction(self, function)

Set the function defining the level set.

setLevel(self, level)

Set the level defining the level set.

setLowerBound(self, bound)

Set the lower bound of the bounding box.

setName(self, name)

Accessor to the object’s name.

setOperator(self, op)

Operator accessor.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setUpperBound(self, bound)

Set the upper bound of the bounding box.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

contains(self, \*args)

Check if the given point is inside of the domain.

Parameters
pointsequence of float

Point with the same dimension as the current domain’s dimension.

Returns
isInsidebool

Flag telling whether the given point is inside of the domain.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

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

getDimension(self)

Get the dimension of the domain.

Returns
dimint

Dimension of the domain.

getFunction(self)

Get the function defining the level set.

Returns
functionFunction

A function such that: f: \Rset^{dim} \mapsto \Rset defining the LevelSet.

Examples

>>> import openturns as ot
>>> function = ot.SymbolicFunction(['x'], ['3*x-1'])
>>> levelSet = ot.LevelSet(function, ot.LessOrEqual(), 0.0)
>>> print(levelSet.getFunction().getEvaluation())
[x]->[3*x-1]
getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getLevel(self)

Get the level defining the level set.

Returns
levelfloat

Level s defining the LevelSet.

Examples

>>> import openturns as ot
>>> function = ot.SymbolicFunction(['x'], ['3*x-1'])
>>> levelSet = ot.LevelSet(function, ot.LessOrEqual(), 0.0)
>>> print(levelSet.getLevel())
0.0
getLowerBound(self)

Get the lower bound of the bounding box.

Returns
boundPoint

Lower bound of the bounding box of the level set. It allows to clip the level set.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOperator(self)

Operator accessor.

Returns
opComparisonOperator

Comparison operator against the level.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getUpperBound(self)

Get the upper bound of the bounding box.

Returns
boundPoint

Upper bound of the bounding box of the level set. It allows to clip the level set.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

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

intersect(self, other)

Return the levelSet equals to the intersection between the LevelSet and another one.

Parameters
otherLevelSet :

A LevelSet defined by (f_2, s_2).

Returns
levelSetLevelSet

levelSet equals to the intersection between the LevelSet and otherLevelSet i.e. levelSet is defined by: \{\vect{x} \in \Rset^{dim} | f(\vect{x}) \leq s \, \mbox{and} \, f_2(\vect{x}) \leq s_2\}.

Examples

>>> import openturns as ot
>>> # First level set
>>> function = ot.SymbolicFunction(['x'], ['3*x-1'])
>>> levelSet1 = ot.LevelSet(function, ot.LessOrEqual(), 0.5)
>>> # Second level set
>>> function = ot.SymbolicFunction(['x'], ['x'])
>>> levelSet2 = ot.LevelSet(function, ot.LessOrEqual(), 0.5)
>>> # Intersection between levelSet1 and levelSet2
>>> intersection = levelSet1.intersect(levelSet2)
>>> # Tests
>>> print([1.0] in intersection)
False
>>> print([0.25] in intersection)
True
join(self, other)

Return the levelSet equals to the union between the LevelSet and another one.

Parameters
otherLevelSet :

A LevelSet defined by (f_2, s_2).

Returns
levelSetLevelSet

levelSet equals to the union between the LevelSet and otherLevelSet i.e. levelSet is defined by: \{\vect{x} \in \Rset^{dim} | f(\vect{x}) \leq s \, \mbox{or} \, f_2(\vect{x}) \leq s_2\}.

Examples

>>> import openturns as ot
>>> # First level set
>>> function = ot.SymbolicFunction(['x'], ['3*x-1'])
>>> levelSet1 = ot.LevelSet(function, ot.LessOrEqual(), 0.0)
>>> # Second level set
>>> function = ot.SymbolicFunction(['x'], ['x'])
>>> levelSet2 = ot.LevelSet(function, ot.LessOrEqual(), 0.0)
>>> # Union between levelSet1 and levelSet2
>>> join = levelSet1.join(levelSet2)
>>> # Tests
>>> print([0.5] in join)
False
>>> print([0.25] in join)
True
setFunction(self, function)

Set the function defining the level set.

Parameters
functionFunction

A function such that: f: \Rset^{dim} \mapsto \Rset defining the LevelSet.

Examples

>>> import openturns as ot
>>> levelSet = ot.LevelSet()
>>> function = ot.SymbolicFunction(['x'], ['3*x-1'])
>>> levelSet.setFunction(function)
setLevel(self, level)

Set the level defining the level set.

Parameters
levelfloat

Level s defining the LevelSet.

Examples

>>> import openturns as ot
>>> levelSet = ot.LevelSet()
>>> levelSet.setLevel(3.0)
setLowerBound(self, bound)

Set the lower bound of the bounding box.

Parameters
boundsequence of floats

Lower bound of the bounding box of the level set. It allows to clip the level set.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setOperator(self, op)

Operator accessor.

Parameters
opComparisonOperator

Comparison operator against the level.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setUpperBound(self, bound)

Set the upper bound of the bounding box.

Parameters
boundsequence of floats

Upper bound of the bounding box of the level set. It allows to clip the level set.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.