Skip to content

Qa Network

Module: spectralbridge.qa.network.

Diagnostics for empirical sensor translations and translation networks.

These functions evaluate supplied predictions. They do not fit translation models and therefore cannot accidentally turn in-sample fits into validation evidence.

API glossary ยท Workflow / scientific context

Signatures and documentation below are collected from the current source. Advanced objects are not newly declared stable by inclusion here.

Audience: public. Also exported as spectralbridge.qa.translation_edge_metrics.

translation_edge_metrics

translation_edge_metrics(observed: ndarray, predicted: ndarray) -> dict[str, float | int | None]

Evaluate one sensor-to-sensor edge from paired held-out observations.

Parameters:

Name Type Description Default
observed ndarray

Paired measured/reference and predicted values in common units; nonfinite pairs are omitted and residuals are predicted minus observed.

required
predicted ndarray

Paired measured/reference and predicted values in common units; nonfinite pairs are omitted and residuals are predicted minus observed.

required

Returns:

Type Description
dict[str, float | int | None]

Paired residual metrics in the target units; high R-squared alone does not certify interchangeability.

See Also

spectralbridge.qa.metrics.reflectance_summary : Related source-derived API contract.

Audience: public. Also exported as spectralbridge.qa.grouped_residual_metrics.

grouped_residual_metrics

grouped_residual_metrics(observed: ndarray, predicted: ndarray, groups: Iterable[Any]) -> dict[str, Any]

Return residual metrics by an explicit validation block.

Parameters:

Name Type Description Default
observed ndarray

Paired measured/reference and predicted values in common units; nonfinite pairs are omitted and residuals are predicted minus observed.

required
predicted ndarray

Paired measured/reference and predicted values in common units; nonfinite pairs are omitted and residuals are predicted minus observed.

required
groups Iterable[Any]

Aligned independent-unit identifiers; keep repeated observations or parent-connected mixtures in the same group. None uses the function-specific row-based convention described in Notes.

required

Returns:

Type Description
dict[str, Any]

Explicit per-group residual summaries and an overall paired summary; the supplied group variable is not independently validated.

Raises:

Type Description
ValueError

If the supplied options, dimensions, support or provenance violate the input contract.

Notes

groups should identify held-out sites, dates, campaigns, or flightlines. The function reports, but does not invent, the blocking strategy.

See Also

spectralbridge.qa.metrics.reflectance_summary : Related source-derived API contract.

Audience: public. Also exported as spectralbridge.qa.path_consistency_metrics.

path_consistency_metrics

path_consistency_metrics(direct_prediction: ndarray, indirect_prediction: ndarray, *, observed_target: ndarray | None = None) -> dict[str, Any]

Compare a direct translation with a multi-edge translation path.

Parameters:

Name Type Description Default
direct_prediction ndarray

Matched target-sensor predictions from direct and multi-edge translation paths, in common units and row order.

required
indirect_prediction ndarray

Matched target-sensor predictions from direct and multi-edge translation paths, in common units and row order.

required
observed_target ndarray | None

Optional independently observed target values for residual summaries of each translation path.

None

Returns:

Type Description
dict[str, Any]

Direct-versus-indirect residual summary and optional each-path residuals against observed_target.

See Also

spectralbridge.qa.metrics.reflectance_summary : Related source-derived API contract.

Audience: public. Also exported as spectralbridge.qa.cycle_consistency_metrics.

cycle_consistency_metrics

cycle_consistency_metrics(starting_values: ndarray, cycled_values: ndarray) -> dict[str, float | int | None]

Measure drift after translating around a sensor cycle back to its start.

Parameters:

Name Type Description Default
starting_values ndarray

Matched values before and after a translation cycle, expressed on the starting sensor support and scale.

required
cycled_values ndarray

Matched values before and after a translation cycle, expressed on the starting sensor support and scale.

required

Returns:

Type Description
dict[str, float | int | None]

Residual drift metrics comparing returned-cycle values with starting values in their common units.

See Also

spectralbridge.qa.metrics.reflectance_summary : Related source-derived API contract.