Skip to content

Commit

Permalink
Use nopython mode for all jitting (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby authored May 5, 2023
1 parent c27e7b3 commit 8509157
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/cellfinder_core/detect/filters/plane/tile_walker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import math

import numpy as np
from numba import jit
from numba import njit


class TileWalker:
Expand Down Expand Up @@ -78,7 +78,7 @@ def mark_bright_tiles(self):
self.bright_tiles_mask[mask_x, mask_y] = True


@jit
@njit
def is_low_average(tile: np.ndarray, threshold: float) -> bool:
"""
Return `True` if the average value of *tile* is below *threshold*.
Expand Down
8 changes: 4 additions & 4 deletions src/cellfinder_core/detect/filters/volume/ball_filter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from numba import jit
from numba import njit

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


@jit(nopython=True, cache=True)
@njit(cache=True)
def _cube_overlaps(
cube: np.ndarray,
overlap_threshold: float,
Expand Down Expand Up @@ -246,7 +246,7 @@ def _cube_overlaps(
return current_overlap_value > overlap_threshold


@jit(nopython=True)
@njit
def _is_tile_to_check(
x: int,
y: int,
Expand All @@ -263,7 +263,7 @@ def _is_tile_to_check(
return inside_brain_tiles[x_in_mask, y_in_mask, middle_z]


@jit(nopython=True)
@njit
def _walk(
max_height: int,
max_width: int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import List, Sequence, Tuple, Union

import numpy as np
from numba import jit
from numba import njit
from numba.core import types
from numba.experimental import jitclass
from numba.typed import Dict
Expand All @@ -16,7 +16,7 @@ class Point:
z: int


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


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


@jit
@njit
def is_new_structure(neighbour_ids):
for i in range(len(neighbour_ids)):
if neighbour_ids[i] != 0:
Expand Down

0 comments on commit 8509157

Please sign in to comment.