Skip to content

Comments

GSoC: Standardize tolerance levels for TestBlackBodySimpleSource#3439

Open
abhayrajjais01 wants to merge 2 commits intotardis-sn:masterfrom
abhayrajjais01:gsoc/standardize-blackbody-tolerances
Open

GSoC: Standardize tolerance levels for TestBlackBodySimpleSource#3439
abhayrajjais01 wants to merge 2 commits intotardis-sn:masterfrom
abhayrajjais01:gsoc/standardize-blackbody-tolerances

Conversation

@abhayrajjais01
Copy link

📝 Description

Type: 🧹 Refactor

Summary:
This PR standardizes the tolerance levels in TestBlackBodySimpleSource and TestBlackBodySimpleSourceRel by making the implicit default tolerance explicit. It introduces a module-level constant RELATIVE_TOLERANCE_BLACKBODY = 1e-7 and updates all assert_allclose calls to use atol=0 and rtol=RELATIVE_TOLERANCE_BLACKBODY.

Why this matters

Previously, all 8 test assertions used numpy.testing.assert_allclose() without explicit tolerance parameters, relying on numpy's default rtol=1e-7. Making tolerances explicit is the first step toward standardizing them across the codebase, as seen in other modules like test_sdec_plot.py.

Current Tolerance Landscape (Context)

I analyzed the current state of tolerances across the codebase to inform this change:

Module Tolerance File
BlackBody Sources rtol=1e-7 (explicit) test_blackbody_sources.py
SDEC Plot rtol=1e-12 test_sdec_plot.py
LIV Plot rtol=1e-12 test_liv_plot.py
Monte Carlo Loop rtol=1e-13 test_montecarlo_main_loop.py
Continuum rtol=1e-13 test_continuum.py

Future Work

  • Identify if 1e-7 can be tightened to match the 1e-12 standard used in visualization tests.
  • Standardize other transport modules (test_montecarlo_main_loop.py, test_continuum.py) to use module-level constants.

🚦 Testing

  • Verified syntax correctness with ast.parse().
  • Verified that the new constant RELATIVE_TOLERANCE_BLACKBODY is correctly applied to all 8 assertions.
  • Existing tests should pass as the tolerance value 1e-7 matches the previous implicit default.

☑️ Checklist

  • I requested two reviewers for this pull request
  • I have disclosed AI/LLM usage (see below)

AI/LLM Disclosure

  • AI Tool Used: Google Gemini 2.0 Flash (via Antigravity agent)
  • Usage: Assisted in analyzing the codebase to identify implicit tolerances
  • Verification: I have personally reviewed all code changes and verified they are correct and follow TARDIS standards.

Copy link
Contributor

@tardis-bot tardis-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Welcome @abhayrajjais01! Thank you for your first contribution to this repository!

If you are applying to GSoC, please read our AI Usage Policy and our PR checklist.

Please mark the pull request as draft if you are not ready for review yet or if there are things you will be adding.

@tardis-bot
Copy link
Contributor

tardis-bot commented Feb 17, 2026

*beep* *bop*
Hi human,
I ran ruff on the latest commit (3682b34).
Here are the outputs produced.
Results can also be downloaded as artifacts here.
Summarised output:

Details
538	    	syntax-error
1	W291	trailing-whitespace
Found 539 errors.

Complete output(might be large):

Details
All checks passed!

@abhayrajjais01
Copy link
Author

hii @atharva-2001
i have fixed the failing tests, let me know if you want me to do any further changes

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.

2 participants