random_events.interval#
Classes#
Enumerates the possible bounds for an interval. |
|
A simple interval. |
|
Represents an interval. |
Functions#
|
Creates an open interval. |
|
Creates a closed interval. |
|
Creates an open-closed interval. |
|
Creates a closed-open interval. |
|
Creates a singleton interval. |
|
Creates the set of real numbers. |
Module Contents#
- class random_events.interval.Bound#
Bases:
enum.IntEnumEnumerates the possible bounds for an interval.
- CLOSED = 0#
Represents a closed bound, i. e. the element is included from the interval.
- OPEN = 1#
Represents an open bound, i. e. the element is excluded in the interval.
- class random_events.interval.SimpleInterval(lower: float = 0, upper: float = 0, left: Bound = Bound.OPEN, right: Bound = Bound.OPEN)#
Bases:
random_events.sigma_algebra.AbstractSimpleSetA simple interval. A simple interval is the convex hull of two points.
- _cpp_object: random_events_lib.SimpleInterval#
The C++ object that this class wraps.
- property lower: float#
- Returns:
The lower bound of the interval.
- property upper: float#
- Returns:
The upper bound of the interval.
- classmethod _from_cpp(cpp_object: random_events_lib.SimpleInterval) typing_extensions.Self#
Create a new instance of this class from a C++ object.
This method should also add fields that are python only to the instance that is created. This cannot be a class method since the values of the python-only fields are instance-specific.
- is_singleton() bool#
# TODO: fix this when random_events_lib is fixed :return: True if the interval is a singleton (contains only one value), False otherwise.
- contains(item: float) bool#
Check if this set contains an item. :param item: The item to check :return: Rather if the item is in the set or not
- non_empty_to_string() str#
- Returns:
A string representation of this set if it is not empty.
- to_json() Dict[str, Any]#
- classmethod _from_json(data: Dict[str, Any]) typing_extensions.Self#
Create a variable from a json dict. This method is called from the from_json method after the correct subclass is determined and should be overwritten by the respective subclass.
- Parameters:
data – The json dict
- Returns:
The deserialized object
- center() float#
- Returns:
The center point of the interval
- contained_integers() typing_extensions.Iterable[int]#
- Returns:
Yield integers contained in the interval
- __deepcopy__()#
- class random_events.interval.Interval(*simple_sets)#
Bases:
random_events.sigma_algebra.AbstractCompositeSetRepresents an interval.
An interval is a union of simple intervals.
A simplified interval is an interval where adjacent simple intervals are merged.
- _cpp_object: random_events_lib.Interval#
The C++ object that this class wraps.
- simple_set_example#
An example of a simple set that is used to create new simple sets. Fields that are python only are read from this instance when reading from cpp.
- classmethod _from_cpp(cpp_object: random_events_lib.Interval) typing_extensions.Self#
Create a new instance of this class from a C++ object.
This method should also add fields that are python only to the instance that is created. This cannot be a class method since the values of the python-only fields are instance-specific.
- is_singleton()#
- Returns:
True if the interval is a singleton (contains only one value), False otherwise.
- contained_integers() typing_extensions.Iterable[int]#
- Returns:
Yield integers contained in the interval
- random_events.interval.open(left: float, right: float) Interval#
Creates an open interval.
- Parameters:
left – The left bound of the interval.
right – The right bound of the interval.
- Returns:
The open interval.
- random_events.interval.closed(left: float, right: float) Interval#
Creates a closed interval.
- Parameters:
left – The left bound of the interval.
right – The right bound of the interval.
- Returns:
The closed interval.
- random_events.interval.open_closed(left: float, right: float) Interval#
Creates an open-closed interval.
- Parameters:
left – The left bound of the interval.
right – The right bound of the interval.
- Returns:
The open-closed interval.
- random_events.interval.closed_open(left: float, right: float) Interval#
Creates a closed-open interval.
- Parameters:
left – The left bound of the interval.
right – The right bound of the interval.
- Returns:
The closed-open interval.