Skip to content

Commit a9eae82

Browse files
committed
chore: rebuild the documentation with proper metadata handling
1 parent cb27d55 commit a9eae82

10 files changed

Lines changed: 112 additions & 49 deletions

File tree

docs/source/conf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
napoleon_custom_sections = [
7878
("Managed Parameters", "Attributes"),
7979
("Usable Metadata", "Attributes"),
80-
("General Metadata", "Attributes"),
80+
("General Metadata", "params_style"),
8181
("Metadata", "Attributes"),
8282
("Properties", "Attributes"),
8383
("Operator Attributes", "Attributes"),
@@ -336,4 +336,7 @@
336336

337337

338338
# Example configuration for intersphinx: refer to the Python standard library.
339-
# intersphinx_mapping = {'http://docs.python.org/': None}
339+
intersphinx_mapping = {
340+
"python": ("https://docs.python.org/3", None),
341+
"numpy": ("https://numpy.org/doc/stable/", None),
342+
}

news/documentation-metadata.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* No News Added: rebuild the documentation with proper metadata handling
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/srfit/fitbase/fitrecipe.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,17 @@ def residual(self, p=[]):
292292
----------
293293
p
294294
The list of current variable values, provided in the same order
295-
as the '_parameters' list. If p is an empty iterable (default),
296-
then it is assumed that the parameters have already been
297-
updated in some other way, and the explicit update within this
298-
function is skipped.
295+
as the ``_parameters`` list. If ``p`` is an empty iterable
296+
(default), then it is assumed that the parameters have already
297+
been updated in some other way, and the explicit update within
298+
this function is skipped.
299299
300+
Notes
301+
-----
300302
The residual is by default the weighted concatenation of each
301-
FitContribution's residual, plus the value of each restraint. The array
302-
returned, denoted chiv, is such that
303-
dot(chiv, chiv) = chi^2 + restraints.
303+
:class:`FitContribution` residual, plus the value of each restraint.
304+
The returned array ``chiv`` satisfies
305+
``dot(chiv, chiv) = chi^2 + restraints``.
304306
"""
305307

306308
# Prepare, if necessary
@@ -343,15 +345,17 @@ def scalarResidual(self, p=[]):
343345
----------
344346
p
345347
The list of current variable values, provided in the same order
346-
as the '_parameters' list. If p is an empty iterable (default),
347-
then it is assumed that the parameters have already been
348-
updated in some other way, and the explicit update within this
349-
function is skipped.
348+
as the ``_parameters`` list. If ``p`` is an empty iterable
349+
(default), then it is assumed that the parameters have already
350+
been updated in some other way, and the explicit update within
351+
this function is skipped.
350352
353+
Notes
354+
-----
351355
The residual is by default the weighted concatenation of each
352-
FitContribution's residual, plus the value of each restraint. The array
353-
returned, denoted chiv, is such that
354-
dot(chiv, chiv) = chi^2 + restraints.
356+
:class:`FitContribution` residual, plus the value of each restraint.
357+
The returned array, denoted ``chiv``, is such that
358+
``dot(chiv, chiv) = chi^2 + restraints``.
355359
"""
356360
chiv = self.residual(p)
357361
return dot(chiv, chiv)

src/diffpy/srfit/fitbase/profile.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,16 @@ def setObservedProfile(self, xobs, yobs, dyobs=None):
146146
Numpy array of the observed signal.
147147
dyobs
148148
Numpy array of the uncertainty in the observed signal. If
149-
dyobs is None (default), it will be set to 1 at each
150-
observed xobs.
149+
`dyobs` is None (default), it will be set to 1 at each
150+
observed `xobs`.
151151
152-
Raises ValueError if len(yobs) != len(xobs)
153-
Raises ValueError if dyobs != None and len(dyobs) != len(xobs)
152+
153+
Raises
154+
-----------
155+
ValueError
156+
if len(yobs) != len(xobs)
157+
ValueError
158+
if dyobs != None and len(dyobs) != len(xobs)
154159
"""
155160
if len(yobs) != len(xobs):
156161
raise ValueError("xobs and yobs are different lengths")
@@ -195,8 +200,8 @@ def setCalculationRange(self, xmin=None, xmax=None, dx=None):
195200
The sample spacing in the independent variable. When different
196201
from the data, resample the ``x`` as anchored at ``xmin``.
197202
198-
Note that xmin is always inclusive (unless clipped). xmax is inclusive
199-
if it is within the bounds of the observed data.
203+
Note that ``xmin`` is always inclusive (unless clipped).
204+
``xmax`` is inclusive if it is within the bounds of the observed data.
200205
201206
Raises
202207
------

src/diffpy/srfit/fitbase/profileparser.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def parseString(self, patstring):
105105
patstring
106106
A string containing the pattern
107107
108-
Raises ParseError if the string cannot be parsed
108+
Raises
109+
----------
110+
ParseError if the string cannot be parsed
109111
"""
110112
raise NotImplementedError()
111113

@@ -119,8 +121,12 @@ def parseFile(self, filename):
119121
filename
120122
The name of the file to parse
121123
122-
Raises IOError if the file cannot be read
123-
Raises ParseError if the file cannot be parsed
124+
Raises
125+
----------
126+
IOError
127+
if the file cannot be read
128+
ParseError
129+
if the file cannot be parsed
124130
"""
125131
infile = open(filename, "r")
126132
self._banks = []
@@ -153,7 +159,10 @@ def selectBank(self, index):
153159
index
154160
index of bank (integer, starting at 0).
155161
156-
Raises IndexError if requesting a bank that does not exist
162+
Raises
163+
----------
164+
IndexError
165+
if requesting a bank that does not exist
157166
"""
158167
if index is None:
159168
index = self._meta.get("bank", 0)
@@ -187,6 +196,8 @@ def getData(self, index=None):
187196
index of bank (integer, starting at 0, default None). If
188197
index is None then the currently selected bank is used.
189198
199+
Returns
200+
----------
190201
This returns (x, y, dx, dy) tuple for the bank. dx is 0 if it cannot
191202
be determined from the data format.
192203
"""

src/diffpy/srfit/fitbase/simplerecipe.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ def setObservedProfile(self, xobs, yobs, dyobs=None):
130130
dyobs is None (default), it will be set to 1 at each
131131
observed xobs.
132132
133-
134-
Raises ValueError if len(yobs) != len(xobs)
135-
Raises ValueError if dyobs != None and len(dyobs) != len(xobs)
133+
Raises
134+
----------
135+
ValueError
136+
if len(yobs) != len(xobs)
137+
ValueError
138+
if dyobs != None and len(dyobs) != len(xobs)
136139
"""
137140
return self.profile.setObservedProfile(xobs, yobs, dyobs)
138141

@@ -146,20 +149,20 @@ def setCalculationRange(self, xmin=None, xmax=None, dx=None):
146149
Parameters
147150
----------
148151
149-
xmin : float or "obs", optional
152+
xmin : float or `obs`, optional
150153
The minimum value of the independent variable. Keep the
151154
current minimum when not specified. If specified as "obs"
152155
reset to the minimum observed value.
153-
xmax : float or "obs", optional
156+
xmax : float or `obs`, optional
154157
The maximum value of the independent variable. Keep the
155158
current maximum when not specified. If specified as "obs"
156159
reset to the maximum observed value.
157-
dx : float or "obs", optional
160+
dx : float or `obs`, optional
158161
The sample spacing in the independent variable. When different
159162
from the data, resample the ``x`` as anchored at ``xmin``.
160163
161-
Note that xmin is always inclusive (unless clipped). xmax is inclusive
162-
if it is within the bounds of the observed data.
164+
Note that ``xmin`` is always inclusive (unless clipped).
165+
``xmax`` is inclusive if it is within the bounds of the observed data.
163166
164167
Raises
165168
------

src/diffpy/srfit/pdf/pdfcontribution.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,20 @@ def setCalculationRange(self, xmin=None, xmax=None, dx=None):
142142
Parameters
143143
----------
144144
145-
xmin : float or "obs", optional
145+
xmin : float or `obs`, optional
146146
The minimum value of the independent variable. Keep the
147147
current minimum when not specified. If specified as "obs"
148148
reset to the minimum observed value.
149-
xmax : float or "obs", optional
149+
xmax : float or `obs`, optional
150150
The maximum value of the independent variable. Keep the
151151
current maximum when not specified. If specified as "obs"
152152
reset to the maximum observed value.
153-
dx : float or "obs", optional
153+
dx : float or `obs`, optional
154154
The sample spacing in the independent variable. When different
155155
from the data, resample the ``x`` as anchored at ``xmin``.
156156
157-
Note that xmin is always inclusive (unless clipped). xmax is inclusive
158-
if it is within the bounds of the observed data.
157+
Note that ``xmin`` is always inclusive (unless clipped).
158+
``xmax`` is inclusive if it is within the bounds of the observed data.
159159
160160
Raises
161161
------

src/diffpy/srfit/pdf/pdfparser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ def parseString(self, patstring):
120120
patstring
121121
A string containing the pattern
122122
123-
Raises ParseError if the string cannot be parsed
123+
Raises
124+
----------
125+
ParseError
126+
if the string cannot be parsed
124127
"""
125128
# useful regex patterns:
126129
rx = {"f": r"[-+]?(\d+(\.\d*)?|\d*\.\d+)([eE][-+]?\d+)?"}

src/diffpy/srfit/sas/sasparser.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ def parseFile(self, filename):
100100
filename
101101
The name of the file to parse
102102
103-
Raises IOError if the file cannot be read
104-
Raises ParseError if the file cannot be parsed
103+
Raises
104+
----------
105+
IOError
106+
if the file cannot be read
107+
ParseError
108+
if the file cannot be parsed
105109
"""
106110
import sasdata.dataloader.loader as sas_dataloader
107111

@@ -142,7 +146,10 @@ def parseString(self, patstring):
142146
patstring
143147
A string containing the pattern
144148
145-
Raises ParseError if the string cannot be parsed
149+
Raises
150+
----------
151+
ParseError
152+
if the string cannot be parsed
146153
"""
147154
# This calls on parseFile, as that is how the sas data loader works.
148155
import tempfile

src/diffpy/srfit/sas/sasprofile.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,20 @@ def setObservedProfile(self, xobs, yobs, dyobs=None):
101101
Parameters
102102
----------
103103
xobs
104-
Numpy array of the independent variable
104+
Numpy array of the independent variable.
105105
yobs
106106
Numpy array of the observed signal.
107107
dyobs
108108
Numpy array of the uncertainty in the observed signal. If
109-
dyobs is None (default), it will be set to 1 at each
110-
observed xobs.
111-
112-
Raises ValueError if len(yobs) != len(xobs)
113-
Raises ValueError if dyobs != None and len(dyobs) != len(xobs)
109+
``dyobs`` is ``None`` (default), it will be set to 1 at each
110+
observed ``xobs``.
111+
112+
Raises
113+
------
114+
ValueError
115+
If ``len(yobs) != len(xobs)``.
116+
ValueError
117+
If ``dyobs is not None`` and ``len(dyobs) != len(xobs)``.
114118
"""
115119
Profile.setObservedProfile(self, xobs, yobs, dyobs)
116120
# Copy the arrays to the _datainfo attribute.

0 commit comments

Comments
 (0)