Generalize get decay particle energy#3918
Generalize get decay particle energy#3918marco-de-pietri wants to merge 4 commits intoopenmc-dev:developfrom
Conversation
There was a problem hiding this comment.
💡 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'}) |
There was a problem hiding this comment.
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 👍 / 👎.
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