Fix C-model post processing and error propagation#502
Fix C-model post processing and error propagation#502dodu94 wants to merge 3 commits intodevelopingfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
WalkthroughThis PR addresses a C-Model post-processing bug by fixing error propagation calculations in the compare_data function (applying absolute value wrapping and correcting numerator terms for percentage errors) and updating plot configurations to use explicit collision state labels instead of numeric suffixes. Related test configurations and expected values are updated accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/post/test_excel_routines.py (1)
21-29: Add one case that produces a negative comparison value.These assertions validate the corrected numerator, but they still never hit the new
np.abs(...)path because both non-zero rows haveval1 > val2. Oneval2 > val1regression case would lock in the non-negative error behavior this PR is fixing, ideally for bothPERCENTAGEandABSOLUTE.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/post/test_excel_routines.py` around lines 21 - 29, Add a test row to exercise a negative comparison (val2 > val1) so the np.abs(...) branch in Table._compare is hit: modify the test dataframes (df1/df2) used in this test to include at least one row where df2 value exceeds df1 value, then add assertions for both ComparisonType.PERCENTAGE and ComparisonType.ABSOLUTE runs of Table._compare to verify "Value" is non-negative and "Error" uses the absolute numerator path; reference Table._compare, ComparisonType.PERCENTAGE, ComparisonType.ABSOLUTE, and the existing df1/df2/result variables when updating the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/metadata.json`:
- Line 5: The metadata.json in the _mcnp_-_ENDFB-VIII.0_ fixture has a
mismatched "library" value ("FENDL 3.2c"); update the "library" field in that
metadata.json to the correct ENDF/B identifier (e.g., "ENDF/B-VIII.0" or the
project-standard string used elsewhere) so the fixture name and its "library"
key are consistent; ensure only the "library" value is changed and other
metadata keys remain untouched.
In `@tests/dummy_structure/raw_data/_mcnp_-_FENDL` 3.2c_/C-Model/metadata.json:
- Line 4: The metadata fixture has an inconsistent benchmark_name value
("C_Model") that should match the folder/sibling fixture naming ("C-Model");
update the "benchmark_name" field in the JSON (the key "benchmark_name"
currently set to "C_Model") to "C-Model" so all fixtures use the same normalized
benchmark name.
---
Nitpick comments:
In `@tests/post/test_excel_routines.py`:
- Around line 21-29: Add a test row to exercise a negative comparison (val2 >
val1) so the np.abs(...) branch in Table._compare is hit: modify the test
dataframes (df1/df2) used in this test to include at least one row where df2
value exceeds df1 value, then add assertions for both ComparisonType.PERCENTAGE
and ComparisonType.ABSOLUTE runs of Table._compare to verify "Value" is
non-negative and "Error" uses the absolute numerator path; reference
Table._compare, ComparisonType.PERCENTAGE, ComparisonType.ABSOLUTE, and the
existing df1/df2/result variables when updating the test.
🪄 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: be3625e1-713e-4fe6-9ad8-a04fa540b0ff
⛔ Files ignored due to path filters (24)
tests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN BLANKET [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN CENTRAL SOLENOID [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN CORRECTION COILS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN CRYOSTAT [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN DIVERTOR [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN PF COILS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN PORT PLUGS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN TF COILS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN THERMAL SHIELDS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model NUCLEAR HEAT IN VACUUM VESSEL, PORT EXTENSIONS, AND PORT DUCTS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model Neutron current on plasma boundary.csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/C-Model Neutron flux on plasma boundary.csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN BLANKET [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN CENTRAL SOLENOID [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN CORRECTION COILS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN CRYOSTAT [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN DIVERTOR [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN PF COILS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN PORT PLUGS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN TF COILS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN THERMAL SHIELDS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model NUCLEAR HEAT IN VACUUM VESSEL, PORT EXTENSIONS, AND PORT DUCTS [W].csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model Neutron current on plasma boundary.csvis excluded by!**/*.csvtests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/C-Model Neutron flux on plasma boundary.csvis excluded by!**/*.csv
📒 Files selected for processing (7)
src/jade/post/manipulate_tally.pysrc/jade/resources/default_cfg/benchmarks_pp/atlas/C-Model.yamltests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/metadata.jsontests/dummy_structure/raw_data/_mcnp_-_FENDL 3.2c_/C-Model/metadata.jsontests/post/test_atlas_processor.pytests/post/test_excel_processor.pytests/post/test_excel_routines.py
| "benchmark_name": "C-Model", | ||
| "benchmark_version": "1.0", | ||
| "jade_run_version": "3.1.0", | ||
| "library": "FENDL 3.2c", |
There was a problem hiding this comment.
Fix library metadata mismatch in ENDFB fixture.
Line 5 currently sets "library": "FENDL 3.2c" inside the .../_mcnp_-_ENDFB-VIII.0_/... fixture. This makes the test metadata inconsistent and misleading for metadata readers.
Proposed fix
- "library": "FENDL 3.2c",
+ "library": "ENDFB-VIII.0",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "library": "FENDL 3.2c", | |
| "library": "ENDFB-VIII.0", |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/dummy_structure/raw_data/_mcnp_-_ENDFB-VIII.0_/C-Model/metadata.json`
at line 5, The metadata.json in the _mcnp_-_ENDFB-VIII.0_ fixture has a
mismatched "library" value ("FENDL 3.2c"); update the "library" field in that
metadata.json to the correct ENDF/B identifier (e.g., "ENDF/B-VIII.0" or the
project-standard string used elsewhere) so the fixture name and its "library"
key are consistent; ensure only the "library" value is changed and other
metadata keys remain untouched.
| "benchmark_version": "1.0", | ||
| "jade_run_version": "3.1.0", | ||
| "jade_run_version": "3.0.1", | ||
| "benchmark_name": "C_Model", |
There was a problem hiding this comment.
Normalize benchmark naming across C-Model metadata fixtures.
Line 4 uses "benchmark_name": "C_Model" while the benchmark folder and sibling fixture use "C-Model". This inconsistency can produce confusing metadata outputs during tests.
Proposed fix
- "benchmark_name": "C_Model",
+ "benchmark_name": "C-Model",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "benchmark_name": "C_Model", | |
| "benchmark_name": "C-Model", |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/dummy_structure/raw_data/_mcnp_-_FENDL` 3.2c_/C-Model/metadata.json at
line 4, The metadata fixture has an inconsistent benchmark_name value
("C_Model") that should match the folder/sibling fixture naming ("C-Model");
update the "benchmark_name" field in the JSON (the key "benchmark_name"
currently set to "C_Model") to "C-Model" so all fixtures use the same normalized
benchmark name.
This PR fixes #493 C-model bugs in the post-processing.
The main change was adjusting the logic used to compute the error propagation in case of percentage comparisons and small touches to the atlas yaml file
Summary by CodeRabbit