Skip to content

Commit 8716a9d

Browse files
numpydoc edition (#81)
* change peakextraction function to numpydoc * pre-commit run * remove unused import
1 parent abe0c2a commit 8716a9d

File tree

1 file changed

+51
-27
lines changed

1 file changed

+51
-27
lines changed

Diff for: src/diffpy/srmise/peakextraction.py

+51-27
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,44 @@
3333
class PeakExtraction(object):
3434
"""Class for peak extraction.
3535
36-
Data members
37-
x: x coordinates of the data
38-
y: y coordinates of the data
39-
dx: uncertainties in the x coordinates (not used)
40-
dy: uncertainties in the y coordinates
41-
effective_dy: uncertainties in the y coordinates actually used during extraction
42-
rng: [xmin, xmax] Range of x coordinates over which to extract peaks
43-
pf: Sequence of peak functions that can be extracted
44-
initial_peaks: Peaks present at start of extraction
45-
baseline: Baseline for data
46-
cres: Resolution of clustering
47-
error_method: ErrorEvaluator class used to compare models
36+
Parameters
37+
----------
38+
x : array-like
39+
The x coordinates of the data
40+
y : array-like
41+
The y coordinates of the data
42+
dx : array-like
43+
The uncertainties in the x coordinates (not used)
44+
dy : array-like
45+
The uncertainties in the y coordinates
46+
effective_dy : array-like
47+
The uncertainties in the y coordinates actually used during extraction
48+
rng : list
49+
The [xmin, xmax] Range of x coordinates over which to extract peaks
50+
pf : array-like
51+
The sequence of peak functions that can be extracted
52+
initial_peaks: Peaks object
53+
The peaks present at start of extraction
54+
baseline : Baseline object
55+
The baseline for data
56+
cres : float
57+
The resolution of clustering
58+
error_method : ErrorEvaluator class
59+
The Evaluation class used to compare models
4860
4961
Calculated members
50-
extracted: ModelCluster after extraction
51-
extraction_type: Type of extraction
62+
------------------
63+
extracted : ModelCluster object
64+
The ModelCluster object after extraction
65+
extraction_type : Type of extraction
5266
"""
5367

5468
def __init__(self, newvars=[]):
5569
"""Initialize PeakExtraction object.
5670
5771
Parameters
58-
newvars: Sequence of strings that represent additional extraction parameters."""
72+
newvars : array-like
73+
Sequence of strings that represent additional extraction parameters."""
5974
self.clear()
6075
self.extractvars = dict.fromkeys(
6176
(
@@ -77,7 +92,9 @@ def __init__(self, newvars=[]):
7792
return
7893

7994
def clear(self):
80-
"""Clear all members."""
95+
"""Clear all members.
96+
97+
The purpose of the method is to ensure the object is in initialized state."""
8198
self.x = None
8299
self.y = None
83100
self.dx = None
@@ -119,17 +136,24 @@ def setdata(self, x, y, dx=None, dy=None):
119136
def setvars(self, quiet=False, **kwds):
120137
"""Set one or more extraction variables.
121138
122-
Variables
123-
quiet: [False] Log changes quietly.
124-
125-
Keywords
126-
cres: The clustering resolution, must be > 0.
127-
effective_dy: The uncertainties actually used during extraction
128-
pf: Sequence of PeakFunctionBase subclass instances.
129-
baseline: Baseline instance or BaselineFunction instance (use built-in estimation)
130-
error_method: ErrorEvaluator subclass instance used to compare models (default AIC)
131-
initial_peaks: Peaks instance. These peaks are present at the start of extraction.
132-
rng: Sequence specifying the least and greatest x-values over which to extract peaks.
139+
Parameters
140+
----------
141+
quiet : bool
142+
The log changes quietly. Default is False.
143+
cres : float
144+
The clustering resolution, must be > 0.
145+
effective_dy : array-like
146+
The uncertainties actually used during extraction
147+
pf : list
148+
The sequence of PeakFunctionBase subclass instances.
149+
baseline : Baseline instance or BaselineFunction instance
150+
The Baseline instance or BaselineFunction instance that use built-in estimation
151+
error_method : ErrorEvaluator subclass instance
152+
The ErrorEvaluator subclass instance used to compare models. Default is AIC.
153+
initial_peaks : Peaks instance
154+
These peaks are present at the start of extraction.
155+
rng : array-like
156+
The sequence specifying the least and greatest x-values over which to extract peaks.
133157
"""
134158
for k, v in kwds.items():
135159
if k in self.extractvars:

0 commit comments

Comments
 (0)