Skip to content

Commit a8fb488

Browse files
committed
deprecate Profile.loadParsedData
1 parent 0adb573 commit a8fb488

12 files changed

Lines changed: 73 additions & 14 deletions

docs/examples/coreshellnp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def makeRecipe(stru1, stru2, datname):
4444
# Load data and add it to the profile
4545
parser = PDFParser()
4646
parser.parseFile(datname)
47-
profile.loadParsedData(parser)
47+
profile.load_parsed_data(parser)
4848
profile.setCalculationRange(xmin=1.5, xmax=45, dx=0.1)
4949

5050
# The ProfileGenerator

docs/examples/crystalpdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def makeRecipe(ciffile, datname):
5555
# configuration steps.
5656
parser = PDFParser()
5757
parser.parseFile(datname)
58-
profile.loadParsedData(parser)
58+
profile.load_parsed_data(parser)
5959
profile.setCalculationRange(xmax=20)
6060

6161
# The ProfileGenerator

docs/examples/crystalpdfall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def makeProfile(datafile):
3939
profile = Profile()
4040
parser = PDFParser()
4141
parser.parseFile(datafile)
42-
profile.loadParsedData(parser)
42+
profile.load_parsed_data(parser)
4343
profile.setCalculationRange(xmax=20)
4444
return profile
4545

docs/examples/crystalpdfobjcryst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def makeRecipe(ciffile, datname):
4848
# structure being refined.
4949
parser = PDFParser()
5050
parser.parseFile(datname)
51-
profile.loadParsedData(parser)
51+
profile.load_parsed_data(parser)
5252
profile.setCalculationRange(xmax=20)
5353

5454
# The ProfileGenerator

docs/examples/crystalpdftwodata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ def makeRecipe(ciffile, xdatname, ndatname):
4848
# Load data and add it to the proper Profile.
4949
parser = PDFParser()
5050
parser.parseFile(xdatname)
51-
xprofile.loadParsedData(parser)
51+
xprofile.load_parsed_data(parser)
5252
xprofile.setCalculationRange(xmax=20)
5353

5454
parser = PDFParser()
5555
parser.parseFile(ndatname)
56-
nprofile.loadParsedData(parser)
56+
nprofile.load_parsed_data(parser)
5757
nprofile.setCalculationRange(xmax=20)
5858

5959
# The ProfileGenerators

docs/examples/crystalpdftwophase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def makeRecipe(niciffile, siciffile, datname):
4545
# Load data and add it to the profile
4646
parser = PDFParser()
4747
parser.parseFile(datname)
48-
profile.loadParsedData(parser)
48+
profile.load_parsed_data(parser)
4949
profile.setCalculationRange(xmax=20)
5050

5151
# The ProfileGenerator

docs/examples/ellipsoidsas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def makeRecipe(datname):
3939
# properly and pass the metadata along.
4040
parser = SASParser()
4141
parser.parseFile(datname)
42-
profile.loadParsedData(parser)
42+
profile.load_parsed_data(parser)
4343

4444
# The ProfileGenerator
4545
# The SASGenerator is for configuring and calculating a SAS profile. We use

docs/examples/nppdfcrystal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def makeRecipe(ciffile, grdata):
4444

4545
pdfparser = PDFParser()
4646
pdfparser.parseFile(grdata)
47-
pdfprofile.loadParsedData(pdfparser)
47+
pdfprofile.load_parsed_data(pdfparser)
4848
pdfprofile.setCalculationRange(xmin=0.1, xmax=20)
4949

5050
pdfcontribution = FitContribution("pdf")

docs/examples/nppdfsas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def makeRecipe(ciffile, grdata, iqdata):
4848
pdfprofile = Profile()
4949
pdfparser = PDFParser()
5050
pdfparser.parseFile(grdata)
51-
pdfprofile.loadParsedData(pdfparser)
51+
pdfprofile.load_parsed_data(pdfparser)
5252
pdfprofile.setCalculationRange(xmin=0.1, xmax=20)
5353

5454
pdfcontribution = FitContribution("pdf")
@@ -66,7 +66,7 @@ def makeRecipe(ciffile, grdata, iqdata):
6666
sasprofile = Profile()
6767
sasparser = SASParser()
6868
sasparser.parseFile(iqdata)
69-
sasprofile.loadParsedData(sasparser)
69+
sasprofile.load_parsed_data(sasparser)
7070
if all(sasprofile.dy == 0):
7171
sasprofile.dy[:] = 1
7272

src/diffpy/srfit/fitbase/profile.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,19 @@
2929
from diffpy.srfit.fitbase.parameter import Parameter
3030
from diffpy.srfit.fitbase.validatable import Validatable
3131
from diffpy.srfit.util.observable import Observable
32+
from diffpy.utils._deprecator import build_deprecation_message, deprecated
3233

3334
# This is the roundoff tolerance for selecting bounds on arrays.
3435
epsilon = 1e-8
36+
base = "diffpy.srfit.fitbase.profile.Profile"
37+
removal_version = "4.0.0"
38+
39+
loadParsedData_dep_msg = build_deprecation_message(
40+
base,
41+
"loadParsedData",
42+
"load_parsed_data",
43+
removal_version,
44+
)
3545

3646

3747
class Profile(Observable, Validatable):
@@ -125,7 +135,7 @@ def __init__(self):
125135
yobs = property(lambda self: self._yobs)
126136
dyobs = property(lambda self: self._dyobs)
127137

128-
def loadParsedData(self, parser):
138+
def load_parsed_data(self, parser):
129139
"""Load parsed data from a ProfileParser.
130140
131141
This sets the xobs, yobs, dyobs arrays as well as the metadata.
@@ -135,6 +145,17 @@ def loadParsedData(self, parser):
135145
self.setObservedProfile(x, y, dy)
136146
return
137147

148+
@deprecated(loadParsedData_dep_msg)
149+
def loadParsedData(self, parser):
150+
"""This function has been deprecated and will be removed in version
151+
4.0.0.
152+
153+
Please use diffpy.srfit.fitbase.profile.Profile.load_parsed_data
154+
instead.
155+
"""
156+
self.load_parsed_data(parser)
157+
return
158+
138159
def setObservedProfile(self, xobs, yobs, dyobs=None):
139160
"""Set the observed profile.
140161

0 commit comments

Comments
 (0)