Fix: Restore extensibility of ProfileParser and use load_data from diffpy.utils - #196
Open
cadenmyers13 wants to merge 13 commits into
Open
Fix: Restore extensibility of ProfileParser and use load_data from diffpy.utils#196cadenmyers13 wants to merge 13 commits into
ProfileParser and use load_data from diffpy.utils#196cadenmyers13 wants to merge 13 commits into
Conversation
…to create your own parser in docs
…testdata file for each
…arsers for metadata and the data itself
…ults to load_data
…e (neutron data) and pdfgetx (xray data)
cadenmyers13
commented
Aug 5, 2026
| # ---------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| def testParser1(datafile): |
Contributor
Author
There was a problem hiding this comment.
I reworked this old test to be up to our standards. See below
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v3.3.0 #196 +/- ##
==========================================
+ Coverage 79.08% 81.89% +2.80%
==========================================
Files 25 25
Lines 3821 3927 +106
==========================================
+ Hits 3022 3216 +194
+ Misses 799 711 -88
🚀 New features to boost your workflow:
|
Contributor
Author
|
@sbillinge ready for review. See the news file and my above message for a good summary of whats been changed |
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.
closes #194
This PR reworks
ProfileParserso metadata and data parsing are extensible per format:ProfileParser.parse_fileis now a template method backed by_parse_metadata/_parse_data. If a user wants to create their own parser, they have the option to parse data and metadata separately with the respective private functions.PDFParseris now identical toProfileParserwhich usesload_data. I think this is okay for now, but we might want to reconsider in the future.parse_filenow acceptsload_data's keyword arguments (usecols,delimiter,comments, etc.), so files with more than four columns can be read by selecting columns explicitly.PDFContribution.loadDatanow takes a file name only (string/open-file input has been removed, consistent with the rest of the parser).parseStringis removed fromProfileParserandPDFParser, since parsers now read from a file.si-q27r60-xray.grandni-q27r100-neutron.grtest files were updated from 2008-era PDFgetX2/PDFgetN headers to modern diffpy.pdfgetx/xPDFsuite header formats (data values unchanged), and examples/docs were updated to use the new parser.