Skip to content

Commit 75f570d

Browse files
authored
Merge pull request #117 from sbillinge/flake8
Flake8
2 parents 191fe7d + 0726694 commit 75f570d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+300
-302
lines changed

doc/examples/crystalpdf.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@
3636
from diffpy.srfit.pdf import PDFGenerator, PDFParser
3737
from diffpy.structure import Structure
3838

39-
####### Example Code
39+
######
40+
# Example Code
4041

4142

4243
def makeRecipe(ciffile, datname):
4344
"""Create a fitting recipe for crystalline PDF data."""
4445

45-
## The Profile
46+
# The Profile
4647
# This will be used to store the observed and calculated PDF profile.
4748
profile = Profile()
4849

@@ -57,7 +58,7 @@ def makeRecipe(ciffile, datname):
5758
profile.loadParsedData(parser)
5859
profile.setCalculationRange(xmax=20)
5960

60-
## The ProfileGenerator
61+
# The ProfileGenerator
6162
# The PDFGenerator is for configuring and calculating a PDF profile. Here,
6263
# we want to refine a Structure object from diffpy.structure. We tell the
6364
# PDFGenerator that with the 'setStructure' method. All other configuration
@@ -69,18 +70,18 @@ def makeRecipe(ciffile, datname):
6970
stru.read(ciffile)
7071
generator.setStructure(stru)
7172

72-
## The FitContribution
73+
# The FitContribution
7374
# Here we associate the Profile and ProfileGenerator, as has been done
7475
# before.
7576
contribution = FitContribution("nickel")
7677
contribution.addProfileGenerator(generator)
7778
contribution.setProfile(profile, xname="r")
7879

79-
## Make the FitRecipe and add the FitContribution.
80+
# Make the FitRecipe and add the FitContribution.
8081
recipe = FitRecipe()
8182
recipe.addContribution(contribution)
8283

83-
## Configure the fit variables
84+
# Configure the fit variables
8485

8586
# The PDFGenerator class holds the ParameterSet associated with the
8687
# Structure passed above in a data member named "phase". (We could have

doc/examples/crystalpdfall.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
)
3131
from diffpy.srfit.pdf import PDFGenerator, PDFParser
3232

33-
####### Example Code
33+
######
34+
# Example Code
3435

3536

3637
def makeProfile(datafile):
@@ -56,14 +57,14 @@ def makeRecipe(
5657
):
5758
"""Create a fitting recipe for crystalline PDF data."""
5859

59-
## The Profiles
60+
# The Profiles
6061
# We need a profile for each data set.
6162
xprofile_ni = makeProfile(xdata_ni)
6263
xprofile_si = makeProfile(xdata_si)
6364
nprofile_ni = makeProfile(ndata_ni)
6465
xprofile_sini = makeProfile(xdata_sini)
6566

66-
## The ProfileGenerators
67+
# The ProfileGenerators
6768
# We create one for each phase and share the phases.
6869
xgenerator_ni = PDFGenerator("xG_ni")
6970
stru = loadCrystal(ciffile_ni)
@@ -84,7 +85,7 @@ def makeRecipe(
8485
xgenerator_sini_si = PDFGenerator("xG_sini_si")
8586
xgenerator_sini_si.setPhase(phase_si)
8687

87-
## The FitContributions
88+
# The FitContributions
8889
# We one of these for each data set.
8990
xcontribution_ni = makeContribution("xnickel", xgenerator_ni, xprofile_ni)
9091
xcontribution_si = makeContribution("xsilicon", xgenerator_si, xprofile_si)

doc/examples/crystalpdfobjcryst.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
)
3232
from diffpy.srfit.pdf import PDFGenerator, PDFParser
3333

34-
####### Example Code
34+
######
35+
# Example Code
3536

3637

3738
def makeRecipe(ciffile, datname):
3839
"""Create a fitting recipe for crystalline PDF data."""
3940

40-
## The Profile
41+
# The Profile
4142
# This will be used to store the observed and calculated PDF profile.
4243
profile = Profile()
4344

@@ -50,7 +51,7 @@ def makeRecipe(ciffile, datname):
5051
profile.loadParsedData(parser)
5152
profile.setCalculationRange(xmax=20)
5253

53-
## The ProfileGenerator
54+
# The ProfileGenerator
5455
# This time we use the CreateCrystalFromCIF method of pyobjcryst.crystal to
5556
# create a Crystal object. That object is passed to the PDFGenerator as in
5657
# the previous example.
@@ -59,7 +60,7 @@ def makeRecipe(ciffile, datname):
5960
generator.setStructure(stru)
6061
generator.setQmax(40.0)
6162

62-
## The FitContribution
63+
# The FitContribution
6364
contribution = FitContribution("nickel")
6465
contribution.addProfileGenerator(generator)
6566
contribution.setProfile(profile, xname="r")
@@ -68,7 +69,7 @@ def makeRecipe(ciffile, datname):
6869
recipe = FitRecipe()
6970
recipe.addContribution(contribution)
7071

71-
## Configure the fit variables
72+
# Configure the fit variables
7273

7374
# As before, we get a handle to the structure parameter set. In this case,
7475
# it is a ObjCrystCrystalParSet instance that was created when we called

doc/examples/crystalpdftwodata.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
)
3333
from diffpy.srfit.pdf import PDFGenerator, PDFParser
3434

35-
####### Example Code
35+
######
36+
# Example Code
3637

3738

3839
def makeRecipe(ciffile, xdatname, ndatname):
3940
"""Create a fitting recipe for crystalline PDF data."""
4041

41-
## The Profiles
42+
# The Profiles
4243
# We need a profile for each data set. This means that we will need two
4344
# FitContributions as well.
4445
xprofile = Profile()
@@ -55,7 +56,7 @@ def makeRecipe(ciffile, xdatname, ndatname):
5556
nprofile.loadParsedData(parser)
5657
nprofile.setCalculationRange(xmax=20)
5758

58-
## The ProfileGenerators
59+
# The ProfileGenerators
5960
# We need one of these for the x-ray data.
6061
xgenerator = PDFGenerator("G")
6162
stru = loadCrystal(ciffile)
@@ -80,7 +81,7 @@ def makeRecipe(ciffile, xdatname, ndatname):
8081
ngenerator = PDFGenerator("G")
8182
ngenerator.setPhase(xgenerator.phase)
8283

83-
## The FitContributions
84+
# The FitContributions
8485
# We associate the x-ray PDFGenerator and Profile in one FitContribution...
8586
xcontribution = FitContribution("xnickel")
8687
xcontribution.addProfileGenerator(xgenerator)

doc/examples/crystalpdftwophase.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
)
3333
from diffpy.srfit.pdf import PDFGenerator, PDFParser
3434

35-
####### Example Code
35+
######
36+
# Example Code
3637

3738

3839
def makeRecipe(niciffile, siciffile, datname):
3940
"""Create a fitting recipe for crystalline PDF data."""
4041

41-
## The Profile
42+
# The Profile
4243
profile = Profile()
4344

4445
# Load data and add it to the profile
@@ -47,7 +48,7 @@ def makeRecipe(niciffile, siciffile, datname):
4748
profile.loadParsedData(parser)
4849
profile.setCalculationRange(xmax=20)
4950

50-
## The ProfileGenerator
51+
# The ProfileGenerator
5152
# In order to fit two phases simultaneously, we must use two PDFGenerators.
5253
# PDFGenerator is designed to take care of as little information as it
5354
# must. (Don't do too much, and do it well.) A PDFGenerator can generate
@@ -67,7 +68,7 @@ def makeRecipe(niciffile, siciffile, datname):
6768
stru = loadCrystal(siciffile)
6869
generator_si.setStructure(stru)
6970

70-
## The FitContribution
71+
# The FitContribution
7172
# Add both generators to the FitContribution. Add the Profile. This will
7273
# send the metadata to the generators.
7374
contribution = FitContribution("nisi")
@@ -85,7 +86,7 @@ def makeRecipe(niciffile, siciffile, datname):
8586
recipe = FitRecipe()
8687
recipe.addContribution(contribution)
8788

88-
## Configure the fit variables
89+
# Configure the fit variables
8990
# Start by configuring the scale factor and resolution factors.
9091
# We want the sum of the phase scale factors to be 1.
9192
recipe.newVar("scale_ni", 0.1)

doc/examples/debyemodel.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
500.0 0.03946 0.00250
5858
"""
5959

60-
####### Example Code
60+
######
61+
# Example Code
6162

6263

6364
def makeRecipe():
@@ -84,7 +85,7 @@ def makeRecipe():
8485
won't do that here.
8586
"""
8687

87-
## The Profile
88+
# The Profile
8889
# Create a Profile to hold the experimental and calculated signal.
8990
profile = Profile()
9091

@@ -94,7 +95,7 @@ def makeRecipe():
9495
x, y, dy = numpy.hsplit(xydy, 3)
9596
profile.setObservedProfile(x, y, dy)
9697

97-
## The FitContribution
98+
# The FitContribution
9899
# The FitContribution associates the profile with the Debye function.
99100
contribution = FitContribution("pb")
100101
# Tell the contribution about the Profile. We will need to use the
@@ -127,7 +128,7 @@ def makeRecipe():
127128
# can specify that as well.
128129
contribution.setEquation("debye(T, 207.2, abs(thetaD)) + offset")
129130

130-
## The FitRecipe
131+
# The FitRecipe
131132
# The FitRecipe lets us define what we want to fit. It is where we can
132133
# create variables, constraints and restraints. If we had multiple profiles
133134
# to fit simultaneously, the contribution from each could be added to the

doc/examples/debyemodelII.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737

3838
from diffpy.srfit.fitbase import FitRecipe, FitResults
3939

40-
####### Example Code
40+
######
41+
# Example Code
4142

4243

4344
def makeRecipeII():

doc/examples/ellipsoidsas.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424
)
2525
from diffpy.srfit.sas import SASGenerator, SASParser
2626

27-
####### Example Code
27+
######
28+
# Example Code
2829

2930

3031
def makeRecipe(datname):
3132
"""Create a fitting recipe for ellipsoidal SAS data."""
3233

33-
## The Profile
34+
# The Profile
3435
# This will be used to store the observed and calculated I(Q) data.
3536
profile = Profile()
3637

@@ -40,7 +41,7 @@ def makeRecipe(datname):
4041
parser.parseFile(datname)
4142
profile.loadParsedData(parser)
4243

43-
## The ProfileGenerator
44+
# The ProfileGenerator
4445
# The SASGenerator is for configuring and calculating a SAS profile. We use
4546
# a sas model to configure and serve as the calculation engine of the
4647
# generator. This allows us to use the full sas model creation
@@ -52,7 +53,7 @@ def makeRecipe(datname):
5253
model = EllipsoidModel()
5354
generator = SASGenerator("generator", model)
5455

55-
## The FitContribution
56+
# The FitContribution
5657
# Here we associate the Profile and ProfileGenerator, as has been done
5758
# before.
5859
contribution = FitContribution("ellipsoid")
@@ -65,11 +66,11 @@ def makeRecipe(datname):
6566
# will have on the estimated parameter uncertainties.
6667
contribution.setResidualEquation("log(eq) - log(y)")
6768

68-
## Make the FitRecipe and add the FitContribution.
69+
# Make the FitRecipe and add the FitContribution.
6970
recipe = FitRecipe()
7071
recipe.addContribution(contribution)
7172

72-
## Configure the fit variables
73+
# Configure the fit variables
7374
# The SASGenerator uses the parameters from the params and dispersion
7475
# attributes of the model. These vary from model to model, but are adopted
7576
# as SrFit Parameters within the generator. Whereas the dispersion

doc/examples/gaussiangenerator.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
ProfileGenerator,
4848
)
4949

50-
####### Example Code
50+
######
51+
# Example Code
5152

5253

5354
class GaussianGenerator(ProfileGenerator):
@@ -124,20 +125,20 @@ def makeRecipe():
124125
associate this with a Profile, and use this to define a FitRecipe.
125126
"""
126127

127-
## The Profile
128+
# The Profile
128129
# Create a Profile to hold the experimental and calculated signal.
129130
profile = Profile()
130131

131132
# Load data and add it to the profile. This uses the loadtxt function from
132133
# numpy.
133134
profile.loadtxt("data/gaussian.dat")
134135

135-
## The ProfileGenerator
136+
# The ProfileGenerator
136137
# Create a GaussianGenerator named "g". This will be the name we use to
137138
# refer to the generator from within the FitContribution equation.
138139
generator = GaussianGenerator("g")
139140

140-
## The FitContribution
141+
# The FitContribution
141142
# Create a FitContribution that will associate the Profile with the
142143
# GaussianGenerator. The GaussianGenerator will be accessible as an
143144
# attribute of the FitContribution by its name ("g"). Note that this will
@@ -146,7 +147,7 @@ def makeRecipe():
146147
contribution.addProfileGenerator(generator)
147148
contribution.setProfile(profile)
148149

149-
## The FitRecipe
150+
# The FitRecipe
150151
# Now we create the FitRecipe and add the FitContribution.
151152
recipe = FitRecipe()
152153
recipe.addContribution(contribution)

doc/examples/gaussianrecipe.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
Profile,
5353
)
5454

55-
####### Example Code
55+
######
56+
# Example Code
5657

5758

5859
def main():
@@ -95,15 +96,15 @@ def makeRecipe():
9596
optimized. See the 'scipyOptimize' function.
9697
"""
9798

98-
## The Profile
99+
# The Profile
99100
# Create a Profile to hold the experimental and calculated signal.
100101
profile = Profile()
101102

102103
# Load data and add it to the profile. This uses the loadtxt function from
103104
# numpy.
104105
profile.loadtxt("data/gaussian.dat")
105106

106-
## The FitContribution
107+
# The FitContribution
107108
# The FitContribution associates the Profile with a fitting equation. The
108109
# FitContribution also stores the parameters of the fitting equation. We
109110
# give our FitContribution then name "g1". We will be able to access the
@@ -131,7 +132,7 @@ def makeRecipe():
131132
# attribute. Parameters also have a 'name' attribute.
132133
contribution.A.value = 1.0
133134

134-
## The FitRecipe
135+
# The FitRecipe
135136
# The FitRecipe lets us define what we want to fit. It is where we can
136137
# create variables, constraints and restraints.
137138
recipe = FitRecipe()

doc/examples/interface.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
Profile,
2626
)
2727

28-
####### Example Code
28+
######
29+
# Example Code
2930

3031

3132
def main():

0 commit comments

Comments
 (0)