Skip to content

Commit 18a1002

Browse files
[pre-commit.ci] auto fixes from pre-commit hooks
1 parent 2b647c9 commit 18a1002

32 files changed

+323
-218
lines changed

doc/examples/fit_initial.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
##############################################################################
1313
"""Example of peak fitting C60 PDF (unnormalized) with unreliable uncertainties.
1414
15-
Peak fitting in SrMise means fitting a model of initial peaks, which may be
16-
specified manually or estimated with a clustering-based convenience function,
17-
just as with specifying initial peaks for peak extraction. Unlike peak
18-
extraction, it does not attempt to add or remove peaks, apply termination
19-
ripples, or otherwise do anything beyond chi-square fitting using the specified
20-
grid."""
15+
Peak fitting in SrMise means fitting a model of initial peaks, which may be specified manually or estimated with a
16+
clustering-based convenience function, just as with specifying initial peaks for peak extraction. Unlike peak
17+
extraction, it does not attempt to add or remove peaks, apply termination ripples, or otherwise do anything beyond
18+
chi-square fitting using the specified grid.
19+
"""
2120

2221
import matplotlib.pyplot as plt
2322

doc/examples/multimodel_known_dG1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# See LICENSE.txt for license information.
1111
#
1212
##############################################################################
13-
"""Extract multiple models from crystalline PDF with known uncertainties for
14-
use in later AIC-driven multimodeling analysis.
13+
"""Extract multiple models from crystalline PDF with known uncertainties for use in later AIC-driven multimodeling
14+
analysis.
1515
1616
The multimodel approach generates many models of varying complexity by assuming
1717
a range of experimental uncertainties are physically plausible. This example

doc/examples/multimodel_unknown_dG1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# See LICENSE.txt for license information.
1111
#
1212
##############################################################################
13-
"""Extract multiple models from nanoparticle PDF with unknown uncertainties for
14-
use in later AIC-driven multimodeling analysis.
13+
"""Extract multiple models from nanoparticle PDF with unknown uncertainties for use in later AIC-driven
14+
multimodeling analysis.
1515
1616
The multimodel approach generates many models of varying complexity by assuming
1717
a range of experimental uncertainties are physically plausible. This example

doc/examples/multimodel_unknown_dG2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
# See LICENSE.txt for license information.
1111
#
1212
##############################################################################
13-
"""AIC-driven multimodel analysis of nanoparticle PDF with unknown
14-
uncertainties.
13+
"""AIC-driven multimodel analysis of nanoparticle PDF with unknown uncertainties.
1514
1615
The multimodel approach generates many models of varying complexity by assuming
1716
a range of experimental uncertainties are physically plausible. This example

doc/examples/parameter_summary.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
nyquist (whether to use Nyquist sampling)
2626
supersample (minimum amount to oversample during initial stages)
2727
cres (clustering resolution)
28-
initial_peaks (peaks already assumed to exist during extraction)"""
28+
initial_peaks (peaks already assumed to exist during extraction)
29+
"""
2930

3031
import matplotlib.pyplot as plt
3132

src/diffpy/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
1615
"""Blank namespace package for module diffpy."""
1716

1817

src/diffpy/srmise/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
1615
"""Peak extraction and peak fitting tool for atomic pair distribution functions."""
1716

1817
# package version

src/diffpy/srmise/applications/plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# See LICENSE.txt for license information.
1212
#
1313
##############################################################################
14-
"""plot extracted peaks and comparison to ideal distances (if given)"""
14+
"""Plot extracted peaks and comparison to ideal distances (if given)"""
1515

1616
import optparse
1717
import sys
@@ -175,7 +175,7 @@ def labelallsubplots():
175175

176176

177177
def makeplot(ppe_or_stability, ip=None, **kwds):
178-
"""Plot stuff"""
178+
"""Plot stuff."""
179179
if isinstance(ppe_or_stability, PeakStability):
180180
stability = ppe_or_stability
181181
ppe = stability.ppe

src/diffpy/srmise/basefunction.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(
7676
base=None,
7777
Cache=None,
7878
):
79-
"""Set parameterdict defined by subclass
79+
"""Set parameterdict defined by subclass.
8080
8181
Parameters
8282
----------
@@ -159,32 +159,50 @@ def __init__(
159159
# "Virtual" class methods ####
160160

161161
def actualize(self, *args, **kwds):
162-
"""Create ModelPart instance of self with given parameters. ("Virtual" method)"""
162+
"""Create ModelPart instance of self with given parameters.
163+
164+
("Virtual" method)
165+
"""
163166
emsg = "actualize() must be implemented in a BaseFunction subclass."
164167
raise NotImplementedError(emsg)
165168

166169
def estimate_parameters(self, *args, **kwds):
167-
"""Estimate BaseFunction parameters from supplied data. ("Virtual" method)"""
170+
"""Estimate BaseFunction parameters from supplied data.
171+
172+
("Virtual" method)
173+
"""
168174
emsg = "estimate_parameters() must be implemented in a BaseFunction subclass."
169175
raise NotImplementedError(emsg)
170176

171177
def _jacobianraw(self, *args, **kwds):
172-
"""Calculate the jacobian. ("Virtual" method)"""
178+
"""Calculate the jacobian.
179+
180+
("Virtual" method)
181+
"""
173182
emsg = "_jacobianraw() must be implemented in a BaseFunction subclass."
174183
raise NotImplementedError(emsg)
175184

176185
def _transform_derivativesraw(self, *args, **kwds):
177-
"""Convert BaseFunction parameters to another form. ("Virtual" method)"""
186+
"""Convert BaseFunction parameters to another form.
187+
188+
("Virtual" method)
189+
"""
178190
emsg = "transform_parameters() must be implemented in a BaseFunction subclass."
179191
raise NotImplementedError(emsg)
180192

181193
def _transform_parametersraw(self, *args, **kwds):
182-
"""Convert BaseFunction parameters to another form. ("Virtual" method)"""
194+
"""Convert BaseFunction parameters to another form.
195+
196+
("Virtual" method)
197+
"""
183198
emsg = "transform_parameters() must be implemented in a BaseFunction subclass."
184199
raise NotImplementedError(emsg)
185200

186201
def _valueraw(self, *args, **kwds):
187-
"""Calculate value of function. ("Virtual" method)"""
202+
"""Calculate value of function.
203+
204+
("Virtual" method)
205+
"""
188206
emsg = "_valueraw must() be implemented in a BaseFunction subclass."
189207
raise NotImplementedError(emsg)
190208

@@ -373,7 +391,7 @@ def pgradient(self, p, format):
373391
return
374392

375393
def getmodule(self):
376-
"""Return 'diffpy.srmise.basefunction'"""
394+
"""Return 'diffpy.srmise.basefunction'."""
377395
return "diffpy.srmise.basefunction"
378396

379397
def writestr(self, baselist):
@@ -480,7 +498,8 @@ def safefunctionlist(fs):
480498
is guaranteed to be safe for saving/reinstantiating peak functions.
481499
482500
Parameters
483-
fs: List of BaseFunction instances."""
501+
fs: List of BaseFunction instances.
502+
"""
484503
fsafe = []
485504
for f in fs:
486505
BaseFunction.safefunction(f, fsafe)

src/diffpy/srmise/baselines/arbitrary.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,12 @@
2626
class Arbitrary(BaselineFunction):
2727
"""Methods for evaluating a baseline from an arbitrary function.
2828
29-
Supports baseline calculations with arbitrary functions. These functions,
30-
if implemented, must have the following signatures and return values:
31-
valuef(pars, x) ==> numpy.array of length x if x is a sequence
32-
==> number if x is a number
33-
jacobianf(pars, x, free) ==> list, each element a numpy.array of length x if
34-
x is a sequence or None if value of free for
35-
that parameter is False.
36-
==> list, each element a number if x is a number
37-
or None if value of free for that parameter is
38-
False
39-
estimatef(x, y) ==> numpy.array of length npars
29+
Supports baseline calculations with arbitrary functions. These functions, if implemented, must have the
30+
following signatures and return values: valuef(pars, x) ==> numpy.array of length x if x is a sequence
31+
==> number if x is a number jacobianf(pars, x, free) ==> list, each element a numpy.array of length x if
32+
x is a sequence or None if value of free for that parameter is False.
33+
==> list, each element a number if x is a number or None if value of free for that
34+
parameter is False estimatef(x, y) ==> numpy.array of length npars
4035
"""
4136

4237
def __init__(self, npars, valuef, jacobianf=None, estimatef=None, Cache=None):
@@ -117,7 +112,8 @@ def estimate_parameters(self, r, y):
117112
The numpy array of parameters in the default internal format.
118113
119114
we raise NotImplementedError if no estimation routine is defined, and
120-
SrMiseEstimationError if parameters cannot be estimated for any other."""
115+
SrMiseEstimationError if parameters cannot be estimated for any other.
116+
"""
121117
if self.estimatef is None:
122118
emsg = "No estimation routine provided to Arbitrary."
123119
raise NotImplementedError(emsg)

0 commit comments

Comments
 (0)