-
Notifications
You must be signed in to change notification settings - Fork 24
fix: Fix the hierarchy associated with ProfileParser.parse_file() and PDFParser.parse_file()
#192
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
Changes from all commits
6237734
761e229
532ac1d
a466556
e542ad9
623fc95
5c5ac40
e091a82
3d547dd
0965c01
eb70167
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| **Added:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Changed:** | ||
|
|
||
| * Change ``ProfileParser.parseFile`` to ``ProfileParser.parse_file``. Now, it dispatches to a subclass's ``parse_string`` override to perform format-specific parsing when one is provided (as ``PDFParser`` does), and otherwise reads generic column data. | ||
|
|
||
| **Deprecated:** | ||
|
|
||
| * Deprecate ``parseFile`` and ``parseString`` in ``ProfileParser``. Use ``parse_file`` and ``parse_string`` instead. | ||
|
|
||
| **Removed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Fixed:** | ||
|
|
||
| * Fix ``PDFContribution.loadData`` discarding PDF metadata such as ``stype``, ``qmax``, ``qdamp`` and ``temperature``. It parsed with generic column data instead of dispatching to ``PDFParser``'s format-specific parsing, so ``BasePDFGenerator._process_metadata`` had nothing to configure the calculator with. | ||
|
|
||
| **Security:** | ||
|
|
||
| * <news item> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,8 @@ | |
|
|
||
| __all__ = ["PDFContribution"] | ||
|
|
||
| from diffpy.srfit.fitbase import FitContribution, Profile, ProfileParser | ||
| from diffpy.srfit.fitbase import FitContribution, Profile | ||
| from diffpy.srfit.pdf.pdfparser import PDFParser | ||
|
|
||
|
|
||
| class PDFContribution(FitContribution): | ||
|
|
@@ -113,7 +114,7 @@ def loadData(self, datafile): | |
| data : str or Path | ||
| The path to the data file. | ||
| """ | ||
| parser = ProfileParser() | ||
| parser = PDFParser() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please check this change is correct. Didn't we move from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sbillinge We did and this changes it back. I changed it back because it seems like the intended design of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, but
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sbillinge So def parse_string():
...
# qmax
regexp = r"\bqmax *= *(%(f)s)\b" % rx
res = re.search(regexp, header, re.I)
if res:
meta["qmax"] = float(res.groups()[0])
# qdamp
regexp = r"\b(?:qdamp|qsig) *= *(%(f)s)\b" % rx
res = re.search(regexp, header, re.I)
if res:
meta["qdamp"] = float(res.groups()[0])
# qbroad
...TLDR, I think the name should remain the same because of how its designed and that |
||
| parser.parse_file(datafile) | ||
|
|
||
| # Pass it to the profile | ||
|
|
||
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.
when you say overrides do you mean overloads? Or is overrides a recognized term of art? I am not sure is why I am asking (and I guess Claude may have been involved and Claude generally uses the right terminology). I suggest to check this and then correct it everywhere if it needs it, or not if not.
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.
@sbillinge Overriding is when a subclass redefines a method it inherits, so override is correct in this case. "Override" is not used anywhere else so we should be good on updating