Skip to content

Commit

Permalink
Use the right variable in storing intersection coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
Huite committed Oct 14, 2024
1 parent ce0b989 commit 3f2ee00
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
8 changes: 4 additions & 4 deletions numba_celltree/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ def locate_edge(
return -1, indices_size
indices[indices_size, 0] = index
indices[indices_size, 1] = bbox_index
intersections[count, 0, 0] = c.x
intersections[count, 0, 1] = c.y
intersections[count, 1, 0] = d.x
intersections[count, 1, 1] = d.y
intersections[indices_size, 0, 0] = c.x
intersections[indices_size, 0, 1] = c.y
intersections[indices_size, 1, 0] = d.x
intersections[indices_size, 1, 1] = d.y
indices_size += 1
count += 1
continue
Expand Down
2 changes: 1 addition & 1 deletion pixi.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12153,7 +12153,7 @@ packages:
timestamp: 1718888686982
- kind: pypi
name: numba-celltree
version: 0.2.0
version: 0.2.1
path: .
sha256: 2bd3845e2ef418031ed6547ed4a50525b73be2ccae26e299dad0f6f6f824e02f
requires_dist:
Expand Down
10 changes: 4 additions & 6 deletions tests/test_celltree.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import os

os.environ["NUMBA_DISABLE_JIT"] = "1"
os.environ["NUMBA_NUM_THREADS"] = "1"
import pathlib
import shutil

Expand Down Expand Up @@ -371,18 +375,12 @@ def test_edge_lookup():
expected_i = np.array([0, 1, 2])
expected_j = np.array([0, 1, 2])
expected_intersections = edge_coords[:3]
print(actual_i, expected_i)
print(actual_j, expected_j)
print(intersections, expected_intersections)
assert np.array_equal(actual_i, expected_i)
assert np.array_equal(actual_j, expected_j)
assert np.allclose(intersections, expected_intersections)

# Flip edge orientation
actual_i, actual_j, intersections = tree.intersect_edges(edge_coords[:, ::-1])
print(actual_i, expected_i)
print(actual_j, expected_j)
print(intersections, expected_intersections[:, ::-1])
assert np.array_equal(actual_i, expected_i)
assert np.array_equal(actual_j, expected_j)
assert np.allclose(intersections, expected_intersections[:, ::-1])
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_double_stack():
stack, size = ut.push_both(stack, 1, 2, size)
assert len(stack) == INITIAL_STACK_LENGTH * 2
assert size == INITIAL_STACK_LENGTH + 1
assert np.array_equal(stack[32], (1, 2))
assert np.array_equal(stack[INITIAL_STACK_LENGTH], (1, 2))

a, b, size = ut.pop_both(stack, size)
assert size == INITIAL_STACK_LENGTH
Expand All @@ -98,7 +98,7 @@ def test_triple_stack():
stack, size = ut.push_triple(stack, 1, 2, 3, size)
assert len(stack) == INITIAL_STACK_LENGTH * 2
assert size == INITIAL_STACK_LENGTH + 1
assert np.array_equal(stack[32], (1, 2, 3))
assert np.array_equal(stack[INITIAL_STACK_LENGTH], (1, 2, 3))

a, b, c, size = ut.pop_triple(stack, size)
assert size == INITIAL_STACK_LENGTH
Expand Down

0 comments on commit 3f2ee00

Please sign in to comment.