Numerical reports and failure diagnostics#
The decomposition, harmonic-convergence, and interaction-convergence results provide compact and detailed reports alongside machine-readable metadata. The numerical calculations and their validation rules are independent of the terminal formatter.
Reporting interface#
print(decomposition.report())
print(hcal.report())
print(ical.report())
print(hcal.report(level="full"))
print(ical.report(level="full"))
decomposition_metadata = decomposition.to_dict()
harmonic_metadata = hcal.to_dict()
interaction_metadata = ical.to_dict()
report(level="summary") is the default and avoids printing large search
histories. report(level="full") records the available numerical settings,
measured acceptance criteria, and method-specific diagnostics. Save the
structured records when the complete refinement history is needed.
converged refers to the documented internal numerical criteria. It does
not imply independently established accuracy of the original input field
or agreement with an unknown exact result.
Failure handling#
Expected failures from parameter searches can carry a structured diagnostic:
from quartic2d import ConvergenceError
try:
hcal = HarmonicTransform.converge_parameters(decomposition)
except ConvergenceError as exc:
print(exc)
print(exc.report.format(level="full"))
evidence = exc.report.to_dict()
The default error text states what did not meet the requested criterion,
measured values when known, and an actionable location such as
PolarDecomposition(Nr=...) or
Interaction.converge_parameters(subdivisions=...). A failure report can
also identify situations in which there is insufficient evidence to diagnose
the root cause.
- class quartic2d.ConvergenceError(report)#
Failed convergence search, carrying all available numerical evidence.
- Parameters:
report (ConvergenceFailureReport)
- class quartic2d.ConvergenceFailureReport(code, stage, explanation, observed=<factory>, requested=<factory>, limiting_harmonics=(), actions=(), evidence=<factory>)#
Structured information retained when a numerical criterion is not met.
- Parameters:
code (str)
stage (str)
explanation (str)
observed (Mapping[str, Any])
requested (Mapping[str, Any])
limiting_harmonics (tuple[int, ...])
actions (tuple[ConvergenceAction, ...])
evidence (Mapping[str, Any])
- class quartic2d.ConvergenceAction(location, parameter, instruction)#
A location-specific, evidence-dependent suggestion.
- Parameters:
location (str)
parameter (str)
instruction (str)
- class quartic2d.ProgressEvent(stage, status, parameters=<factory>, completed=None, total=None)#
Lightweight event emitted during opt-in convergence calibration.
- Parameters:
stage (str)
status (str)
parameters (Mapping[str, Any])
completed (int | None)
total (int | None)
Progress and provenance#
The expensive calibration methods accept an optional progress=callback
for structured events. The default is quiet. They also support
provenance={...} for user-supplied physical units, model descriptions, and
other reproducibility metadata. A callable interaction kernel cannot be
reliably reconstructed from its Python identity, so record its mathematical
definition and parameters explicitly when archiving calculations.