You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
KeyError when accessing section_text for certain sections #17
So MF=12, MT=75 is there for U-235 in ENDF/B-VIII.0, but not ENDF/B-VII.1. I suspect this is what is causing the KeyError. If this is in fact the root cause a clearer error message like:
raiseMissingDataError(f"The requested data: MAT={MAT}, MF={MF}, MT={MT} does not exist in this ENDF.")
The sections attribute on a Material object tells you what sections are available in a file. If a section is not present, to me KeyError is already conveying the right information.
Yes, I think it will be a nice feature. We can develop a fallback function that provides verbose logs about the file, which will also help people like me who are just starting to learn about different data formats.
Logging seems look far too big of a hammer. Like @paulromano said the information is there for the user, and I don't see the value in producing a log that would duplicate would could be queried directly.
@MicahGale, I apologize if I wasn’t clear in my earlier comment, and I appreciate your feedback. I didn’t mean to suggest extensive logging. My idea was more about having a fallback function that triggers when a KeyError is raised. The goal is to provide additional context, without overwhelming the system with logs.
Instead of full logging, this fallback could simply explain why the error occurred and, perhaps, point out which sections are available for the material being queried. It wouldn’t duplicate what’s already in place but would help users better understand the issue when encountering missing data.
Activity
MicahGale commentedon Oct 10, 2024
Which nuclear data library are you using? I want to verify that the data are present first.
The MF=31/35 warnings are not relevant here. MF 31/35 would appear much later in the file and would have no impact on MF=12.
MicahGale commentedon Oct 10, 2024
So MF=12, MT=75 is there for U-235 in ENDF/B-VIII.0, but not ENDF/B-VII.1. I suspect this is what is causing the
KeyError. If this is in fact the root cause a clearer error message like:would be a good idea.
paulromano commentedon Oct 10, 2024
The
sectionsattribute on aMaterialobject tells you what sections are available in a file. If a section is not present, to me KeyError is already conveying the right information.MicahGale commentedon Oct 10, 2024
Maybe the
KeyErrorcould be a little bit more verbose to make it clear this is user Error?ahnaf-tahmid-chowdhury commentedon Oct 11, 2024
Yes, I think it will be a nice feature. We can develop a fallback function that provides verbose logs about the file, which will also help people like me who are just starting to learn about different data formats.
MicahGale commentedon Oct 11, 2024
Logging seems look far too big of a hammer. Like @paulromano said the information is there for the user, and I don't see the value in producing a log that would duplicate would could be queried directly.
ahnaf-tahmid-chowdhury commentedon Oct 11, 2024
@MicahGale, I apologize if I wasn’t clear in my earlier comment, and I appreciate your feedback. I didn’t mean to suggest extensive logging. My idea was more about having a fallback function that triggers when a
KeyErroris raised. The goal is to provide additional context, without overwhelming the system with logs.Instead of full logging, this fallback could simply explain why the error occurred and, perhaps, point out which sections are available for the material being queried. It wouldn’t duplicate what’s already in place but would help users better understand the issue when encountering missing data.
MicahGale commentedon Oct 11, 2024
Oh ok that makes sense.