Skip to content

Add Mixing pydantic model #24

@TimothyWillard

Description

@TimothyWillard

To represent:

from op_system import normalize_rhs

spec = {
    "kind": "expr",
    "state": ["S", "I"],
    "equations": {"S": "-beta * S * I", "I": "beta * S * I - gamma * I"},
    "axes": [
        {"name": "space", "type": "continuous", "domain": {"lb": 0, "ub": 10}, "size": 5},
    ],
    "mixing": [
        {"name": "K", "axes": ["space", "space"], "form": "gaussian", "params": {"sigma": 1.5, "scale": 1.0}},
    ],
}

rhs = normalize_rhs(spec)

# Access normalized metadata
axes_meta = rhs.meta["axes"]        # List of normalized axis definitions
mixing_meta = rhs.meta["mixing"]    # List of normalized mixing kernels

Need a Mixing pydantic model that is a discriminated union over:

_ALLOWED_MIXING_FORMS: dict[str, tuple[str, ...]] = {
"erfc": ("scale", "sigma"),
"gaussian": ("scale", "sigma"),
"exponential": ("scale", "lambda"),
"gamma": ("scale", "k", "theta"),
"power_law": ("scale", "sigma", "p"),
"custom_value": (),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions