Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug that can't parse materials with implicit library specification. #368

Conversation

MicahGale
Copy link
Collaborator

@MicahGale MicahGale commented Feb 6, 2024

The material parser was built assuming that all isotope specifications required a library, e.g., 1001.80c. However according to the 6.2 manual table 3-32:

Either a full ZZZAAA.abx or partial ZZZAAA element or nuclide
identifier for each constituent i, where ...

Therefore, this assumption is flawed.

To fix this, a dedicated MaterialParser was created. 1001 is ambiguous if it is part of a number sequence or a ZAID. So this parser just accepts both Isotopes and number sequences as valid. This avoids the need of contextual parser with a look-ahead capability by making the input contextual as an input level.

@SterlingButters you can review this if you like, but you don't need to.

As for the specific error message that was found in #365. The Material assumed it had an IsotopesNode which is a list of tuples, and was given a ListNode instead. It tried to unpack the ValueNode inside the list like a tuple, and freaked out.

Fixes #365.

@MicahGale MicahGale linked an issue Feb 6, 2024 that may be closed by this pull request
@MicahGale MicahGale self-assigned this Feb 6, 2024
@MicahGale MicahGale added the bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". label Feb 6, 2024
@MicahGale MicahGale added this to the Release-0.3 milestone Feb 6, 2024
@MicahGale MicahGale marked this pull request as ready for review February 12, 2024 16:41
@MicahGale MicahGale added the parsers are hard Examples of where MCNP syntax is complicated and should be simplified. label Feb 12, 2024
@MicahGale
Copy link
Collaborator Author

This needs to wait until #336 is merged due to the de facto deployment freeze depending on that.

@MicahGale MicahGale requested a review from tjlaboss February 13, 2024 23:46
@MicahGale MicahGale added the critical An issue that seriously limits user adoption or hampers current use. label Feb 14, 2024
@coveralls
Copy link
Collaborator

coveralls commented Mar 5, 2024

Pull Request Test Coverage Report for Build 8695235312

Details

  • 47 of 47 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 98.138%

Totals Coverage Status
Change from base Build 8694707289: 0.01%
Covered Lines: 5744
Relevant Lines: 5853

💛 - Coveralls

@MicahGale MicahGale marked this pull request as draft March 5, 2024 15:50
@MicahGale MicahGale marked this pull request as ready for review March 5, 2024 16:05
@MicahGale MicahGale enabled auto-merge April 15, 2024 19:53
@MicahGale
Copy link
Collaborator Author

Thank you!

@MicahGale MicahGale merged commit 2e52934 into develop Apr 15, 2024
13 checks passed
@MicahGale MicahGale deleted the 365-material-specifications-cannot-unpack-non-iterable-valuenode-object branch April 15, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". critical An issue that seriously limits user adoption or hampers current use. parsers are hard Examples of where MCNP syntax is complicated and should be simplified.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Material Specifications: cannot unpack non-iterable ValueNode object
3 participants