Skip to content

Commit

Permalink
Merge pull request #4104 from t20100/scipy-ascent
Browse files Browse the repository at this point in the history
Dependencies: Added requirement scipy>=1.10 for the tests
payno authored Apr 18, 2024
2 parents e46f20e + 24850fb commit ac05280
Showing 16 changed files with 41 additions and 76 deletions.
1 change: 1 addition & 0 deletions package/debian12/control
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ Build-Depends: cython3 (>= 0.23.2),
python3-opengl,
python3-packaging,
python3-pil,
python3-pooch,
python3-pydata-sphinx-theme,
python3-pyopencl,
python3-pyqt5.qtopengl,
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ matplotlib >= 3.1.0 # For silx.gui.plot
PyOpenGL # For silx.gui.plot3d
python-dateutil # For silx.gui.plot
scipy # For silx.math.fit demo, silx.image.sift demo, silx.image.sift.test
pooch # For scipy.datasets.ascent
Pillow # For silx.opencl.image.test
pint # For silx.io.dictdump
PyQt5 # PySide6, PyQt6>=6.3 # For silx.gui
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# /*##########################################################################
#
# Copyright (c) 2015-2023 European Synchrotron Radiation Facility
# Copyright (c) 2015-2024 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -188,7 +188,14 @@ def get_project_configuration():
"Pillow",
]

test_requires = ["pytest", "pytest-xvfb", "pytest-mock", "bitshuffle"]
test_requires = [
"pytest",
"pytest-xvfb",
"pytest-mock",
"bitshuffle",
"scipy>=1.10",
"pooch",
]

doc_requires = {
"nbsphinx",
7 changes: 2 additions & 5 deletions src/silx/math/fft/test/test_fft.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# /*##########################################################################
#
# Copyright (c) 2018-2022 European Synchrotron Radiation Facility
# Copyright (c) 2018-2024 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -33,10 +33,7 @@
from tempfile import TemporaryDirectory

try:
try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent
__have_scipy = True
except ImportError:
__have_scipy = False
9 changes: 3 additions & 6 deletions src/silx/math/medianfilter/test/test_medianfilter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ##########################################################################
# Copyright (C) 2017-2022 European Synchrotron Radiation Facility
# Copyright (C) 2017-2024 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -38,10 +38,7 @@
except:
scipy = None
else:
try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent
import scipy.ndimage

import logging
@@ -717,7 +714,7 @@ def testRandomMatrice(self):

def testAscent(self):
"""Test vs scipy with"""
img = ascent()
img = ascent().astype(numpy.int64)

kernels = [(3, 1), (3, 5), (5, 9), (9, 3)]
modesToTest = _getScipyAndSilxCommonModes()
7 changes: 2 additions & 5 deletions src/silx/opencl/sift/match.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -342,10 +342,7 @@ def match_py(nkp1, nkp2, raw_results=False):


def demo():
try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent
from .plan import SiftPlan

img1 = ascent()
7 changes: 2 additions & 5 deletions src/silx/opencl/sift/plan.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2023 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -1062,10 +1062,7 @@ def count_kp(self, output):

def demo():
# Prepare debugging
try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent
img = ascent()

s = SiftPlan(template=img)
8 changes: 2 additions & 6 deletions src/silx/opencl/sift/test/test_align.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -46,11 +46,7 @@
scipy = None
else:
import scipy.ndimage

try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent

from ...common import ocl

8 changes: 2 additions & 6 deletions src/silx/opencl/sift/test/test_convol.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -47,11 +47,7 @@
scipy = None
else:
import scipy.ndimage

try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent

import unittest
from silx.opencl import ocl
8 changes: 2 additions & 6 deletions src/silx/opencl/sift/test/test_image_setup.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -45,11 +45,7 @@
scipy = None
else:
import scipy.ndimage

try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent

from .test_image_functions import (
my_gradient,
7 changes: 2 additions & 5 deletions src/silx/opencl/sift/test/test_keypoints.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -50,10 +50,7 @@
except ImportError:
scipy = None
else:
try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent

# for Python implementation of tested functions
from .test_image_functions import (
7 changes: 2 additions & 5 deletions src/silx/opencl/sift/test/test_matching.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -46,10 +46,7 @@
except ImportError:
scipy = None
else:
try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent


# for Python implementation of tested functions
7 changes: 2 additions & 5 deletions src/silx/opencl/sift/test/test_preproc.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -46,10 +46,7 @@
except ImportError:
scipy = None
else:
try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent

import math
from silx.opencl import ocl, kernel_workgroup_size
8 changes: 2 additions & 6 deletions src/silx/opencl/sift/test/test_transform.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Project: Sift implementation in Python + OpenCL
# https://github.com/silx-kit/silx
#
# Copyright (C) 2013-2022 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2013-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -50,11 +50,7 @@
scipy = None
else:
import scipy.ndimage

try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent

from silx.opencl import ocl, kernel_workgroup_size

8 changes: 2 additions & 6 deletions src/silx/opencl/test/test_convolution.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# /*##########################################################################
#
# Copyright (c) 2019-2022 European Synchrotron Radiation Facility
# Copyright (c) 2019-2024 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -41,11 +41,7 @@

try:
from scipy.ndimage import convolve, convolve1d

try:
from scipy.misc import ascent
except:
from scipy.datasets import ascent
from scipy.datasets import ascent

scipy_convolve = convolve
scipy_convolve1d = convolve1d
13 changes: 5 additions & 8 deletions src/silx/opencl/test/test_medfilt.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
__authors__ = ["Jérôme Kieffer"]
__contact__ = "jerome.kieffer@esrf.eu"
__license__ = "MIT"
__copyright__ = "2013-2022 European Synchrotron Radiation Facility, Grenoble, France"
__copyright__ = "2013-2024 European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "09/05/2023"


@@ -58,15 +58,12 @@
Result = namedtuple("Result", ["size", "error", "sp_time", "oc_time"])

try:
from scipy.misc import ascent
from scipy.datasets import ascent
except:
try:
from scipy.datasets import ascent
except:

def ascent():
"""Dummy image from random data"""
return numpy.random.random((512, 512))
def ascent():
"""Dummy image from random data"""
return numpy.random.random((512, 512))


try:

0 comments on commit ac05280

Please sign in to comment.