Skip to content

observable

Observable

Bases: Protocol

Protocol for observations.

observe() abstractmethod

Observe and return the observation.

Source code in src/flowcean/core/environment/observable.py
17
18
19
20
@abstractmethod
def observe(self) -> Data:
    """Observe and return the observation."""
    raise NotImplementedError

TransformedObservable()

Bases: Observable

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
32
33
34
35
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
66
67
68
69
70
71
def __or__(
    self,
    transform: Transform,
) -> Self:
    """Shortcut for `with_transform`."""
    return self.with_transform(transform)