Skip to content

[codex] Restore legacy analysis result fields#38

Merged
Arcadia-1 merged 1 commit into
mainfrom
codex/fix-api-contract-mismatches
Jun 3, 2026
Merged

[codex] Restore legacy analysis result fields#38
Arcadia-1 merged 1 commit into
mainfrom
codex/fix-api-contract-mismatches

Conversation

@Arcadia-1

Copy link
Copy Markdown
Owner

Summary

  • Add legacy spectrum metric aliases such as sndr_db, sfdr_db, and noise_floor_db while preserving the current *_dbc / *_dbfs keys.
  • Add fitted_sine to analyze_error_phase_plane() results as a compatibility field for older callers.
  • Make compute_spectrum() return undefined distortion metrics as nan instead of raising ZeroDivisionError when the input has no signal peak.

Issue coverage

Partially addresses #28.

This resolves the low-risk compatibility/result-field failures and the zero-signal spectrum crash. The remaining #28 failures are still intentionally left open:

  • calibration numeric tolerance/weight-recovery assertions need algorithm or test-contract review;
  • test_verify_spec_plot_phase.py expects older tuple returns from polar APIs, while the current documented API returns dictionaries.

Validation

  • MPLBACKEND=Agg uv run --with pytest pytest tests/unit/calibration/test_verify_estimate_frequencies.py::test_freq_estimation_shuffled -q -> 1 passed
  • MPLBACKEND=Agg uv run --with pytest pytest tests/unit/calibration/test_verify_calibration_lite.py::test_calibration_lite tests/unit/aout/test_analyze_error_phase_plane.py::test_analyze_error_phase_plane_basic tests/unit/aout/test_verify_spec_plot.py tests/unit/fundamentals/test_nsd_snr_conversions.py tests/unit/fundamentals/test_verify_alias.py tests/unit/test_cap2weight.py -q -> 20 passed
  • MPLBACKEND=Agg uv run --with pytest pytest tests/unit/models/ tests/unit/spectrum/ -q -> 581 passed
  • git diff --check

A broader #28 representative run still has 5 known failures after this patch, matching the remaining issue scope described above.

@Arcadia-1 Arcadia-1 marked this pull request as ready for review June 3, 2026 12:51
@Arcadia-1 Arcadia-1 merged commit 474db16 into main Jun 3, 2026
1 check passed
@Arcadia-1 Arcadia-1 deleted the codex/fix-api-contract-mismatches branch June 3, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant