534 bug jade cannot handle total heating tallies no particle filter#540
534 bug jade cannot handle total heating tallies no particle filter#540sbradnam wants to merge 8 commits into
Conversation
…ting-tallies-no-particle-filter
|
Warning Review limit reached
More reviews will be available in 33 minutes and 43 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR refactors the heating tally combination logic in OpenMCStatePoint to safely handle missing ParticleFilters and correctly aggregate photon, electron, and positron tallies using quadrature for standard deviation. Documentation and test assertions are updated to reflect the new behavior, and a test ordering issue is stabilized. ChangesHeating Tally Improvements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/app/test_app.py (1)
225-229: ⚡ Quick winSort by run folder identity, not rendered script text.
x[1]is the generated batch script body, so ordering can change if template text changes. For stable order-independent validation, sort by the run path tuple element (e.g.,x[2]) or build assertions keyed by folder name instead of fixed positions.Suggested adjustment
- command_sorted = sorted(command, key=lambda x: x[1]) + command_sorted = sorted(command, key=lambda x: str(x[2])) assert "#!/bin/sh\n\n#SBATCH" in command_sorted[0][1] assert "Sphere_dummy1" in command_sorted[0][1] assert "Sphere_m101" in command_sorted[1][1]🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/app/test_app.py` around lines 225 - 229, The test sorts generated command tuples by the script body (command_sorted = sorted(command, key=lambda x: x[1])) which is brittle; change the sort key to the run folder identity element (e.g., use key=lambda x: x[2] or another tuple index that holds the run path) or instead build assertions by looking up tuples by their folder name rather than relying on fixed positions; update the assertions that reference command_sorted[0][1] / command_sorted[1][1] to reference the correct tuple by folder identity (using x[2] or a dict lookup) so ordering is stable when template text changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/source/dev/add_benchmark/where_inputs.rst`:
- Around line 80-82: Fix two typos in the OpenMC guidance sentence that
describes adding photon heating tallies: change "seperate" to "separate" and
"repsonse" to "response" in the line containing the phrase "add 3 seperate
tallies" / "produce an equivalent repsonse" (search for the sentence mentioning
"openmc.CellFilter" and "openmc.ParticleFilter" to locate the exact spot).
In `@src/jade/helper/openmc.py`:
- Around line 583-589: The predicate `if "electron" or "positron" in
particle_filter.bins:` is incorrect and always truthy, causing
non-electron/positron tallies to be merged into heating_tallies_df; change the
condition in the loop that uses particle_filter.bins (the block that calls
self._get_tally_data and updates heating_tallies_df[id]["mean"] and ["std.
dev."]) to explicitly test membership for both tokens (e.g. `"electron" in
particle_filter.bins or "positron" in particle_filter.bins"` or use any(x in
particle_filter.bins for x in ("electron","positron"))), so only
electron/positron bins contribute to the combined mean/std-dev calculations.
---
Nitpick comments:
In `@tests/app/test_app.py`:
- Around line 225-229: The test sorts generated command tuples by the script
body (command_sorted = sorted(command, key=lambda x: x[1])) which is brittle;
change the sort key to the run folder identity element (e.g., use key=lambda x:
x[2] or another tuple index that holds the run path) or instead build assertions
by looking up tuples by their folder name rather than relying on fixed
positions; update the assertions that reference command_sorted[0][1] /
command_sorted[1][1] to reference the correct tuple by folder identity (using
x[2] or a dict lookup) so ordering is stable when template text changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1e115135-b0e2-41df-9ea3-7aa33edb39c4
📒 Files selected for processing (5)
docs/source/dev/add_benchmark/where_inputs.rstsrc/jade/helper/openmc.pytests/app/test_app.pytests/helper/test_openmc.pytests/post/resources/openmc/statepoint.10.h5
dodu94
left a comment
There was a problem hiding this comment.
Thanks Steve, have a look at the comments from CodeRabbit, they may be worth to implement. Does this PR requires to modify existing OpenMC inputs of JADE?
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
No it just catches a case which would have been missed previously. None of the existing OpenMC benchmarks in JADE have total heating tallies. However C-Model does so this has been implimebted to support the addition of OpenMC C-Model later on. |
OpenMCheating tallies. Previuously, total heating tallies, where a heating score is recorded by noopenmc.ParticleFilteris applied, would not be processed by JADE. In addition, the logic has been revised, to ensure all cases where photon, electron on positron filters on heating tallies with the sameopenmc.CellFilterare combined together.test_app.py, but still passing CI. This has been updated to fix the test to pass on UKAEA HPC.Summary by CodeRabbit
Documentation
Bug Fixes