Skip to content

made syntax to deal with parameter sub-dicts in lephare#84

Merged
raphaelshirley merged 3 commits into
mainfrom
issue/80/param_sub_dicts
Apr 1, 2026
Merged

made syntax to deal with parameter sub-dicts in lephare#84
raphaelshirley merged 3 commits into
mainfrom
issue/80/param_sub_dicts

Conversation

@eacharles

Copy link
Copy Markdown
Contributor

Problem & Solution Description (including issue #)

Code Quality

  • My code follows the code style of this project
  • I have written unit tests or justified all instances of #pragma: no cover; in the case of a bugfix, a new test that breaks as a result of the bug has been added
  • My code contains relevant comments and necessary documentation for future maintainers; the change is reflected in applicable demos/tutorials (with output cleared!) and added/updated docstrings use the NumPy docstring format
  • Any breaking changes, described above, are accompanied by backwards compatibility and deprecation warnings

#80

@codecov

codecov Bot commented Mar 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.45%. Comparing base (c88c610) to head (8f2fa33).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/rail/estimation/algos/lephare.py 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #84      +/-   ##
==========================================
+ Coverage   92.46%   93.45%   +0.98%     
==========================================
  Files           2        2              
  Lines         146      168      +22     
==========================================
+ Hits          135      157      +22     
  Misses         11       11              

☔ View full report in Codecov by Sentry.
📢 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.

msg="QSO config overrides.",
),
)
_add_sub_config(config_options, lsst_default_config, "lephare.")

@johannct johannct Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is there a risk of collision with the module itself : import lephare; lephare.XXX ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, this only affect the keys be which we refer to parameters. I.e., if making a stage interactively you could do

  param_dict = {'lephare.QSO_LIB':'LSST_QSO_BIN'}
  LephareInformer.make_stage(**param_dict)

Or in configuring a stage with yaml would do:

lephare_inform:
  lephare.ADAPT_BAND: '5'

The alternative would be to update the config parsing code so that it doesn't require changing the entire dict if a single parameter changes.

@johannct johannct mentioned this pull request Mar 19, 2026
4 tasks
)

star_default_config=dict(
LIB_ASCII="YES"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

to be revisited : LIB_ASCII set to YES on the 3 types of objects is likely not what we want for a default LSST config, if by default we mean "production ready". Same below lines 45 and 53

LIB_ASCII="YES",
MOD_EXTINC="0,1000",
EB_V="0.,0.1,0.2,0.3",
EXTINC_LAW="SB_calzetti.dat",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

to do : revisit choice for QSO.

Comment thread src/rail/estimation/algos/lephare.py Outdated
),
)
_add_sub_config(config_options, lsst_default_config, "lephare.")
_add_sub_config(config_options, star_default_config, "gal.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ptrfox "star.", not "gal."

Comment thread src/rail/estimation/algos/lephare.py Outdated

star_config = _get_sub_config(self.config, 'star.')
gal_config = _get_sub_config(self.config, 'gal.')
qso_config = _get_sub_config(self.config, 'gso.')

@johannct johannct Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

bug : prefix 'qso.' not 'gso.'

@johannct johannct self-requested a review March 20, 2026 12:23

@johannct johannct left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
The added benefit is that the defaults are moved outside of the functions needing them, cleaner and clearer.
My comments on revisiting defaults will be deferred to another issue/PR

@raphaelshirley raphaelshirley merged commit 5accd3b into main Apr 1, 2026
5 checks passed
@raphaelshirley raphaelshirley deleted the issue/80/param_sub_dicts branch April 1, 2026 12:14
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.

4 participants