Skip to content

base

Environment

Bases: Named, Protocol

Base class adding transform support.

append_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/base.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def append_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

observe()

Observe and return the observation.

Source code in src/flowcean/core/environment/base.py
46
47
48
def observe(self) -> Data:
    """Observe and return the observation."""
    return self.transform(self._observe())

__or__(transform)

Shortcut for with_transform.

Source code in src/flowcean/core/environment/base.py
50
51
52
53
54
55
56
@final
def __or__(
    self,
    transform: Transform,
) -> Self:
    """Shortcut for `with_transform`."""
    return self.append_transform(transform)