Skip to content

Commit

Permalink
Fix np.lib reference for NumPy v2 release
Browse files Browse the repository at this point in the history
NumPy v2 has just been released, bringing many changes to the API, including the `np.lib` subpackage (see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#numpy-lib-namespace). Fix a reference to the `np.lib.index_tricks` module.
  • Loading branch information
yoda-vid committed Jun 18, 2024
1 parent fd0fe38 commit cb10cfe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions magmap/cv/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union

import numpy as np
try:
# np >= v2
from numpy.lib._index_tricks_impl import IndexExpression
except ModuleNotFoundError:
# np < v2
from numpy.lib.index_tricks import IndexExpression
from skimage.feature import blob_log

from magmap.cv import colocalizer, cv_nd
Expand Down Expand Up @@ -497,8 +503,7 @@ def set_blob_col(
cls, blob: np.ndarray,
col: Union[int, "Blobs.Cols", Sequence[Union[int, "Blobs.Cols"]]],
val: Union[float, Sequence[float]],
mask: Union[
np.ndarray, np.lib.index_tricks.IndexExpression] = np.s_[:],
mask: Union[np.ndarray, IndexExpression] = np.s_[:],
**kwargs
) -> np.ndarray:
"""Set the value for the given column of a blob or blobs.
Expand Down

0 comments on commit cb10cfe

Please sign in to comment.