Skip to content

incremental

IncrementalEnvironment()

Bases: TransformedObservable, Stepable, Iterable[DataFrame]

Base class for incremental environments.

Incremental environments are environments that can be advanced by a step and provide a stream of data. The data can be observed at each step.

Initialize the incremental environment.

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

collect(n=None, *, progress_bar=True)

Collect data from the environment.

Parameters:

Name Type Description Default
n int | None

Number of steps to collect. If None, all steps are collected.

None
progress_bar bool | dict[str, Any]

Whether to show a progress bar. If a dictionary is provided, it will be passed to the progress bar.

True

Returns:

Type Description
Dataset

The collected dataset.

Source code in src/flowcean/core/environment/incremental.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def collect(
    self,
    n: int | None = None,
    *,
    progress_bar: bool | dict[str, Any] = True,
) -> Dataset:
    """Collect data from the environment.

    Args:
        n: Number of steps to collect. If None, all steps are collected.
        progress_bar: Whether to show a progress bar. If a dictionary is
            provided, it will be passed to the progress bar.

    Returns:
        The collected dataset.
    """
    from flowcean.environments.dataset import collect

    return collect(self, n, progress_bar=progress_bar)

num_steps()

Return the number of steps in the environment.

Returns:

Type Description
int | None

The number of steps in the environment, or None if the number of

int | None

steps is unknown.

Source code in src/flowcean/core/environment/incremental.py
62
63
64
65
66
67
68
69
def num_steps(self) -> int | None:
    """Return the number of steps in the environment.

    Returns:
        The number of steps in the environment, or None if the number of
        steps is unknown.
    """
    return None