Align sine fit comparison fixture#91
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_sinfit.run_sinfitMATLAB reference outputs forsinewave_noise_200uV.sinfit's refinement budget explicitly (max_iterations=100,tolerance=1e-12) while leaving the publicfit_sine_4paramdefaults unchanged.Rationale
This is a compare-fixture/policy alignment, not a core sine-fit algorithm change. MATLAB
run_sinfit.mcallssinfit(read_data), whose defaultniteris 100 andtolis 1e-12. Python's public default intentionally remains lighter (max_iterations=1), but the MATLAB parity fixture should exercise the same refinement budget as MATLAB.The previous compare test looked for
test_sinfit, while the MATLAB runner andrun_all_comparisons.pyuserun_sinfit, so the comparison failed before reaching numeric parity.Experiment
Dataset:
reference_dataset/sinewave_noise_200uV.csvDefault Python fixture vs MATLAB reference:
freqmax abs diff:2.30204744156e-13magmax abs diff:4.28363233773e-10dcmax abs diff:1.9206858326e-14phimax abs diff:2.93023383335e-10data_fitmax abs diff:4.76205318234e-10False,n_iterations=1, emits RuntimeWarningMATLAB-compatible fixture (
max_iterations=100,tolerance=1e-12) vs MATLAB reference:freqmax abs diff:2.4302782009e-13magmax abs diff:2.22044604925e-16dcmax abs diff:9.99200722163e-16phimax abs diff:8.4354745411e-13data_fitmax abs diff:7.06010805374e-11True,n_iterations=2, no warningTests
uv run --with pytest pytest tests/integration/test_sine_fit.py -q --artifact-root E:/.tmp_artifacts/sinfit-refinement-policyuv run --with pytest pytest tests/compare/test_compare_sine_fit.py -q --comparison-output-root E:/.tmp_artifacts/sinfit-refinement-policy/test_outputuv run --with pytest pytest tests/unit/fundamentals/test_verify_fit_sine_4param.py -quv run --with pytest pytest tests/unit/aout/test_error_fit_options.py -qgit diff --check