Skip to content

Commit

Permalink
removed boundscheck
Browse files Browse the repository at this point in the history
  • Loading branch information
taladjidi committed Mar 20, 2024
1 parent 0d3f780 commit 07dbf5a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions PhaseUtils/contrast.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def gauss_fit(x, waist, mean):
return np.exp(-2 * (x - mean) ** 2 / waist**2)


@numba.njit(parallel=True, cache=True, fastmath=True)
@numba.njit(parallel=True, cache=True, fastmath=True, boundscheck=False)
def az_avg(image: np.ndarray, center: tuple) -> np.ndarray:
"""Calculates the azimuthally averaged radial profile.
Expand Down Expand Up @@ -459,7 +459,7 @@ def az_avg(image: np.ndarray, center: tuple) -> np.ndarray:
return prof


@numba.njit(fastmath=True, cache=True, parallel=True)
@numba.njit(fastmath=True, cache=True, parallel=True, boundscheck=False)
def angle_fast(x: np.ndarray) -> np.ndarray:
"""Accelerates a smidge angle by using fastmath
Expand All @@ -476,7 +476,7 @@ def angle_fast(x: np.ndarray) -> np.ndarray:
return out


@numba.njit(fastmath=True, nogil=True, cache=True, parallel=True)
@numba.njit(fastmath=True, nogil=True, cache=True, parallel=True, boundscheck=False)
def exp_angle_fast(x: np.ndarray, y: np.ndarray):
"""Fast multiplication by exp(-1j*x)
Expand All @@ -491,7 +491,7 @@ def exp_angle_fast(x: np.ndarray, y: np.ndarray):
x[i, j] *= cmath.exp(-1j * cmath.phase(y[i, j]))


@numba.njit(fastmath=True, nogil=True, cache=True, parallel=True)
@numba.njit(fastmath=True, nogil=True, cache=True, parallel=True, boundscheck=False)
def exp_angle_fast_scalar(x: np.ndarray, y: complex):
"""Fast multiplication by exp(-1j*y)
Expand All @@ -507,7 +507,7 @@ def exp_angle_fast_scalar(x: np.ndarray, y: complex):


@lru_cache(maxsize=10)
@numba.njit(cache=True, parallel=True, boundscheck=False)
@numba.njit(fastmath=True, nogil=True, cache=True, parallel=True, boundscheck=False)
def disk(m: int, n: int, center: tuple, radius: int):
"""Numba compatible mgrid in i,j indexing style
Expand Down

0 comments on commit 07dbf5a

Please sign in to comment.