Skip to content

Commit 47b4763

Browse files
correction on the definition of res and numpydoc build (#112)
1 parent 4576c13 commit 47b4763

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

src/diffpy/srmise/dataclusters.py

+38-15
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ class DataClusters:
4040
The array of r values.
4141
y : sequence of y values
4242
The array of PDF values, G(r)
43-
res : int
44-
The clustering resolution, i.e., the number of points another point has to
43+
res : float
44+
The clustering resolution, i.e., the number of distance another point has to
4545
be away from the center of an existing cluster to before a new cluster is
46-
formed. A value of zero allows every point to be cluster.
46+
formed. A value of zero allows every point to be a cluster.
4747
data_order : array
4848
The array of x, y indices ordered by decreasing y
49-
clusters :
49+
clusters : ndarray
5050
The array of cluster ranges
51-
current_idx - int
51+
current_idx : int
5252
The index of data_order currently considered
5353
"""
5454

@@ -61,8 +61,8 @@ def __init__(self, x, y, res):
6161
The array of r values.
6262
y : sequence of y values
6363
The array of PDF values, G(r)
64-
res : int
65-
The clustering resolution, i.e., the number of points another point has to
64+
res : float
65+
The clustering resolution, i.e., the distance another point has to
6666
be away from the center of an existing cluster to before a new cluster is
6767
formed. A value of zero allows every point to be cluster.
6868
"""
@@ -143,8 +143,8 @@ def _setdata(self, x, y, res):
143143
The array of r values.
144144
y : sequence of y values
145145
The array of PDF values, G(r)
146-
res : int
147-
The clustering resolution, i.e., the number of points another point has to
146+
res : float
147+
The clustering resolution, i.e., the distance another point has to
148148
be away from the center of an existing cluster to before a new cluster is
149149
formed. A value of zero allows every point to be cluster.
150150
"""
@@ -230,13 +230,18 @@ def find_nearest_cluster2(self, x):
230230
"""Return [cluster index, distance] for cluster nearest to x.
231231
232232
Parameters
233-
x - Coordinate of point of interest
233+
----------
234+
x : ndarray
235+
Coordinate of point of interest
234236
235237
The distance is positive/negative if the point is right/left of the
236238
nearest cluster. If the point is within an existing cluster then
237239
distance = 0.
238240
239-
Return None if no clusters exists.
241+
Returns
242+
-------
243+
array-like
244+
The index of the nearest cluster, and the distance for cluster nearest to x. None if no cluster
240245
"""
241246
if self.status == self.INIT:
242247
raise Exception("Cannot cluster next point while status is INIT.")
@@ -259,9 +264,14 @@ def find_nearest_cluster(self, idx):
259264
distance = 0.
260265
261266
Parameters
262-
idx - index of point in self.x of interest.
267+
----------
268+
idx : array-like
269+
index of point in self.x of interest.
263270
264-
Return None if no clusters exist.
271+
Returns
272+
-------
273+
array-like
274+
The array of cluster index and the distacne to the nearest cluster. None if no clusters exist.
265275
"""
266276
if self.status == self.INIT:
267277
raise Exception("Cannot cluster next point while status is INIT.")
@@ -302,7 +312,14 @@ def cluster_is_full(self, cluster_idx):
302312
boundaries.
303313
304314
Parameters
305-
cluster_idx - The index of the cluster to test
315+
----------
316+
cluster_idx : array-like
317+
The index of the cluster to test
318+
319+
Returns
320+
-------
321+
bools
322+
True if the cluster is full, False otherwise
306323
"""
307324
if cluster_idx > 0:
308325
low = self.clusters[cluster_idx - 1, 1] + 1
@@ -321,7 +338,13 @@ def combine_clusters(self, combine):
321338
unclustered points between them.
322339
323340
Parameters
324-
combine - [[leftmost_idx1, ..., rightmost_idx1], ...]
341+
----------
342+
combine : ndarray
343+
[[leftmost_idx1, ..., rightmost_idx1], ...]
344+
345+
Returns
346+
-------
347+
None
325348
"""
326349
# Ensure that the same clusters aren't combined multiple times.
327350
combine_flat = np.array(combine).ravel()

0 commit comments

Comments
 (0)