Skip to content

Commit

Permalink
Updating code, removing deprecated patterns, general future compat (#87)
Browse files Browse the repository at this point in the history
* Modify scipy import pattern for future compat.

* Rm scipy lower bound.

* Update for numpy 2.0.

* Unpin numpy.
  • Loading branch information
rossbar committed Jan 27, 2024
1 parent b2d6e51 commit 99b9f8f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions deepcell_spots/decoding_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class MatrixSquareRoot(Function):
"""
@staticmethod
def forward(ctx, input):
m = input.detach().cpu().numpy().astype(np.float_)
m = input.detach().cpu().numpy().astype(np.float64)
sqrtm = torch.from_numpy(scipy.linalg.sqrtm(m).real).to(input)
ctx.save_for_backward(sqrtm)
return sqrtm
Expand All @@ -106,8 +106,8 @@ def backward(ctx, grad_output):
grad_input = None
if ctx.needs_input_grad[0]:
sqrtm, = ctx.saved_tensors
sqrtm = sqrtm.data.cpu().numpy().astype(np.float_)
gm = grad_output.data.cpu().numpy().astype(np.float_)
sqrtm = sqrtm.data.cpu().numpy().astype(np.float64)
gm = grad_output.data.cpu().numpy().astype(np.float64)

# Given a positive semi-definite matrix X,
# since X = X^{1/2}X^{1/2}, we can compute the gradient of the
Expand Down
2 changes: 1 addition & 1 deletion deepcell_spots/utils/augmentation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import numpy as np
from keras_preprocessing.image.affine_transformations import \
transform_matrix_offset_center
from scipy.ndimage.morphology import distance_transform_edt
from scipy.ndimage import distance_transform_edt


def subpixel_distance_transform(point_list, image_shape, dy=1, dx=1):
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pandas<2
numpy>=1.16.6
scipy>=1.2.3,<2
numpy
scipy<2
scikit-image>=0.19.3
scikit-learn
tensorflow~=2.8.0 # manually matched to deepcell-tf
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
long_description_content_type='text/markdown',
install_requires=[
'pandas<2',
'numpy>=1.16.6',
'scipy>=1.2.3,<2',
'numpy',
'scipy<2',
'scikit-image>=0.19.3',
'scikit-learn',
'tensorflow~=2.8.0',
Expand Down

0 comments on commit 99b9f8f

Please sign in to comment.