Skip to content

Parameter

abc

Abstract base class for parameters.

ParameterABC

Bases: ModuleABC

Abstract base class for parameters.

sample() abstractmethod

Sample a value from the parameter.

Returns:

Type Description
Float64NDArray

A sampled value from the parameter.

Source code in src/flepimop2/parameter/abc/__init__.py
17
18
19
20
21
22
23
24
@abstractmethod
def sample(self) -> Float64NDArray:
    """Sample a value from the parameter.

    Returns:
        A sampled value from the parameter.
    """
    raise NotImplementedError

build(config)

Build a ParameterABC from a configuration dictionary.

Parameters:

Name Type Description Default
config dict[str, Any] | ModuleModel

Configuration dictionary or a ModuleModel instance to construct the parameter from.

required

Returns:

Type Description
ParameterABC

The constructed parameter instance.

Source code in src/flepimop2/parameter/abc/__init__.py
27
28
29
30
31
32
33
34
35
36
37
38
def build(config: dict[str, Any] | ModuleModel) -> ParameterABC:
    """Build a `ParameterABC` from a configuration dictionary.

    Args:
        config: Configuration dictionary or a `ModuleModel` instance to construct the
            parameter from.

    Returns:
        The constructed parameter instance.

    """
    return _build(config, "parameter", "flepimop2.parameter.wrapper", ParameterABC)  # type: ignore[type-abstract]

fixed

Fixed parameter implementation.

FixedParameter

Bases: ModuleModel, ParameterABC

Parameter with a fixed value.

Examples:

>>> from flepimop2.parameter.fixed import FixedParameter
>>> param = FixedParameter(value=42.0)
>>> param.sample()
array([42.])
sample()

Return the fixed value of the parameter.

Returns:

Type Description
Float64NDArray

The fixed numeric value of the parameter.

Source code in src/flepimop2/parameter/fixed/__init__.py
29
30
31
32
33
34
35
36
def sample(self) -> Float64NDArray:
    """
    Return the fixed value of the parameter.

    Returns:
        The fixed numeric value of the parameter.
    """
    return np.array([self.value], dtype=np.float64)