Skip to content

Commit 3d81f89

Browse files
committed
chore: docformatter
1 parent a68f06d commit 3d81f89

File tree

8 files changed

+50
-29
lines changed

8 files changed

+50
-29
lines changed

src/diffpy/srfit/equation/equationmod.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@
2020
Arguments. The non-constant arguments are accessible as attributes of the
2121
Equation instance and can be passed as arguments to __call__.
2222
23-
Example > # make a Literal tree. Here's a simple one > add = AdditionOperator()
24-
> a = Argument(name="a") # Don't forget to name these! > b = Argument(name="b")
25-
> add.addLiteral(a) > add.addLiteral(b) > # make an Equation instance and pass
26-
the root > eq = Equation(root = add) > eq(a=3, b=4) # returns 7 > eq(a=2) #
27-
remembers b=4, returns 6 > eq.a.setValue(-3) > eq.b.setValue(3) > eq() # uses
28-
last assignment of a and b, returns 0
23+
Example
24+
> # make a Literal tree. Here's a simple one
25+
> add = AdditionOperator()
26+
> a = Argument(name="a") # Don't forget to name these!
27+
> b = Argument(name="b")
28+
> add.addLiteral(a)
29+
> add.addLiteral(b)
30+
> # make an Equation instance and pass the root > eq = Equation(root = add)
31+
> eq(a=3, b=4) # returns 7 > eq(a=2) # remembers b=4, returns 6
32+
> eq.a.setValue(-3)
33+
> eq.b.setValue(3)
34+
> eq() # uses last assignment of a and b, returns 0
2935
3036
See the class documentation for more information.
3137
"""

src/diffpy/srfit/equation/literals/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
2222
Literal networks can be evaluated or have other actions performed on them by
2323
Visitors (in diffpy.srfit.equation.visitors). The Literal-Visitor relationship
24-
is that described by the Visitor pattern (
25-
26-
http://en.wikipedia.org/wiki/Visitor_pattern).
24+
is that described by the Visitor pattern
25+
(http://en.wikipedia.org/wiki/Visitor_pattern).
2726
"""
2827

2928
__all__ = ["Argument", "Operator", "BinaryOperator", "CustomOperator",

src/diffpy/srfit/equation/visitors/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
(diffpy.srfit.equation.literals). Visitors are used to validate, print and
2020
extracting Arguments from Literal networks.
2121
22-
The Literal-Visitor relationship is that described by the Visitor pattern (
23-
24-
http://en.wikipedia.org/wiki/Visitor_pattern).
22+
The Literal-Visitor relationship is that described by the Visitor pattern
23+
(http://en.wikipedia.org/wiki/Visitor_pattern).
2524
"""
2625

2726
from __future__ import print_function

src/diffpy/srfit/fitbase/constraint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def update(self):
8686
def _validate(self):
8787
"""Validate my state.
8888
89-
This validates that par is not None. This validates eq.
89+
This validates that par is not None.
90+
This validates eq.
9091
9192
Raises SrFitError if validation fails.
9293
"""

src/diffpy/srfit/fitbase/profile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ def setCalculationPoints(self, x):
273273
def loadtxt(self, *args, **kw):
274274
"""Use numpy.loadtxt to load data.
275275
276-
Arguments are passed to numpy.loadtxt. unpack = True is enforced. The
277-
first two arrays returned by numpy.loadtxt are assumed to be x and y.
276+
Arguments are passed to numpy.loadtxt. unpack = True is enforced.
277+
The first two arrays returned by numpy.loadtxt are assumed to be x and y.
278278
If there is a third array, it is assumed to by dy. Any other arrays are
279279
ignored. These are passed to setObservedProfile.
280280

src/diffpy/srfit/fitbase/profilegenerator.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@
2121
2222
To define a ProfileGenerator, one must implement the required Parameters and
2323
ParameterSets as well as overload the __call__ method with the calculation. A
24-
very simple example is > class Gaussian(ProfileGenerator): > > def
25-
__init__(self): > # Initialize and give this a name >
26-
ProfileGenerator.__init__(self, "g") > # Add amplitude, center and width
27-
parameters > self.newParameter("amp", 0) >
28-
self.newParameter("center", 0) > self.newParameter("width", 0) > >
29-
def __call__(self, x): > a = self.amp.getValue() > x0 =
30-
self.center.getValue() > w = self.width.getValue() > return a *
31-
exp(-0.5*((x-x0)/w)**2)
24+
very simple example is
25+
> class Gaussian(ProfileGenerator):
26+
>
27+
> def __init__(self):
28+
> # Initialize and give this a name
29+
> ProfileGenerator.__init__(self, "g")
30+
> # Add amplitude, center and width parameters
31+
> self.newParameter("amp", 0)
32+
> self.newParameter("center", 0)
33+
> self.newParameter("width", 0)
34+
>
35+
> def __call__(self, x):
36+
> a = self.amp.getValue()
37+
> x0 = self.center.getValue()
38+
> w = self.width.getValue()
39+
> return a * exp(-0.5*((x-x0)/w)**2)
3240
3341
More examples can be found in the example directory of the documentation.
3442
"""

src/diffpy/srfit/fitbase/simplerecipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def setCalculationPoints(self, x):
158158
def loadtxt(self, *args, **kw):
159159
"""Use numpy.loadtxt to load data.
160160
161-
Arguments are passed to numpy.loadtxt. unpack = True is enforced. The
162-
first two arrays returned by numpy.loadtxt are assumed to be x and y.
161+
Arguments are passed to numpy.loadtxt. unpack = True is enforced.
162+
The first two arrays returned by numpy.loadtxt are assumed to be x and y.
163163
If there is a third array, it is assumed to by dy. Any other arrays are
164164
ignored. These are passed to setObservedProfile.
165165

src/diffpy/srfit/tests/speedtest.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,15 @@ def profileTest():
432432
for i in range(1, 9):
433433
weightedTest(i)
434434
"""
435-
"""From diffpy.srfit.equation.builder import EquationFactory import random
436-
import cProfile cProfile.run('profileTest()', 'prof') import pstats p =
437-
pstats.Stats('prof') p.strip_dirs() p.sort_stats('time') p.print_stats(10)
438-
profileTest()"""
435+
"""
436+
from diffpy.srfit.equation.builder import EquationFactory
437+
import random
438+
import cProfile
439+
cProfile.run('profileTest()', 'prof')
440+
import pstats
441+
p = pstats.Stats('prof')
442+
p.strip_dirs()
443+
p.sort_stats('time')
444+
p.print_stats(10)
445+
profileTest()
446+
"""

0 commit comments

Comments
 (0)