Skip to content

Commit 8509157

Browse files
authored
Use nopython mode for all jitting (#165)
1 parent c27e7b3 commit 8509157

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/cellfinder_core/detect/filters/plane/tile_walker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import math
22

33
import numpy as np
4-
from numba import jit
4+
from numba import njit
55

66

77
class TileWalker:
@@ -78,7 +78,7 @@ def mark_bright_tiles(self):
7878
self.bright_tiles_mask[mask_x, mask_y] = True
7979

8080

81-
@jit
81+
@njit
8282
def is_low_average(tile: np.ndarray, threshold: float) -> bool:
8383
"""
8484
Return `True` if the average value of *tile* is below *threshold*.

src/cellfinder_core/detect/filters/volume/ball_filter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy as np
2-
from numba import jit
2+
from numba import njit
33

44
from cellfinder_core.tools.array_operations import bin_mean_3d
55
from cellfinder_core.tools.geometry import make_sphere
@@ -196,7 +196,7 @@ def walk(self) -> None: # Highly optimised because most time critical
196196
)
197197

198198

199-
@jit(nopython=True, cache=True)
199+
@njit(cache=True)
200200
def _cube_overlaps(
201201
cube: np.ndarray,
202202
overlap_threshold: float,
@@ -246,7 +246,7 @@ def _cube_overlaps(
246246
return current_overlap_value > overlap_threshold
247247

248248

249-
@jit(nopython=True)
249+
@njit
250250
def _is_tile_to_check(
251251
x: int,
252252
y: int,
@@ -263,7 +263,7 @@ def _is_tile_to_check(
263263
return inside_brain_tiles[x_in_mask, y_in_mask, middle_z]
264264

265265

266-
@jit(nopython=True)
266+
@njit
267267
def _walk(
268268
max_height: int,
269269
max_width: int,

src/cellfinder_core/detect/filters/volume/structure_detection.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import List, Sequence, Tuple, Union
33

44
import numpy as np
5-
from numba import jit
5+
from numba import njit
66
from numba.core import types
77
from numba.experimental import jitclass
88
from numba.typed import Dict
@@ -16,7 +16,7 @@ class Point:
1616
z: int
1717

1818

19-
@jit(nopython=True)
19+
@njit
2020
def get_non_zero_dtype_min(values: np.ndarray) -> int:
2121
"""
2222
Get the minimum of non-zero entries in *values*.
@@ -31,7 +31,7 @@ def get_non_zero_dtype_min(values: np.ndarray) -> int:
3131
return min_val
3232

3333

34-
@jit(nopython=True)
34+
@njit
3535
def traverse_dict(d: dict, a):
3636
"""
3737
Traverse d, until a is not present as a key.
@@ -278,7 +278,7 @@ def structures_to_cells(self) -> List[Point]:
278278
return cell_centres
279279

280280

281-
@jit
281+
@njit
282282
def is_new_structure(neighbour_ids):
283283
for i in range(len(neighbour_ids)):
284284
if neighbour_ids[i] != 0:

0 commit comments

Comments
 (0)