Skip to content

Fix the convergence check being skipped when verbose=True - #21

Open
jacobdparker wants to merge 1 commit into
mainfrom
fix/mart-verbose-convergence
Open

Fix the convergence check being skipped when verbose=True#21
jacobdparker wants to merge 1 commit into
mainfrom
fix/mart-verbose-convergence

Conversation

@jacobdparker

Copy link
Copy Markdown

The convergence test in MartInverter.__call__ was an elif chained behind the verbose print statement:

if verbose:  # pragma: nocover
    print(f"merit: {merit}")

elif (merit_old - merit) < self.threshold_convergence:
    ...
    break

so any run with verbose output could never stop at the convergence threshold and always ran to num_iteration (with the max-iterations warning). Found while running MART inversions of the ESIS-I flight data, where verbose runs always burned the full iteration budget.

This splits the check into an independent if, and adds a regression test that inverts with verbose=True and asserts early convergence — the test fails on the previous code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HuYXL1BkWsWGAxYnpD8Kqz

The convergence test in MartInverter.__call__ was an elif chained behind
the verbose print statement, so any run with verbose output could never
stop at the convergence threshold and always ran to num_iteration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HuYXL1BkWsWGAxYnpD8Kqz
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2eb14d0) to head (d952619).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #21   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines          697       702    +5     
=========================================
+ Hits           697       702    +5     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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