Skip to content

Generalize get decay particle energy#3918

Open
marco-de-pietri wants to merge 4 commits intoopenmc-dev:developfrom
marco-de-pietri:generalize-get-decay-particle-energy
Open

Generalize get decay particle energy#3918
marco-de-pietri wants to merge 4 commits intoopenmc-dev:developfrom
marco-de-pietri:generalize-get-decay-particle-energy

Conversation

@marco-de-pietri
Copy link
Copy Markdown
Contributor

@marco-de-pietri marco-de-pietri commented Apr 8, 2026

Description

This small PR allows the production of radiation sources for whatever decay particle is defined in the chain file.

It is useful for coolant activation as irradiated water will contain N-17 a neutron emitter, but I am sure it has a wider utility. Matter of fact I realized a similar PR (#2792) was proposed three years ago. This version builds upon that work by adding tests and updating documentation where necessary.

Existing methods (Material.get_decay_photon_energy and data.decay_photon_energy) are preserved for backward compatibility as wrappers, but it could be changed

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd49915a74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"""
cv.check_value('units', units, {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3', 'Bq/m3'})
cv.check_type('particle', particle, str)
cv.check_value('particle', particle, {'alpha', 'fragment', 'neutron','photon', 'electron', 'positron','proton'})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept chain-defined particle names in source query

Remove the hardcoded particle whitelist here; it prevents Material.get_decay_particle_energy() from returning valid sources that are present in a chain file under other particle names. In this codebase, decay sources can be tagged with additional names (e.g., neutrino/anti-neutrino from Decay.sources mapping), so this check_value raises ValueError for supported chain content and defeats the stated generalization to arbitrary decay particles.

Useful? React with 👍 / 👎.

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