Skip to content

gds_analysis.psuu.checks

Parameter-space compatibility checks using the GDS Finding pattern.

PSUU verification checks following the GDS Finding pattern.

Requires gds-framework to be installed. All gds-framework imports are deferred to function bodies so that importing this module never fails when gds-framework is absent.

check_parameter_space_compatibility(space, schema)

PSUU-001: Swept parameter space is compatible with declared theta.

Verifies that all swept parameters exist in the schema and that sweep bounds respect declared TypeDef constraints and ParameterDef bounds.

Returns a list of :class:~gds.verification.findings.Finding.

Source code in packages/gds-analysis/gds_analysis/psuu/checks.py
def check_parameter_space_compatibility(
    space: ParameterSpace, schema: ParameterSchema
) -> list[Finding]:
    """PSUU-001: Swept parameter space is compatible with declared theta.

    Verifies that all swept parameters exist in the schema and that
    sweep bounds respect declared TypeDef constraints and ParameterDef
    bounds.

    Returns a list of :class:`~gds.verification.findings.Finding`.
    """
    from gds.verification.findings import Finding, Severity

    violations = space.validate_against_schema(schema)
    findings: list[Finding] = []

    for v in violations:
        severity = (
            Severity.WARNING
            if v.violation_type == "missing_from_schema"
            else Severity.ERROR
        )
        findings.append(
            Finding(
                check_id="PSUU-001",
                severity=severity,
                message=v.message,
                source_elements=[v.param],
                passed=False,
            )
        )

    if not findings:
        findings.append(
            Finding(
                check_id="PSUU-001",
                severity=Severity.INFO,
                message="Parameter space is compatible with declared schema.",
                source_elements=list(space.params.keys()),
                passed=True,
            )
        )

    return findings