Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The PSTAR function derives its maximum from number_of_data_points, a field that actually stores the material enum value, so it returns an incorrect (near-minimum) upper bound for every material.
5 open issues
What changed in this PR
This PR adds two new public helper functions, AT_PSTAR_energy_bounds and AT_ICRU_energy_bounds, that report the minimum and maximum tabulated energies available in the PSTAR and ICRU stopping-power datasets for a given material (and, for ICRU, particle). These are intended as lookup utilities alongside the existing AT_PSTAR_wrapper/AT_ICRU_wrapper interpolation routines in the stopping-power data modules.
Changes:
- Added
AT_PSTAR_energy_bounds(material bounds) in the PSTAR source/header. - Added
AT_ICRU_energy_bounds(material + particle bounds, with a special 250 MeV/u cap for helium) in the ICRU source/header. - The PSTAR implementation derives the upper bound from
number_of_data_points, which does not actually contain the point count.
| File | Description |
|---|---|
| src/AT_StoppingPowerDataPSTAR.c | Implements AT_PSTAR_energy_bounds; incorrectly uses number_of_data_points (holds the material id, not the count) for the max index. |
| src/AT_StoppingPowerDataICRU.c | Implements AT_ICRU_energy_bounds with material/particle validation and He upper-bound cap. |
| include/AT_StoppingPowerDataPSTAR.h | Declares AT_PSTAR_energy_bounds (no Doxygen). |
| include/AT_StoppingPowerDataICRU.h | Declares AT_ICRU_energy_bounds (no Doxygen). |
Review effort: Balanced
Comment on lines
+1353
to
+1358
| if (table == NULL || table->number_of_data_points <= 0) { | ||
| return -1; | ||
| } | ||
| *minimum = table->energy_and_stopping_power[0][0]; | ||
| *maximum = table->energy_and_stopping_power[ | ||
| table->number_of_data_points - 1][0]; |
Comment on lines
+54
to
+57
| int AT_ICRU_energy_bounds( long material_no, | ||
| long particle_no, | ||
| double *minimum, | ||
| double *maximum); |
Comment on lines
+70
to
+72
| int AT_PSTAR_energy_bounds( long material_no, | ||
| double *minimum, | ||
| double *maximum); |
| double *maximum) { | ||
| if (material_no != Water_Liquid && | ||
| material_no != Aluminum_Oxide) { | ||
| return -1; |
| double *minimum, | ||
| double *maximum) { | ||
| if (material_no < 0 || material_no >= N_PSTAR_MATERIALS) { | ||
| return -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.