Skip to content

Commit 5568579

Browse files
committed
use ProfileParser in PDFContribution, replacing PDFParser
1 parent 9680c77 commit 5568579

1 file changed

Lines changed: 7 additions & 19 deletions

File tree

src/diffpy/srfit/pdf/pdfcontribution.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
__all__ = ["PDFContribution"]
2222

23-
from diffpy.srfit.fitbase import FitContribution, Profile
23+
from diffpy.srfit.fitbase import FitContribution, Profile, ProfileParser
2424

2525

2626
class PDFContribution(FitContribution):
@@ -105,28 +105,16 @@ def __init__(self, name):
105105

106106
# Data methods
107107

108-
def loadData(self, data):
109-
"""Load the data in various formats.
110-
111-
This uses the PDFParser to load the data and then passes it to the
112-
built-in profile with load_parsed_data.
108+
def loadData(self, datafile):
109+
"""Load the data from a datafile.
113110
114111
Parameters
115112
----------
116-
data
117-
An open file-like object, name of a file that contains data
118-
or a string containing the data.
113+
data : str or Path
114+
The path to the data file.
119115
"""
120-
# Get the data into a string
121-
from diffpy.srfit.util.inpututils import inputToString
122-
123-
datstr = inputToString(data)
124-
125-
# Load data with a PDFParser
126-
from diffpy.srfit.pdf.pdfparser import PDFParser
127-
128-
parser = PDFParser()
129-
parser.parseString(datstr)
116+
parser = ProfileParser()
117+
parser.parse_file(datafile)
130118

131119
# Pass it to the profile
132120
self.profile.load_parsed_data(parser)

0 commit comments

Comments
 (0)