-
Notifications
You must be signed in to change notification settings - Fork 51
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
AMBER parser had a "too strict" regex to extract values #273
AMBER parser had a "too strict" regex to extract values #273
Conversation
Codecov Report
@@ Coverage Diff @@
## master #273 +/- ##
=======================================
Coverage 98.69% 98.69%
=======================================
Files 26 26
Lines 1759 1762 +3
Branches 378 379 +1
=======================================
+ Hits 1736 1739 +3
Misses 3 3
Partials 20 20
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Many thanks for the quick fix. Do you mind add a new file to alchemtest to make sure that we don't break it in the future? Thanks. A sample file as short as
Would be fine. |
I don't think we need this file in particular. As it is, it's just like some of the "right" files in the current alchemtest. The thing is, before this fix to extract the value from a I don't know which tests could be created to specifically check this as if this fails, almost all the tests should fail directly. |
@DrDomenicoMarson So one purpose of the test is to ensure that the fix works. In this case, people would look at the current |
Yeah, now I understand better, but I think that the file that needs to be added should have somewhere in the format "field =value" and/or "field=value" and/or "field= value", as these are the cases that are not covered by the current tests. |
Exactly, sorry for the confusion, I just find a random amber output file in my hand to show that in this case, one don't need the whole amber output file and a few lines showing the important bit is fine. |
Great, I added PR 86 in alchemtest, adding the two files needed to cover the two cases: |
Many thanks for the fix, so for the PR which involves the edits in alchemtest, the recommended practice is to change the line https://github.com/alchemistry/alchemlyb/blob/master/.github/workflows/ci.yaml#L58 to your PR in alchemtest Then the test should all pass and you will ask for a review of the PR in both alchemtest and alchemlyb. |
I tried to follow the suggestion, I hope now it will work fine! |
Co-authored-by: Zhiyi Wu <[email protected]>
Sorry didn't realise that the output is a dictionary, you could check if both dhdl and u_nk are dataframe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the quick fix.
- header - add @DrDomenicoMarson from PR #273
This PR addresses issue #272.
This issue exposed a nasty bug inside the regex pattern we used to extract sections in the amber output file.
we are trying to match a sequence of type
filed = int/float
extracting the int/float corresponding to the field. Up till now, the pattern was
fr' {field}\s+=\s+(\*+|{_FP_RE}|\d+)'
were
field
was the string we want to extract the value for, and_FP_RE
is defined to extract the float/int after the equal.The problem arises when the field and/or the value are not separated from the
=
sign by a space (as was the case in the issue). It's strange this didn't appear before!I just changed the
+
in\s+=\s+
to*
.Thinking about it, this should not break anything else, but I can't be 100% sure and the tests should catch any "macro" problems eventually introduced with this PR.