@@ -40,15 +40,15 @@ class DataClusters:
40
40
The array of r values.
41
41
y : sequence of y values
42
42
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
45
45
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.
47
47
data_order : array
48
48
The array of x, y indices ordered by decreasing y
49
- clusters :
49
+ clusters : ndarray
50
50
The array of cluster ranges
51
- current_idx - int
51
+ current_idx : int
52
52
The index of data_order currently considered
53
53
"""
54
54
@@ -61,8 +61,8 @@ def __init__(self, x, y, res):
61
61
The array of r values.
62
62
y : sequence of y values
63
63
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
66
66
be away from the center of an existing cluster to before a new cluster is
67
67
formed. A value of zero allows every point to be cluster.
68
68
"""
@@ -143,8 +143,8 @@ def _setdata(self, x, y, res):
143
143
The array of r values.
144
144
y : sequence of y values
145
145
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
148
148
be away from the center of an existing cluster to before a new cluster is
149
149
formed. A value of zero allows every point to be cluster.
150
150
"""
@@ -230,13 +230,18 @@ def find_nearest_cluster2(self, x):
230
230
"""Return [cluster index, distance] for cluster nearest to x.
231
231
232
232
Parameters
233
- x - Coordinate of point of interest
233
+ ----------
234
+ x : ndarray
235
+ Coordinate of point of interest
234
236
235
237
The distance is positive/negative if the point is right/left of the
236
238
nearest cluster. If the point is within an existing cluster then
237
239
distance = 0.
238
240
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
240
245
"""
241
246
if self .status == self .INIT :
242
247
raise Exception ("Cannot cluster next point while status is INIT." )
@@ -259,9 +264,14 @@ def find_nearest_cluster(self, idx):
259
264
distance = 0.
260
265
261
266
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.
263
270
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.
265
275
"""
266
276
if self .status == self .INIT :
267
277
raise Exception ("Cannot cluster next point while status is INIT." )
@@ -302,7 +312,14 @@ def cluster_is_full(self, cluster_idx):
302
312
boundaries.
303
313
304
314
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
306
323
"""
307
324
if cluster_idx > 0 :
308
325
low = self .clusters [cluster_idx - 1 , 1 ] + 1
@@ -321,7 +338,13 @@ def combine_clusters(self, combine):
321
338
unclustered points between them.
322
339
323
340
Parameters
324
- combine - [[leftmost_idx1, ..., rightmost_idx1], ...]
341
+ ----------
342
+ combine : ndarray
343
+ [[leftmost_idx1, ..., rightmost_idx1], ...]
344
+
345
+ Returns
346
+ -------
347
+ None
325
348
"""
326
349
# Ensure that the same clusters aren't combined multiple times.
327
350
combine_flat = np .array (combine ).ravel ()
0 commit comments