Skip to content

observable

Observable

Bases: ABC

Base class for observations.

observe() abstractmethod

Observe and return the observation.

Source code in src/flowcean/core/environment/observable.py
14
15
16
@abstractmethod
def observe(self) -> Observation:
    """Observe and return the observation."""

TransformedObservable()

Bases: Observable[DataFrame]

Base class for observations that carry a transform.

Attributes:

Name Type Description
transform Transform

Transform

Initialize the observable.

Source code in src/flowcean/core/environment/observable.py
28
29
30
31
def __init__(self) -> None:
    """Initialize the observable."""
    super().__init__()
    self.transform = Identity()

with_transform(transform)

Append a transform to the observation.

Parameters:

Name Type Description Default
transform Transform

Transform to append.

required

Returns:

Type Description
Self

This observable with the appended transform.

Source code in src/flowcean/core/environment/observable.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def with_transform(
    self,
    transform: Transform,
) -> Self:
    """Append a transform to the observation.

    Args:
        transform: Transform to append.

    Returns:
        This observable with the appended transform.
    """
    self.transform = self.transform.chain(transform)
    return self

__or__(transform)

Shortcut for with_transform.

Source code in src/flowcean/core/environment/observable.py
62
63
64
65
66
67
def __or__(
    self,
    transform: Transform,
) -> Self:
    """Shortcut for `with_transform`."""
    return self.with_transform(transform)