diffpy.srfit 3.1.0rc0__tar.gz → 3.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/LICENSE.rst +9 -13
  2. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/PKG-INFO +2 -2
  3. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/pyproject.toml +1 -1
  4. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/requirements/docs.txt +1 -1
  5. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/builder.py +109 -62
  6. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/equationmod.py +33 -16
  7. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/literals/argument.py +14 -6
  8. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/literals/literal.py +5 -2
  9. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/literals/operators.py +4 -1
  10. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/visitors/__init__.py +11 -5
  11. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/visitors/argfinder.py +10 -5
  12. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/visitors/printer.py +8 -4
  13. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/visitors/swapper.py +13 -6
  14. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/visitors/validator.py +7 -4
  15. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/calculator.py +40 -20
  16. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/configurable.py +5 -3
  17. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/constraint.py +6 -3
  18. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/fitcontribution.py +88 -50
  19. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/fithook.py +40 -14
  20. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/fitrecipe.py +178 -93
  21. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/fitresults.py +148 -71
  22. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/parameter.py +120 -62
  23. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/parameterset.py +38 -17
  24. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/profile.py +76 -38
  25. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/profilegenerator.py +72 -37
  26. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/profileparser.py +58 -35
  27. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/recipeorganizer.py +201 -98
  28. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/restraint.py +41 -21
  29. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/simplerecipe.py +95 -52
  30. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/interface/interface.py +4 -1
  31. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/pdf/basepdfgenerator.py +89 -53
  32. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/pdf/characteristicfunctions.py +74 -27
  33. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/pdf/debyepdfgenerator.py +74 -45
  34. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/pdf/pdfcontribution.py +103 -62
  35. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/pdf/pdfgenerator.py +45 -27
  36. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/pdf/pdfparser.py +70 -38
  37. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/sas/prcalculator.py +40 -23
  38. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/sas/sasgenerator.py +17 -11
  39. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/sas/sasimport.py +4 -1
  40. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/sas/sasparameter.py +29 -15
  41. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/sas/sasparser.py +67 -34
  42. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/sas/sasprofile.py +56 -30
  43. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/__init__.py +6 -2
  44. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/basestructureparset.py +4 -2
  45. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/bvsrestraint.py +27 -14
  46. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/cctbxparset.py +55 -22
  47. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/diffpyparset.py +81 -42
  48. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/objcrystparset.py +690 -381
  49. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/sgconstraints.py +153 -84
  50. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/structure/srrealparset.py +16 -9
  51. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/util/inpututils.py +6 -2
  52. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/util/tagmanager.py +23 -9
  53. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy.srfit.egg-info/PKG-INFO +2 -2
  54. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy.srfit.egg-info/SOURCES.txt +1 -1
  55. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/conftest.py +5 -3
  56. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_characteristicfunctions.py +49 -15
  57. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_pdf.py +9 -6
  58. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_sas.py +17 -8
  59. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/AUTHORS.rst +0 -0
  60. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/LICENSE_DANSE.rst +0 -0
  61. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/MANIFEST.in +0 -0
  62. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/README.rst +0 -0
  63. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/requirements/build.txt +0 -0
  64. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/requirements/conda.txt +0 -0
  65. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/requirements/pip.txt +0 -0
  66. /diffpy_srfit-3.1.0rc0/requirements/test.txt → /diffpy_srfit-3.2.0/requirements/tests.txt +0 -0
  67. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/setup.cfg +0 -0
  68. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/__init__.py +0 -0
  69. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/__init__.py +0 -0
  70. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/__init__.py +0 -0
  71. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/literals/__init__.py +0 -0
  72. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/literals/abcs.py +0 -0
  73. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/equation/visitors/visitor.py +0 -0
  74. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/exceptions.py +0 -0
  75. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/__init__.py +0 -0
  76. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/fitbase/validatable.py +0 -0
  77. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/interface/__init__.py +0 -0
  78. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/pdf/__init__.py +0 -0
  79. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/sas/__init__.py +0 -0
  80. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/util/__init__.py +0 -0
  81. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/util/argbinders.py +0 -0
  82. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/util/nameutils.py +0 -0
  83. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/util/observable.py +0 -0
  84. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/util/weakrefcallable.py +0 -0
  85. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy/srfit/version.py +0 -0
  86. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy.srfit.egg-info/dependency_links.txt +0 -0
  87. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy.srfit.egg-info/requires.txt +0 -0
  88. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/src/diffpy.srfit.egg-info/top_level.txt +0 -0
  89. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/__init__.py +0 -0
  90. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/debug.py +0 -0
  91. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/run.py +0 -0
  92. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_builder.py +0 -0
  93. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_constraint.py +0 -0
  94. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_contribution.py +0 -0
  95. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_diffpyparset.py +0 -0
  96. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_equation.py +0 -0
  97. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_fitrecipe.py +0 -0
  98. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_fitresults.py +0 -0
  99. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_literals.py +0 -0
  100. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_objcrystparset.py +0 -0
  101. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_parameter.py +0 -0
  102. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_parameterset.py +0 -0
  103. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_profile.py +0 -0
  104. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_profilegenerator.py +0 -0
  105. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_recipeorganizer.py +0 -0
  106. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_restraint.py +0 -0
  107. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_sgconstraints.py +0 -0
  108. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_speed.py +0 -0
  109. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_tagmanager.py +0 -0
  110. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_version.py +0 -0
  111. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_visitors.py +0 -0
  112. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/test_weakrefcallable.py +0 -0
  113. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/LaMnO3.stru +0 -0
  114. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/ni-q27r100-neutron.gr +0 -0
  115. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/ni.cif +0 -0
  116. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/results.res +0 -0
  117. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/sas_ascii_test_1.txt +0 -0
  118. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/sas_ellipsoid_testdata.txt +0 -0
  119. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/si-q27r60-xray.gr +0 -0
  120. {diffpy_srfit-3.1.0rc0 → diffpy_srfit-3.2.0}/tests/testdata/testdata.txt +0 -0
@@ -1,18 +1,14 @@
1
1
  OPEN SOURCE LICENSE AGREEMENT
2
2
  =============================
3
3
 
4
- Copyright (c) 2009-2011, University of Tennessee
5
- Copyright (c) 1989, 1991 Free Software Foundation, Inc.
6
- Copyright (c) 2006, The Regents of the University of California through
7
- Lawrence Berkeley National Laboratory
8
- Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP")
9
- Copyright (c) 2006-2007, Board of Trustees of Michigan State University
10
- Copyright (c) 2008-2012, The Trustees of Columbia University in the City
11
- of New York
12
- Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National
13
- Laboratory
14
- Copyright (c) 2020-2025, The Trustees of Columbia University in the City
15
- of New York
4
+ - Copyright (c) 2009-2011, University of Tennessee
5
+ - Copyright (c) 1989, 1991 Free Software Foundation, Inc.
6
+ - Copyright (c) 2006, The Regents of the University of California through Lawrence Berkeley National Laboratory
7
+ - Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP")
8
+ - Copyright (c) 2006-2007, Board of Trustees of Michigan State University
9
+ - Copyright (c) 2008-2012, The Trustees of Columbia University in the City of New York
10
+ - Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory
11
+ - Copyright (c) 2020-2025, The Trustees of Columbia University in the City of New York
16
12
 
17
13
 
18
14
  The "DiffPy-CMI" is distributed subject to the following license conditions:
@@ -20,7 +16,7 @@ The "DiffPy-CMI" is distributed subject to the following license conditions:
20
16
 
21
17
  SOFTWARE LICENSE AGREEMENT
22
18
 
23
- Software: DiffPy-CMI
19
+ **Software:** DiffPy-CMI
24
20
 
25
21
 
26
22
  (1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffpy.srfit
3
- Version: 3.1.0rc0
3
+ Version: 3.2.0
4
4
  Summary: Configurable code for solving atomic structures.
5
5
  Author-email: Simon Billinge <sb2896@columbia.edu>
6
6
  Maintainer-email: Simon Billinge <sb2896@columbia.edu>
@@ -11,7 +11,7 @@ Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Console
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Intended Audience :: Science/Research
14
- Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: License :: Free To Use But Restricted
15
15
  Classifier: Operating System :: MacOS :: MacOS X
16
16
  Classifier: Operating System :: Microsoft :: Windows
17
17
  Classifier: Operating System :: POSIX
@@ -20,7 +20,7 @@ classifiers = [
20
20
  'Environment :: Console',
21
21
  'Intended Audience :: Developers',
22
22
  'Intended Audience :: Science/Research',
23
- 'License :: OSI Approved :: BSD License',
23
+ 'License :: Free To Use But Restricted',
24
24
  'Operating System :: MacOS :: MacOS X',
25
25
  'Operating System :: Microsoft :: Windows',
26
26
  'Operating System :: POSIX',
@@ -2,4 +2,4 @@ sphinx
2
2
  sphinx_rtd_theme
3
3
  sphinx-copybutton
4
4
  doctr
5
- m2r
5
+ m2r2
@@ -109,12 +109,17 @@ _builders = {}
109
109
  class EquationFactory(object):
110
110
  """A Factory for equations.
111
111
 
112
- builders -- A dictionary of BaseBuilders registered with the
113
- factory, indexed by name.
114
- newargs -- A set of new arguments created by makeEquation. This is
115
- redefined whenever makeEquation is called.
116
- equations -- Set of equations that have been built by the
117
- EquationFactory.
112
+ Attributes
113
+ ----------
114
+ builders
115
+ A dictionary of BaseBuilders registered with the
116
+ factory, indexed by name.
117
+ newargs
118
+ A set of new arguments created by makeEquation. This is
119
+ redefined whenever makeEquation is called.
120
+ equations
121
+ Set of equations that have been built by the
122
+ EquationFactory.
118
123
  """
119
124
 
120
125
  symbols = ("+", "-", "*", "/", "**", "%", "|")
@@ -137,21 +142,26 @@ class EquationFactory(object):
137
142
  ):
138
143
  """Make an equation from an equation string.
139
144
 
140
- Arguments
141
- eqstr -- An equation in string form using standard python
142
- syntax. The equation string can use any function
143
- registered literal or function, including numpy ufuncs
144
- that are automatically registered.
145
- buildargs -- A flag indicating whether missing arguments can be
146
- created by the Factory (default True). If False, then
147
- the a ValueError will be raised if there are undefined
148
- arguments in the eqstr. Built arguments will be of type
149
- argclass.
150
- argclass -- Class to use when creating new Arguments (default
151
- diffpy.srfit.equation.literals.Argument). The class
152
- constructor must accept the 'name' key word.
153
- argkw -- Key word dictionary to pass to the argclass constructor
154
- (default {}).
145
+ Parameters
146
+ ----------
147
+ eqstr
148
+ An equation in string form using standard python
149
+ syntax. The equation string can use any function
150
+ registered literal or function, including numpy ufuncs
151
+ that are automatically registered.
152
+ buildargs
153
+ A flag indicating whether missing arguments can be
154
+ created by the Factory (default True). If False, then
155
+ the a ValueError will be raised if there are undefined
156
+ arguments in the eqstr. Built arguments will be of type
157
+ argclass.
158
+ argclass
159
+ Class to use when creating new Arguments (default
160
+ diffpy.srfit.equation.literals.Argument). The class
161
+ constructor must accept the 'name' key word.
162
+ argkw
163
+ Key word dictionary to pass to the argclass constructor
164
+ (default {}).
155
165
 
156
166
  Returns a callable Literal representing the equation string.
157
167
  """
@@ -202,11 +212,16 @@ class EquationFactory(object):
202
212
 
203
213
  This will register a builder for the function.
204
214
 
205
- name -- The name of the function
206
- func -- A callable python object
207
- argnames-- The argument names for func. If these names do not
208
- correspond to builders, then new constants with value 0
209
- will be created for each name.
215
+ Attributes
216
+ ----------
217
+ name
218
+ The name of the function
219
+ func
220
+ A callable python object
221
+ argnames
222
+ The argument names for func. If these names do not
223
+ correspond to builders, then new constants with value 0
224
+ will be created for each name.
210
225
 
211
226
  Returns the registered builder.
212
227
  """
@@ -293,17 +308,22 @@ class EquationFactory(object):
293
308
  arguments, and creates new arguments if allowed. In the process it
294
309
  rebuilds the newargs attribute.
295
310
 
296
- Arguments
297
- eqstr -- An equation in string as specified in the makeEquation
298
- method.
299
- buildargs -- A flag indicating whether missing arguments can be
300
- created by the factory. If False, then the a ValueError
301
- will be raised if there are undefined arguments in the
302
- eqstr.
303
- argclass -- Class to use when creating new Arguments. The class
304
- constructor must accept the 'name' key word.
305
- argkw -- Key word dictionary to pass to the argclass
306
- constructor.
311
+ Parameters
312
+ ----------
313
+ eqstr
314
+ An equation in string as specified in the makeEquation
315
+ method.
316
+ buildargs
317
+ A flag indicating whether missing arguments can be
318
+ created by the factory. If False, then the a ValueError
319
+ will be raised if there are undefined arguments in the
320
+ eqstr.
321
+ argclass
322
+ Class to use when creating new Arguments. The class
323
+ constructor must accept the 'name' key word.
324
+ argkw
325
+ Key word dictionary to pass to the argclass
326
+ constructor.
307
327
 
308
328
  Raises ValueError if new arguments must be created, but this is
309
329
  disallowed due to the buildargs flag.
@@ -392,7 +412,9 @@ class BaseBuilder(object):
392
412
  arguments can be other BaseBuilder instances or constants.
393
413
 
394
414
  Attributes
395
- literal -- The equation Literal being built by this instance.
415
+ ----------
416
+ literal
417
+ The equation Literal being built by this instance.
396
418
  """
397
419
 
398
420
  def __init__(self):
@@ -424,8 +446,11 @@ class BaseBuilder(object):
424
446
 
425
447
  Other can be an BaseBuilder or a constant.
426
448
 
427
- onleft -- Indicates that the operator was passed on the left side
428
- (default True).
449
+ Attributes
450
+ ----------
451
+ onleft
452
+ Indicates that the operator was passed on the left side
453
+ (default True).
429
454
  """
430
455
  # Create the Operator
431
456
  op = OperatorClass()
@@ -520,20 +545,27 @@ class ArgumentBuilder(BaseBuilder):
520
545
  arguments can be other BaseBuilder instances or constants.
521
546
 
522
547
  Attributes
523
- literal -- The Argument wrapped by this instance.
548
+ ----------
549
+ literal
550
+ The Argument wrapped by this instance.
524
551
  """
525
552
 
526
553
  def __init__(self, value=None, name=None, const=False, arg=None):
527
554
  """Create an ArgumentBuilder instance, containing a new Argument.
528
555
 
529
- Arguments
530
- value -- The value of the wrapped Argument (float, default None)
531
- name -- The name of the wrapped Argument (string, default None)
532
- const -- Flag indicating whether the Argument is constant (bool,
533
- default False)
534
- arg -- A pre-defined Argument to use. If this is None (default),
535
- then a new Argument will be created from value, name and
536
- const.
556
+ Parameters
557
+ ----------
558
+ value
559
+ The value of the wrapped Argument (float, default None)
560
+ name
561
+ The name of the wrapped Argument (string, default None)
562
+ const
563
+ Flag indicating whether the Argument is constant (bool,
564
+ default False)
565
+ arg
566
+ A pre-defined Argument to use. If this is None (default),
567
+ then a new Argument will be created from value, name and
568
+ const.
537
569
  """
538
570
  BaseBuilder.__init__(self)
539
571
  if arg is None:
@@ -552,19 +584,25 @@ class OperatorBuilder(BaseBuilder):
552
584
  """BaseBuilder wrapper around an Operator literal.
553
585
 
554
586
  Attributes
555
- literal -- The Operator wrapped by this instance.
556
- name -- The name of the operator to be wrapped
587
+ ----------
588
+ literal
589
+ The Operator wrapped by this instance.
590
+ name
591
+ The name of the operator to be wrapped
557
592
  """
558
593
 
559
594
  def __init__(self, name, op=None):
560
595
  """Wrap an Operator or a function by name.
561
596
 
562
- Arguments
563
- name -- The name of the wrapped Operator
564
- op -- If specified, this sets the literal attribute as this
565
- operator (default None). Otherwise, the name is assumed to
566
- be that of a numpy ufunc, which is used to specify the
567
- Operator.
597
+ Parameters
598
+ ----------
599
+ name
600
+ The name of the wrapped Operator
601
+ op
602
+ If specified, this sets the literal attribute as this
603
+ operator (default None). Otherwise, the name is assumed to
604
+ be that of a numpy ufunc, which is used to specify the
605
+ Operator.
568
606
  """
569
607
  BaseBuilder.__init__(self)
570
608
  self.name = name
@@ -576,7 +614,10 @@ class OperatorBuilder(BaseBuilder):
576
614
 
577
615
  This creates a new builder that encapsulates the operation.
578
616
 
579
- args -- Arguments of the operation.
617
+ Attributes
618
+ ----------
619
+ args
620
+ Arguments of the operation.
580
621
 
581
622
  Raises ValueError if self.literal.nin >= 0 and len(args) != op.nin
582
623
  """
@@ -637,10 +678,16 @@ def wrapOperator(name, op):
637
678
  def wrapFunction(name, func, nin=2, nout=1):
638
679
  """Wrap a function in an OperatorBuilder instance.
639
680
 
640
- name -- The name of the function
641
- func -- A callable python object
642
- nin -- The number of input arguments (default 2)
643
- nout -- The number of return values (default 1)
681
+ Attributes
682
+ ----------
683
+ name
684
+ The name of the function
685
+ func
686
+ A callable python object
687
+ nin
688
+ The number of input arguments (default 2)
689
+ nout
690
+ The number of return values (default 1)
644
691
 
645
692
  Returns the OperatorBuilder instance that wraps the function.
646
693
  """
@@ -56,19 +56,32 @@ class Equation(Operator):
56
56
  accepts new argument values for the literal tree.
57
57
 
58
58
  Attributes
59
- root -- The root Literal of the equation tree
60
- argdict -- An OrderedDict of Arguments from the root.
61
- args -- Property that gets the values of argdict.
59
+ ----------
60
+ root
61
+ The root Literal of the equation tree
62
+ argdict
63
+ An OrderedDict of Arguments from the root.
64
+ args
65
+ Property that gets the values of argdict.
62
66
 
63
67
  Operator Attributes
64
- args -- List of Literal arguments, set with 'addLiteral'
65
- name -- A name for this operator. e.g. "add" or "sin"
66
- nin -- Number of inputs (<1 means this is variable)
67
- nout -- Number of outputs
68
- operation -- Function that performs the operation. e.g. numpy.add.
69
- symbol -- The symbolic representation. e.g. "+" or "sin".
70
- _value -- The value of the Operator.
71
- value -- Property for 'getValue'.
68
+ -------------------
69
+ args
70
+ List of Literal arguments, set with 'addLiteral'
71
+ name
72
+ A name for this operator. e.g. "add" or "sin"
73
+ nin
74
+ Number of inputs (<1 means this is variable)
75
+ nout
76
+ Number of outputs
77
+ operation
78
+ Function that performs the operation. e.g. numpy.add.
79
+ symbol
80
+ The symbolic representation. e.g. "+" or "sin".
81
+ _value
82
+ The value of the Operator.
83
+ value
84
+ Property for 'getValue'.
72
85
  """
73
86
 
74
87
  # define abstract attributes from the Operator base.
@@ -78,10 +91,14 @@ class Equation(Operator):
78
91
  def __init__(self, name=None, root=None):
79
92
  """Initialize.
80
93
 
81
- name -- A name for this Equation.
82
- root -- The root node of the Literal tree (default None). If root
83
- is not passed here, you must call the 'setRoot' method to
84
- set or change the root node.
94
+ Attributes
95
+ ----------
96
+ name
97
+ A name for this Equation.
98
+ root
99
+ The root node of the Literal tree (default None). If root
100
+ is not passed here, you must call the 'setRoot' method to
101
+ set or change the root node.
85
102
  """
86
103
  # Operator stuff. We circumvent Operator.__init__ since we're using
87
104
  # args as a property. We cannot set it, as the Operator tries to do.
@@ -127,7 +144,7 @@ class Equation(Operator):
127
144
  )
128
145
 
129
146
  def __dir__(self):
130
- "Return sorted list of attributes for this object."
147
+ """Return sorted list of attributes for this object."""
131
148
  rv = set(dir(type(self)))
132
149
  rv.update(self.__dict__, self.argdict)
133
150
  rv = sorted(rv)
@@ -30,11 +30,16 @@ class Argument(Literal, ArgumentABC):
30
30
  """Argument class.
31
31
 
32
32
  Attributes
33
- name -- A name for this Argument.
34
- const -- A flag indicating whether this is considered a constant.
35
- Constants may be given special treatment by the Visitors.
36
- _value -- The value of the Argument. Modified with 'setValue'.
37
- value -- Property for 'getValue' and 'setValue'.
33
+ ----------
34
+ name
35
+ A name for this Argument.
36
+ const
37
+ A flag indicating whether this is considered a constant.
38
+ Constants may be given special treatment by the Visitors.
39
+ _value
40
+ The value of the Argument. Modified with 'setValue'.
41
+ value
42
+ Property for 'getValue' and 'setValue'.
38
43
  """
39
44
 
40
45
  const = None
@@ -57,7 +62,10 @@ class Argument(Literal, ArgumentABC):
57
62
  def setValue(self, val):
58
63
  """Set the value of the Literal.
59
64
 
60
- val -- The value to assign
65
+ Attributes
66
+ ----------
67
+ val
68
+ The value to assign
61
69
  """
62
70
  if isinstance(self._value, ndarray) or isinstance(val, ndarray):
63
71
  notequiv = not array_equal(self._value, val)
@@ -31,8 +31,11 @@ class Literal(Observable, LiteralABC):
31
31
  Literal derives from Observable. See diffpy.srfit.util.observable.
32
32
 
33
33
  Attributes
34
- name -- A name for this Literal (default None).
35
- _value -- The value of the Literal.
34
+ ----------
35
+ name
36
+ A name for this Literal (default None).
37
+ _value
38
+ The value of the Literal.
36
39
  """
37
40
 
38
41
  name = None
@@ -345,7 +345,10 @@ class UFuncOperator(Operator):
345
345
 
346
346
  Arguments
347
347
 
348
- op -- A numpy ufunc
348
+ Attributes
349
+ ----------
350
+ op
351
+ A numpy ufunc
349
352
  """
350
353
  Operator.__init__(self, name=op.__name__)
351
354
  self.symbol = op.__name__
@@ -35,8 +35,11 @@ from diffpy.srfit.equation.visitors.validator import Validator
35
35
  def getArgs(literal, getconsts=True):
36
36
  """Get the Arguments of a Literal tree.
37
37
 
38
- getconsts -- If True (default), then Arguments designated as constant
39
- are also retrieved.
38
+ Attributes
39
+ ----------
40
+ getconsts
41
+ If True (default), then Arguments designated as constant
42
+ are also retrieved.
40
43
 
41
44
  Returns a list of Arguments searched for depth-first.
42
45
  """
@@ -47,9 +50,12 @@ def getArgs(literal, getconsts=True):
47
50
  def getExpression(literal, eqskip=None):
48
51
  """Get math expression string from the Literal tree object.
49
52
 
50
- eqskip -- regular expression pattern for Equation objects that should
51
- be printed under their own name. Expand all Equation objects
52
- when None.
53
+ Attributes
54
+ ----------
55
+ eqskip
56
+ regular expression pattern for Equation objects that should
57
+ be printed under their own name. Expand all Equation objects
58
+ when None.
53
59
 
54
60
  Return string.
55
61
  """
@@ -26,16 +26,21 @@ class ArgFinder(Visitor):
26
26
  """ArgFinder extracts Arguments from a Literal tree.
27
27
 
28
28
  Attributes
29
- args -- The list of collected Arguments
30
- getconsts -- Flag indicating whether to grab constant arguments.
29
+ ----------
30
+ args
31
+ The list of collected Arguments
32
+ getconsts
33
+ Flag indicating whether to grab constant arguments.
31
34
  """
32
35
 
33
36
  def __init__(self, getconsts=True):
34
37
  """Initialize.
35
38
 
36
- Arguments
37
- getconsts -- Flag indicating whether to parse constant arguments
38
- (default True).
39
+ Parameters
40
+ ----------
41
+ getconsts
42
+ Flag indicating whether to parse constant arguments
43
+ (default True).
39
44
  """
40
45
  self.args = []
41
46
  self.getconsts = getconsts
@@ -30,10 +30,14 @@ class Printer(Visitor):
30
30
 
31
31
  Attributes:
32
32
 
33
- eqskip -- regular expression pattern for Equation objects that should
34
- not be expanded, but printed under their own name. Expand
35
- all equations when None.
36
- output -- The output generated by the printer.
33
+ Attributes
34
+ ----------
35
+ eqskip
36
+ regular expression pattern for Equation objects that should
37
+ not be expanded, but printed under their own name. Expand
38
+ all equations when None.
39
+ output
40
+ The output generated by the printer.
37
41
  """
38
42
 
39
43
  # store compiled RE pattern for eqskip or None when none.
@@ -25,17 +25,24 @@ class Swapper(Visitor):
25
25
  Note that this cannot swap out a root node of a literal tree. This case
26
26
  must be tested for explicitly.
27
27
 
28
- Attributes:
29
- newlit -- The literal to be placed into the literal tree.
30
- oldlit -- The literal to be replaced.
28
+ Attributes
29
+ ----------
30
+ newlit
31
+ The literal to be placed into the literal tree.
32
+ oldlit
33
+ The literal to be replaced.
31
34
  """
32
35
 
33
36
  def __init__(self, oldlit, newlit):
34
37
  """Initialize.
35
38
 
36
- oldlit -- The literal to be replaced.
37
- newlit -- The literal to be placed into the literal tree. See the
38
- class for how the replacement takes place.
39
+ Attributes
40
+ ----------
41
+ oldlit
42
+ The literal to be replaced.
43
+ newlit
44
+ The literal to be placed into the literal tree. See the
45
+ class for how the replacement takes place.
39
46
  """
40
47
 
41
48
  self.newlit = newlit
@@ -34,10 +34,13 @@ msg = "'%s' does not have the interface required by '%s'"
34
34
  class Validator(Visitor):
35
35
  """Validator error for checking validity of an equation tree.
36
36
 
37
- Attributes:
38
- errors -- List of strings describing errors.
39
- _nin -- Variable for counting the number input arguments for an
40
- operator.
37
+ Attributes
38
+ ----------
39
+ errors
40
+ List of strings describing errors.
41
+ _nin
42
+ Variable for counting the number input arguments for an
43
+ operator.
41
44
  """
42
45
 
43
46
  def __init__(self):
@@ -36,30 +36,50 @@ class Calculator(Operator, ParameterSet):
36
36
  calculate a generic signal.
37
37
 
38
38
  Attributes
39
- name -- A name for this organizer.
40
- meta -- A dictionary of metadata needed by the calculator.
41
- _calculators -- A managed dictionary of Calculators, indexed by name.
42
- _constraints -- A set of constrained Parameters. Constraints can be
43
- added using the 'constrain' methods.
44
- _parameters -- A managed OrderedDict of contained Parameters.
45
- _parsets -- A managed dictionary of ParameterSets.
46
- _restraints -- A set of Restraints. Restraints can be added using the
47
- 'restrain' or 'confine' methods.
48
- _eqfactory -- A diffpy.srfit.equation.builder.EquationFactory
49
- instance that is used create Equations from string.
39
+ ----------
40
+ name
41
+ A name for this organizer.
42
+ meta
43
+ A dictionary of metadata needed by the calculator.
44
+ _calculators
45
+ A managed dictionary of Calculators, indexed by name.
46
+ _constraints
47
+ A set of constrained Parameters. Constraints can be
48
+ added using the 'constrain' methods.
49
+ _parameters
50
+ A managed OrderedDict of contained Parameters.
51
+ _parsets
52
+ A managed dictionary of ParameterSets.
53
+ _restraints
54
+ A set of Restraints. Restraints can be added using the
55
+ 'restrain' or 'confine' methods.
56
+ _eqfactory
57
+ A diffpy.srfit.equation.builder.EquationFactory
58
+ instance that is used create Equations from string.
50
59
 
51
60
  Operator Attributes
52
- args -- List of Literal arguments
53
- nin -- Number of inputs (<1 means this is variable)
54
- nout -- Number of outputs (1)
55
- operation -- Function that performs the operation, self.__call__
56
- symbol -- Same as name
57
- _value -- The value of the Operator.
58
- value -- Property for 'getValue'.
61
+ -------------------
62
+ args
63
+ List of Literal arguments
64
+ nin
65
+ Number of inputs (<1 means this is variable)
66
+ nout
67
+ Number of outputs (1)
68
+ operation
69
+ Function that performs the operation, self.__call__
70
+ symbol
71
+ Same as name
72
+ _value
73
+ The value of the Operator.
74
+ value
75
+ Property for 'getValue'.
59
76
 
60
77
  Properties
61
- names -- Variable names (read only). See getNames.
62
- values -- Variable values (read only). See getValues.
78
+ ----------
79
+ names
80
+ Variable names (read only). See getNames.
81
+ values
82
+ Variable values (read only). See getValues.
63
83
  """
64
84
 
65
85
  # define abstract attributes from the Operator base.