Skip to content

Commit 3f2ee00

Browse files
committed
Use the right variable in storing intersection coordinates
1 parent ce0b989 commit 3f2ee00

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

numba_celltree/query.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ def locate_edge(
280280
return -1, indices_size
281281
indices[indices_size, 0] = index
282282
indices[indices_size, 1] = bbox_index
283-
intersections[count, 0, 0] = c.x
284-
intersections[count, 0, 1] = c.y
285-
intersections[count, 1, 0] = d.x
286-
intersections[count, 1, 1] = d.y
283+
intersections[indices_size, 0, 0] = c.x
284+
intersections[indices_size, 0, 1] = c.y
285+
intersections[indices_size, 1, 0] = d.x
286+
intersections[indices_size, 1, 1] = d.y
287287
indices_size += 1
288288
count += 1
289289
continue

pixi.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_celltree.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import os
2+
3+
os.environ["NUMBA_DISABLE_JIT"] = "1"
4+
os.environ["NUMBA_NUM_THREADS"] = "1"
15
import pathlib
26
import shutil
37

@@ -371,18 +375,12 @@ def test_edge_lookup():
371375
expected_i = np.array([0, 1, 2])
372376
expected_j = np.array([0, 1, 2])
373377
expected_intersections = edge_coords[:3]
374-
print(actual_i, expected_i)
375-
print(actual_j, expected_j)
376-
print(intersections, expected_intersections)
377378
assert np.array_equal(actual_i, expected_i)
378379
assert np.array_equal(actual_j, expected_j)
379380
assert np.allclose(intersections, expected_intersections)
380381

381382
# Flip edge orientation
382383
actual_i, actual_j, intersections = tree.intersect_edges(edge_coords[:, ::-1])
383-
print(actual_i, expected_i)
384-
print(actual_j, expected_j)
385-
print(intersections, expected_intersections[:, ::-1])
386384
assert np.array_equal(actual_i, expected_i)
387385
assert np.array_equal(actual_j, expected_j)
388386
assert np.allclose(intersections, expected_intersections[:, ::-1])

tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_double_stack():
7575
stack, size = ut.push_both(stack, 1, 2, size)
7676
assert len(stack) == INITIAL_STACK_LENGTH * 2
7777
assert size == INITIAL_STACK_LENGTH + 1
78-
assert np.array_equal(stack[32], (1, 2))
78+
assert np.array_equal(stack[INITIAL_STACK_LENGTH], (1, 2))
7979

8080
a, b, size = ut.pop_both(stack, size)
8181
assert size == INITIAL_STACK_LENGTH
@@ -98,7 +98,7 @@ def test_triple_stack():
9898
stack, size = ut.push_triple(stack, 1, 2, 3, size)
9999
assert len(stack) == INITIAL_STACK_LENGTH * 2
100100
assert size == INITIAL_STACK_LENGTH + 1
101-
assert np.array_equal(stack[32], (1, 2, 3))
101+
assert np.array_equal(stack[INITIAL_STACK_LENGTH], (1, 2, 3))
102102

103103
a, b, c, size = ut.pop_triple(stack, size)
104104
assert size == INITIAL_STACK_LENGTH

0 commit comments

Comments
 (0)