Skip to content

Added NR yields, updated defaut yields treatment#357

Merged
cfuselli merged 13 commits into
mainfrom
update_nr_yields
Jan 29, 2026
Merged

Added NR yields, updated defaut yields treatment#357
cfuselli merged 13 commits into
mainfrom
update_nr_yields

Conversation

@WenzDaniel

@WenzDaniel WenzDaniel commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

What does the code in this PR do / what does it improve?

Adds the possibility to update NR yields of NESTv2. Makes default yield setting treatment more clear.

Also:

  • Updated default simulation configuration from sr1_dev to sr2_dev across test utilities and context definitions
  • Modified CI configuration to use environment variables for test configuration, supporting both sr1_dev (lowest dependencies) and sr2_dev (latest dependencies)

@cfuselli cfuselli 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 great thanks Daniel.
It will require us to update the configs to default to -1 now instead of a list of -1s (much better approach ofc).
Except for the one type looks very good.

Comment thread fuse/plugins/micro_physics/yields.py Outdated
@WenzDaniel WenzDaniel marked this pull request as ready for review October 21, 2025 07:25
@cfuselli cfuselli self-requested a review November 27, 2025 09:58
@cfuselli

Copy link
Copy Markdown
Member

@WenzDaniel I changed to this PR the default sim config version for the tests from SR1 to SR2 dev.
This is because the SR2 dev already contains the new fields you added here. So now you can see if your tests pass. But before merging here, we will need to add it also to SR0 and SR1 configs!

@coveralls

coveralls commented Jan 28, 2026

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21473361224

Details

  • 6 of 12 (50.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.7%) to 74.058%

Changes Missing Coverage Covered Lines Changed/Added Lines %
fuse/plugins/micro_physics/yields.py 6 12 50.0%
Totals Coverage Status
Change from base Build 21473199460: 1.7%
Covered Lines: 2732
Relevant Lines: 3689

💛 - Coveralls

@cfuselli

Copy link
Copy Markdown
Member

Hey @WenzDaniel I modified the tests in here, if we can merge https://github.com/XENONnT/private_nt_aux_files/pull/474 I think all the tests will pass.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for customizing Nuclear Recoil (NR) yields in NEST v2 simulations and improves the clarity of default yield parameter handling. The changes enable users to modify NR yields similarly to how ER yields can currently be modified, and refactors the yields parameter initialization to make the default handling more explicit.

Changes:

  • Added nest_nr_yields_parameters configuration parameter with support for custom values or default NEST parameters
  • Refactored yields parameter handling to explicitly check for list values, -1 default flag, or raise errors for unsupported values
  • Updated default simulation configuration from sr1_dev to sr2_dev across test utilities and context definitions
  • Modified CI configuration to use environment variables for test configuration, supporting both sr1_dev (lowest dependencies) and sr2_dev (latest dependencies)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
fuse/plugins/micro_physics/yields.py Added NR yields parameter configuration, refactored parameter initialization logic for both ER and NR yields, and integrated NR yields into NEST GetYields call
tests/_utils.py Changed test configuration to use environment variable with sr2_dev as default
fuse/context.py Updated default simulation config file from sr1_dev to sr2_dev
.github/workflows/pytest.yml Added FUSE_TEST_SIMULATION_CONFIG environment variable that switches between sr1_dev and sr2_dev based on dependency version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

type=(int, list),
help="Set to modify default NEST ER yields parameters. Use -1 to keep default value. \
From NEST code https://github.com/NESTCollaboration/nest/blob/v2.4.0/src/NEST.cpp \
Used in the calcuations of BetaYieldsGR.",

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

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

Spelling error: 'calcuations' should be 'calculations'.

Suggested change
Used in the calcuations of BetaYieldsGR.",
Used in the calculations of BetaYieldsGR.",

Copilot uses AI. Check for mistakes.
"SIMULATION_CONFIG_FILE.json?&fmt=json"
"&take=nest_nr_yields_parameters",
type=(int, list),
help="Set to modify default NEST NR yields parameters. Use -1 to keep default value.",

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

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

The help text for nest_nr_yields_parameters is less detailed than for nest_er_yields_parameters. Consider adding similar documentation about the NEST code source and its usage to maintain consistency.

Suggested change
help="Set to modify default NEST NR yields parameters. Use -1 to keep default value.",
help="Set to modify default NEST NR yields parameters. Use -1 to keep default value. \
From NEST code https://github.com/NESTCollaboration/nest/blob/v2.4.0/src/NEST.cpp \
Used in the calculations of NR yields.",

Copilot uses AI. Check for mistakes.

@cfuselli cfuselli 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.

Good! Thanks Daniel!

@cfuselli cfuselli merged commit 9aa0d0e into main Jan 29, 2026
12 checks passed
@cfuselli cfuselli deleted the update_nr_yields branch January 29, 2026 10:16
cfuselli added a commit that referenced this pull request Jan 29, 2026
* Added NR yields, updated defaut yields treatment

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix typo

* Update test simulation config from sr1_dev to sr2_dev

* Update simulation config file for microphysics context

* env var in tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix precommit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Carlo Fuselli <cfuselli@nikhef.nl>
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