Skip to content

Commit 381ef63

Browse files
[pre-commit.ci] auto fixes from pre-commit hooks
1 parent 166a214 commit 381ef63

34 files changed

+499
-291
lines changed

doc/examples/fit_initial.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
# See LICENSE.txt for license information.
1111
#
1212
##############################################################################
13-
"""Example of peak fitting C60 PDF (unnormalized) with unreliable uncertainties.
14-
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."""
13+
"""Example of peak fitting C60 PDF (unnormalized) with unreliable
14+
uncertainties.
15+
16+
Peak fitting in SrMise means fitting a model of initial peaks, which may
17+
be specified manually or estimated with a clustering-based convenience
18+
function, just as with specifying initial peaks for peak extraction.
19+
Unlike peak extraction, it does not attempt to add or remove peaks,
20+
apply termination ripples, or otherwise do anything beyond chi-square
21+
fitting using the specified grid.
22+
"""
2123

2224
import matplotlib.pyplot as plt
2325

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
14+
for use in later AIC-driven 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_known_dG2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
# See LICENSE.txt for license information.
1111
#
1212
##############################################################################
13-
"""AIC-driven multimodel analysis of crystalline PDF with known uncertainties.
13+
"""AIC-driven multimodel analysis of crystalline PDF with known
14+
uncertainties.
1415
1516
The multimodel approach generates many models of varying complexity by assuming
1617
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
14+
uncertainties for use in later AIC-driven 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/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

doc/examples/query_results.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
# See LICENSE.txt for license information.
1111
#
1212
##############################################################################
13-
"""Example of extracting multiple peaks and accessing results programmatically.
13+
"""Example of extracting multiple peaks and accessing results
14+
programmatically.
1415
1516
This example shows how to extract a range of peaks from a simple crystalline
1617
PDF using a crystalline baseline obtained from an existing trial. It shows

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
16-
"""Peak extraction and peak fitting tool for atomic pair distribution functions."""
15+
"""Peak extraction and peak fitting tool for atomic pair distribution
16+
functions."""
1717

1818
# package version
1919
from diffpy.srmise.version import __version__

src/diffpy/srmise/applications/plot.py

Lines changed: 4 additions & 3 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
@@ -530,7 +530,8 @@ def on_draw(event):
530530

531531

532532
def readcompare(filename):
533-
"""Returns a list of distances read from filename, otherwise None."""
533+
"""Returns a list of distances read from filename, otherwise
534+
None."""
534535

535536
# TODO: Make this safer
536537
try:

src/diffpy/srmise/basefunction.py

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
# See LICENSE.txt for license information.
1212
#
1313
##############################################################################
14-
"""Defines BaseFunction, the base class for mathematical functions in srmise."""
14+
"""Defines BaseFunction, the base class for mathematical functions in
15+
srmise."""
1516

1617
import logging
1718
import re
@@ -25,7 +26,8 @@
2526

2627

2728
class BaseFunction(object):
28-
"""Base class for mathematical functions which model numeric sequences.
29+
"""Base class for mathematical functions which model numeric
30+
sequences.
2931
3032
Attributes
3133
-------------
@@ -76,7 +78,7 @@ def __init__(
7678
base=None,
7779
Cache=None,
7880
):
79-
"""Set parameterdict defined by subclass
81+
"""Set parameterdict defined by subclass.
8082
8183
Parameters
8284
----------
@@ -159,32 +161,50 @@ def __init__(
159161
# "Virtual" class methods ####
160162

161163
def actualize(self, *args, **kwds):
162-
"""Create ModelPart instance of self with given parameters. ("Virtual" method)"""
164+
"""Create ModelPart instance of self with given parameters.
165+
166+
("Virtual" method)
167+
"""
163168
emsg = "actualize() must be implemented in a BaseFunction subclass."
164169
raise NotImplementedError(emsg)
165170

166171
def estimate_parameters(self, *args, **kwds):
167-
"""Estimate BaseFunction parameters from supplied data. ("Virtual" method)"""
172+
"""Estimate BaseFunction parameters from supplied data.
173+
174+
("Virtual" method)
175+
"""
168176
emsg = "estimate_parameters() must be implemented in a BaseFunction subclass."
169177
raise NotImplementedError(emsg)
170178

171179
def _jacobianraw(self, *args, **kwds):
172-
"""Calculate the jacobian. ("Virtual" method)"""
180+
"""Calculate the jacobian.
181+
182+
("Virtual" method)
183+
"""
173184
emsg = "_jacobianraw() must be implemented in a BaseFunction subclass."
174185
raise NotImplementedError(emsg)
175186

176187
def _transform_derivativesraw(self, *args, **kwds):
177-
"""Convert BaseFunction parameters to another form. ("Virtual" method)"""
188+
"""Convert BaseFunction parameters to another form.
189+
190+
("Virtual" method)
191+
"""
178192
emsg = "transform_parameters() must be implemented in a BaseFunction subclass."
179193
raise NotImplementedError(emsg)
180194

181195
def _transform_parametersraw(self, *args, **kwds):
182-
"""Convert BaseFunction parameters to another form. ("Virtual" method)"""
196+
"""Convert BaseFunction parameters to another form.
197+
198+
("Virtual" method)
199+
"""
183200
emsg = "transform_parameters() must be implemented in a BaseFunction subclass."
184201
raise NotImplementedError(emsg)
185202

186203
def _valueraw(self, *args, **kwds):
187-
"""Calculate value of function. ("Virtual" method)"""
204+
"""Calculate value of function.
205+
206+
("Virtual" method)
207+
"""
188208
emsg = "_valueraw must() be implemented in a BaseFunction subclass."
189209
raise NotImplementedError(emsg)
190210

@@ -225,7 +245,8 @@ def jacobian(self, p, r, rng=None):
225245
return self._jacobianraw(p.pars, r, p.free)
226246

227247
def transform_derivatives(self, pars, in_format=None, out_format=None):
228-
"""Return gradient matrix for pars converted from in_format to out_format.
248+
"""Return gradient matrix for pars converted from in_format to
249+
out_format.
229250
230251
Parameters
231252
----------
@@ -266,7 +287,8 @@ def transform_derivatives(self, pars, in_format=None, out_format=None):
266287
return self._transform_derivativesraw(pars, in_format=in_format, out_format=out_format)
267288

268289
def transform_parameters(self, pars, in_format=None, out_format=None):
269-
"""Return new sequence with pars converted from in_format to out_format.
290+
"""Return new sequence with pars converted from in_format to
291+
out_format.
270292
271293
Also restores parameters to a preferred range if it permits multiple
272294
values that correspond to the same physical result.
@@ -310,7 +332,8 @@ def transform_parameters(self, pars, in_format=None, out_format=None):
310332
return self._transform_parametersraw(pars, in_format=in_format, out_format=out_format)
311333

312334
def value(self, p, r, rng=None):
313-
"""Calculate value of ModelPart over r, possibly restricted by range.
335+
"""Calculate value of ModelPart over r, possibly restricted by
336+
range.
314337
315338
Parameters
316339
----------
@@ -345,7 +368,8 @@ def value(self, p, r, rng=None):
345368
return self._valueraw(p.pars, r)
346369

347370
def pgradient(self, p, format):
348-
"""Return gradient matrix of parameterization in specified format wrt "internal" format at p.
371+
"""Return gradient matrix of parameterization in specified
372+
format wrt "internal" format at p.
349373
350374
Consider the "internal" parameterization given by (i0, i1, ..., in).
351375
Each parameter in a different format, say (o0, o1, ..., om), is a
@@ -373,7 +397,7 @@ def pgradient(self, p, format):
373397
return
374398

375399
def getmodule(self):
376-
"""Return 'diffpy.srmise.basefunction'"""
400+
"""Return 'diffpy.srmise.basefunction'."""
377401
return "diffpy.srmise.basefunction"
378402

379403
def writestr(self, baselist):
@@ -473,22 +497,25 @@ def factory(functionstr, baselist):
473497

474498
@staticmethod
475499
def safefunctionlist(fs):
476-
"""Return list of BaseFunction instances where any dependencies occur earlier in list.
500+
"""Return list of BaseFunction instances where any dependencies
501+
occur earlier in list.
477502
478503
Any functions with hidden dependent functions (i.e. those not in fs)
479504
are included in the returned list. This list provides an order that
480505
is guaranteed to be safe for saving/reinstantiating peak functions.
481506
482507
Parameters
483-
fs: List of BaseFunction instances."""
508+
fs: List of BaseFunction instances.
509+
"""
484510
fsafe = []
485511
for f in fs:
486512
BaseFunction.safefunction(f, fsafe)
487513
return fsafe
488514

489515
@staticmethod
490516
def safefunction(f, fsafe):
491-
"""Append BaseFunction instance f to fsafe, but adding dependent functions first.
517+
"""Append BaseFunction instance f to fsafe, but adding dependent
518+
functions first.
492519
493520
Does not handle circular dependencies.
494521

0 commit comments

Comments
 (0)