|
20 | 20 |
|
21 | 21 | __all__ = ["PDFContribution"] |
22 | 22 |
|
23 | | -from diffpy.srfit.fitbase import FitContribution, Profile |
| 23 | +from diffpy.srfit.fitbase import FitContribution, Profile, ProfileParser |
24 | 24 |
|
25 | 25 |
|
26 | 26 | class PDFContribution(FitContribution): |
@@ -105,28 +105,16 @@ def __init__(self, name): |
105 | 105 |
|
106 | 106 | # Data methods |
107 | 107 |
|
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. |
113 | 110 |
|
114 | 111 | Parameters |
115 | 112 | ---------- |
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. |
119 | 115 | """ |
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) |
130 | 118 |
|
131 | 119 | # Pass it to the profile |
132 | 120 | self.profile.load_parsed_data(parser) |
|
0 commit comments