Skip to content

Support generalized extinction models (G23) by decoupling legacy fAs grid constraints - #867

Merged
karllark merged 10 commits into
BEAST-Fitting:masterfrom
galaxyumi:g23_fA_verification
Nov 3, 2026
Merged

karllark merged 10 commits into
BEAST-Fitting:masterfrom
galaxyumi:g23_fA_verification

Conversation

@galaxyumi

Copy link
Copy Markdown
Contributor

This PR updates the BEAST parameter verification and physics model generation pipeline to accommodate generalized monolithic dust extinction frameworks, specifically G23 model, which are critical for stretching extinction curves reliably into the JWST/NIRCam Long-Wavelength (LW) regimes (>3.33μm).

Historically, the codebase tightly coupled all grid validation and matrix calculations to legacy two-component mixture models (which rigidly require an fAs parameter grid triplet and separate ALaw/BLaw sub-classes). This PR breaks those hardcoded assumptions, introducing defensive programming practices that allow the BEAST to dynamically scale between classic mixture models and monolithic/generalized dust laws.

This PR addresses the second part of the Issue #866.

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.63%. Comparing base (8a608e1) to head (c7eb0bd).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
beast/physicsmodel/grid_and_prior_weights.py 66.66% 2 Missing ⚠️
beast/physicsmodel/creategrid.py 88.88% 1 Missing ⚠️
beast/tools/verify_beast_settings.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #867      +/-   ##
==========================================
- Coverage   39.48%   38.63%   -0.86%     
==========================================
  Files         110      110              
  Lines       10763    10625     -138     
==========================================
- Hits         4250     4105     -145     
- Misses       6513     6520       +7     

☔ 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.

@karllark karllark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good overall. Many thanks for this PR!

I do request the change to the verify code to make the code more general and avoid the failure case where the mixture model includes G23.

Comment thread beast/tools/verify_beast_settings.py Outdated
Comment on lines +209 to +213
if parameters_names[i] == "fAs":
ext_law = getattr(settings, "extLaw", "") or ""
law_name = getattr(ext_law, "name", ext_law)
if isinstance(law_name, str) and "G23" in law_name:
continue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens if I want no fA and an extinction model other than "G23"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about this code instead? Allows any model to be used as a non-mixture.

        if (param_ is not None):
            verify_one_input_format(
                param_,
                parameters_names[i],
                param_format[i],
                parameters_limits[i],
            )
        else:
            if parameters_names[i] == "fAs":
                print("fAs is None: extinction mixture model not requested.")
            else:
                raise ValueError(
                    parameters_names[i] + " is None: please provide a value."
                )

@karllark

karllark commented Nov 3, 2026

Copy link
Copy Markdown
Member

Merging. Will do a quick PR to disable this test and create an issue to track updating it.

@karllark
karllark merged commit ba190ee into BEAST-Fitting:master Nov 3, 2026
3 of 9 checks passed
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