Skip to content

domain

Domain(feature_name)

Bases: ABC

An abstract base class for describing the value domain for a feature.

Initialize the domain.

Parameters:

Name Type Description Default
feature_name str

The name of the feature the domain belongs to.

required
Source code in src/flowcean/core/tool/testing/domain/domain.py
 9
10
11
12
13
14
15
16
17
18
def __init__(
    self,
    feature_name: str,
) -> None:
    """Initialize the domain.

    Args:
        feature_name: The name of the feature the domain belongs to.
    """
    self.feature_name = feature_name

get_value() abstractmethod

Get a random value from the domain for the feature.

Source code in src/flowcean/core/tool/testing/domain/domain.py
20
21
22
@abstractmethod
def get_value(self) -> float:
    """Get a random value from the domain for the feature."""

__call__()

Get a random value from the domain for the feature.

Source code in src/flowcean/core/tool/testing/domain/domain.py
24
25
26
def __call__(self) -> float:
    """Get a random value from the domain for the feature."""
    return self.get_value()

set_seed(seed)

Set the seed for the random number generator.

Parameters:

Name Type Description Default
seed int

The seed to set.

required
Source code in src/flowcean/core/tool/testing/domain/domain.py
28
29
30
31
32
33
34
35
36
37
38
def set_seed(self, seed: int) -> None:  # noqa: ARG002
    """Set the seed for the random number generator.

    Args:
        seed: The seed to set.
    """
    # This is a no-op by default, as the base class does not maintain
    # any state related to random number generation.
    # Subclasses that maintain state can override this method to set
    # the seed for their random number generator.
    return