Skip to content

Commit ee41be5

Browse files
try out py2 before py3 refactor to make sure correct workflow (#75)
1 parent e58e0c7 commit ee41be5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def _setdata(self, x, y, res):
172172
self.lastcluster_idx = None
173173
return
174174

175-
def next(self):
175+
def __next__(self):
176176
"""Cluster point with largest y-coordinate left, returning self.
177177
178178
next() always adds at least one additional point to the existing
@@ -217,7 +217,7 @@ def next(self):
217217
else:
218218
# insert right of nearest cluster
219219
self.lastcluster_idx = nearest_cluster[0] + 1
220-
self.clusters = np.insert(self.clusters, self.lastcluster_idx, [test_idx, test_idx], 0)
220+
self.clusters = np.insert(self.clusters, int(self.lastcluster_idx), [test_idx, test_idx], 0)
221221
return self
222222

223223
def makeclusters(self):
@@ -286,8 +286,8 @@ def find_nearest_cluster(self, idx):
286286
# Calculate which of the two nearest clusters is closer
287287
distances = np.array(
288288
[
289-
self.x[idx] - self.x[self.clusters[near_idx - 1, 1]],
290-
self.x[idx] - self.x[self.clusters[near_idx, 0]],
289+
self.x[idx] - self.x[self.clusters[int(near_idx) - 1, 1]],
290+
self.x[idx] - self.x[self.clusters[int(near_idx), 0]],
291291
]
292292
)
293293
if distances[0] < np.abs(distances[1]):

0 commit comments

Comments
 (0)