Skip to content

Commit a616dc2

Browse files
committed
update examples with new parser
1 parent 9544243 commit a616dc2

8 files changed

Lines changed: 33 additions & 24 deletions

File tree

docs/examples/coreshellnp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
FitRecipe,
3030
FitResults,
3131
Profile,
32+
ProfileParser,
3233
)
33-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
34+
from diffpy.srfit.pdf import PDFGenerator
3435

3536
# Example Code
3637

@@ -42,7 +43,7 @@ def makeRecipe(stru1, stru2, datname):
4243
profile = Profile()
4344

4445
# Load data and add it to the profile
45-
parser = PDFParser()
46+
parser = ProfileParser()
4647
parser.parseFile(datname)
4748
profile.load_parsed_data(parser)
4849
profile.set_calculation_range(xmin=1.5, xmax=45, dx=0.1)

docs/examples/crystalpdf.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
FitRecipe,
3333
FitResults,
3434
Profile,
35+
ProfileParser,
3536
)
36-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
37+
from diffpy.srfit.pdf import PDFGenerator
3738
from diffpy.structure import Structure
3839

3940
######
@@ -48,12 +49,12 @@ def makeRecipe(ciffile, datname):
4849
profile = Profile()
4950

5051
# Load data and add it to the Profile. Unlike in other examples, we use a
51-
# class (PDFParser) to help us load the data. This class will read the data
52-
# and relevant metadata from a two- to four-column data file generated
52+
# class (ProfileParser) to help us load the data. This class will read the
53+
# data and relevant metadata from a two- to four-column data file generated
5354
# with PDFGetX2 or PDFGetN. The metadata will be passed to the PDFGenerator
5455
# when they are associated in the FitContribution, which saves some
5556
# configuration steps.
56-
parser = PDFParser()
57+
parser = ProfileParser()
5758
parser.parseFile(datname)
5859
profile.load_parsed_data(parser)
5960
profile.set_calculation_range(xmax=20)
@@ -62,7 +63,8 @@ def makeRecipe(ciffile, datname):
6263
# The PDFGenerator is for configuring and calculating a PDF profile. Here,
6364
# we want to refine a Structure object from diffpy.structure. We tell the
6465
# PDFGenerator that with the 'setStructure' method. All other configuration
65-
# options will be inferred from the metadata that is read by the PDFParser.
66+
# options will be inferred from the metadata that is read by the
67+
# ProfileParser.
6668
# In particular, this will set the scattering type (x-ray or neutron), the
6769
# Qmax value, as well as initial values for the non-structural Parameters.
6870
generator = PDFGenerator("G")

docs/examples/crystalpdfall.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
FitRecipe,
2828
FitResults,
2929
Profile,
30+
ProfileParser,
3031
)
31-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
32+
from diffpy.srfit.pdf import PDFGenerator
3233

3334
######
3435
# Example Code
@@ -37,7 +38,7 @@
3738
def makeProfile(datafile):
3839
"""Make an place data within a Profile."""
3940
profile = Profile()
40-
parser = PDFParser()
41+
parser = ProfileParser()
4142
parser.parseFile(datafile)
4243
profile.load_parsed_data(parser)
4344
profile.set_calculation_range(xmax=20)

docs/examples/crystalpdfobjcryst.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
FitRecipe,
2929
FitResults,
3030
Profile,
31+
ProfileParser,
3132
)
32-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
33+
from diffpy.srfit.pdf import PDFGenerator
3334

3435
######
3536
# Example Code
@@ -42,11 +43,11 @@ def makeRecipe(ciffile, datname):
4243
# This will be used to store the observed and calculated PDF profile.
4344
profile = Profile()
4445

45-
# Load data and add it to the Profile. As before we use a PDFParser. The
46-
# metadata is still passed to the PDFGenerator later on. The interaction
47-
# between the PDFGenerator and the metadata does not depend on type of
48-
# structure being refined.
49-
parser = PDFParser()
46+
# Load data and add it to the Profile. As before we use a ProfileParser.
47+
# The metadata is still passed to the PDFGenerator later on.
48+
# The interaction between the PDFGenerator and the metadata does not
49+
# depend on type of structure being refined.
50+
parser = ProfileParser()
5051
parser.parseFile(datname)
5152
profile.load_parsed_data(parser)
5253
profile.set_calculation_range(xmax=20)

docs/examples/crystalpdftwodata.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
FitRecipe,
3030
FitResults,
3131
Profile,
32+
ProfileParser,
3233
)
33-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
34+
from diffpy.srfit.pdf import PDFGenerator
3435

3536
######
3637
# Example Code
@@ -46,12 +47,12 @@ def makeRecipe(ciffile, xdatname, ndatname):
4647
nprofile = Profile()
4748

4849
# Load data and add it to the proper Profile.
49-
parser = PDFParser()
50+
parser = ProfileParser()
5051
parser.parseFile(xdatname)
5152
xprofile.load_parsed_data(parser)
5253
xprofile.set_calculation_range(xmax=20)
5354

54-
parser = PDFParser()
55+
parser = ProfileParser()
5556
parser.parseFile(ndatname)
5657
nprofile.load_parsed_data(parser)
5758
nprofile.set_calculation_range(xmax=20)

docs/examples/crystalpdftwophase.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
FitRecipe,
3030
FitResults,
3131
Profile,
32+
ProfileParser,
3233
)
33-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
34+
from diffpy.srfit.pdf import PDFGenerator
3435

3536
######
3637
# Example Code
@@ -43,7 +44,7 @@ def makeRecipe(niciffile, siciffile, datname):
4344
profile = Profile()
4445

4546
# Load data and add it to the profile
46-
parser = PDFParser()
47+
parser = ProfileParser()
4748
parser.parseFile(datname)
4849
profile.load_parsed_data(parser)
4950
profile.set_calculation_range(xmax=20)

docs/examples/nppdfcrystal.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
FitRecipe,
3333
FitResults,
3434
Profile,
35+
ProfileParser,
3536
)
36-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
37+
from diffpy.srfit.pdf import PDFGenerator
3738

3839

3940
def makeRecipe(ciffile, grdata):
@@ -42,7 +43,7 @@ def makeRecipe(ciffile, grdata):
4243
# Set up a PDF fit as has been done in other examples.
4344
pdfprofile = Profile()
4445

45-
pdfparser = PDFParser()
46+
pdfparser = ProfileParser()
4647
pdfparser.parseFile(grdata)
4748
pdfprofile.load_parsed_data(pdfparser)
4849
pdfprofile.set_calculation_range(xmin=0.1, xmax=20)

docs/examples/nppdfsas.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
FitRecipe,
3232
FitResults,
3333
Profile,
34+
ProfileParser,
3435
)
35-
from diffpy.srfit.pdf import PDFGenerator, PDFParser
36+
from diffpy.srfit.pdf import PDFGenerator
3637
from diffpy.srfit.pdf.characteristicfunctions import SASCF
3738
from diffpy.srfit.sas import SASGenerator, SASParser
3839

@@ -47,7 +48,7 @@ def makeRecipe(ciffile, grdata, iqdata):
4748

4849
# Create a PDF contribution as before
4950
pdfprofile = Profile()
50-
pdfparser = PDFParser()
51+
pdfparser = ProfileParser()
5152
pdfparser.parseFile(grdata)
5253
pdfprofile.load_parsed_data(pdfparser)
5354
pdfprofile.set_calculation_range(xmin=0.1, xmax=20)

0 commit comments

Comments
 (0)