[Debian-pan-maintainers] Bug#1027192: binoculars: autopkgtest fail with numpy/1.24.1

Sebastiaan Couwenberg sebastic at xs4all.nl
Wed Jan 11 17:13:16 GMT 2023


Control: tags -1 patch

The attached patch resolves the issue.

Kind Regards,

Bas

-- 
  GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
-------------- next part --------------
diff -Nru binoculars-0.0.12/debian/changelog binoculars-0.0.12/debian/changelog
--- binoculars-0.0.12/debian/changelog	2022-11-24 12:20:09.000000000 +0100
+++ binoculars-0.0.12/debian/changelog	2023-01-11 17:48:13.000000000 +0100
@@ -1,3 +1,11 @@
+binoculars (0.0.12-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add patch to fix test failure with Numpy 1.24.
+    (closes: #1027192)
+
+ -- Bas Couwenberg <sebastic at debian.org>  Wed, 11 Jan 2023 17:48:13 +0100
+
 binoculars (0.0.12-1) unstable; urgency=medium
 
   * New upstream version 0.0.12
diff -Nru binoculars-0.0.12/debian/patches/numpy-1.24.patch binoculars-0.0.12/debian/patches/numpy-1.24.patch
--- binoculars-0.0.12/debian/patches/numpy-1.24.patch	1970-01-01 01:00:00.000000000 +0100
+++ binoculars-0.0.12/debian/patches/numpy-1.24.patch	2023-01-11 17:48:13.000000000 +0100
@@ -0,0 +1,176 @@
+Description: Fix test failure with Numpy 1.24.
+Author: Bas Couwenberg <sebastic at debian.org>
+Bug-Debian: https://bugs.debian.org/1027192
+
+--- a/scripts/binoviewer.py
++++ b/scripts/binoviewer.py
+@@ -184,7 +184,7 @@ def mask_linear_defects(data, threshold=
+     temp.mask = lup
+     np.ma.apply_along_axis(remove_masked_slices, 1, temp, *(length,))
+ 
+-    mask = np.zeros_like(data, dtype=np.bool)
++    mask = np.zeros_like(data, dtype=bool)
+     mask[1:-1] = np.logical_or(ldown, temp.mask)
+     return mask
+ 
+@@ -344,7 +344,7 @@ class MaskedImageNan(MaskedImageItem):
+         if inside:
+             self.data[iy0:iy1, ix0:ix1] = np.ma.masked
+         else:
+-            indexes = np.ones(self.data.shape, dtype=np.bool)
++            indexes = np.ones(self.data.shape, dtype=bool)
+             indexes[iy0:iy1, ix0:ix1] = False
+             self.data[indexes] = np.ma.masked
+         if trace:
+@@ -369,7 +369,7 @@ class MaskedImageNan(MaskedImageItem):
+         if inside:
+             self.data[iy0:iy1, ix0:ix1] = np.ma.masked
+         else:
+-            indexes = np.ones(self.data.shape, dtype=np.bool)
++            indexes = np.ones(self.data.shape, dtype=bool)
+             indexes[iy0:iy1, ix0:ix1] = False
+             self.data[indexes] = np.ma.masked
+         if trace:
+@@ -474,7 +474,7 @@ class MaskedImageNan(MaskedImageItem):
+         if inside:
+             self.data.mask[iy0:iy1, ix0:ix1] = False
+         else:
+-            indexes = np.ones(self.data.shape, dtype=np.bool)
++            indexes = np.ones(self.data.shape, dtype=bool)
+             indexes[iy0:iy1, ix0:ix1] = False
+             self.data.mask[indexes] = False
+         if trace:
+@@ -501,7 +501,7 @@ class MaskedImageNan(MaskedImageItem):
+         if inside:
+             self.data.mask[iy0:iy1, ix0:ix1] = False
+         else:
+-            indexes = np.ones(self.data.shape, dtype=np.bool)
++            indexes = np.ones(self.data.shape, dtype=bool)
+             indexes[iy0:iy1, ix0:ix1] = False
+             self.data.mask[indexes] = False
+         if trace:
+@@ -2780,7 +2780,7 @@ class ImageMaskingWidget(PanelWidget):
+         radius = self.sizebox.value()
+         L = np.arange(-radius, radius + 1)
+         X, Y = np.meshgrid(L, L)
+-        struct = np.array((X ** 2 + Y ** 2) <= radius ** 2, dtype=np.bool)
++        struct = np.array((X ** 2 + Y ** 2) <= radius ** 2, dtype=bool)
+ 
+         self.masked_image.data.mask = (
+             signal.fftconvolve(self.masked_image.data.mask, struct, "same") > 0.5
+@@ -2797,7 +2797,7 @@ class ImageMaskingWidget(PanelWidget):
+         radius = self.sizebox.value()
+         L = np.arange(-radius, radius + 1)
+         X, Y = np.meshgrid(L, L)
+-        struct = np.array((X ** 2 + Y ** 2) <= radius ** 2, dtype=np.bool)
++        struct = np.array((X ** 2 + Y ** 2) <= radius ** 2, dtype=bool)
+ 
+         self.masked_image.data.mask = (
+             signal.fftconvolve(
+--- a/binoculars/backends/bm32.py
++++ b/binoculars/backends/bm32.py
+@@ -524,11 +524,11 @@ def load_matrix(filename):
+     if os.path.exists(filename):
+         ext = os.path.splitext(filename)[-1]
+         if ext == ".txt":
+-            return numpy.array(numpy.loadtxt(filename), dtype=numpy.bool)
++            return numpy.array(numpy.loadtxt(filename), dtype=bool)
+         elif ext == ".npy":
+-            return numpy.array(numpy.load(filename), dtype=numpy.bool)
++            return numpy.array(numpy.load(filename), dtype=bool)
+         elif ext == ".edf":
+-            return numpy.array(EdfFile.EdfFile(filename).getData(0), dtype=numpy.bool)
++            return numpy.array(EdfFile.EdfFile(filename).getData(0), dtype=bool)
+         else:
+             raise ValueError(
+                 "unknown extension {0}, unable to load matrix!\n".format(ext)
+--- a/binoculars/backends/id03.py
++++ b/binoculars/backends/id03.py
+@@ -1172,11 +1172,11 @@ def load_matrix(filename):
+     if os.path.exists(filename):
+         ext = os.path.splitext(filename)[-1]
+         if ext == ".txt":
+-            return numpy.array(numpy.loadtxt(filename), dtype=numpy.bool)
++            return numpy.array(numpy.loadtxt(filename), dtype=bool)
+         elif ext == ".npy":
+-            return numpy.array(numpy.load(filename), dtype=numpy.bool)
++            return numpy.array(numpy.load(filename), dtype=bool)
+         elif ext == ".edf":
+-            return numpy.array(EdfFile.EdfFile(filename).getData(0), dtype=numpy.bool)
++            return numpy.array(EdfFile.EdfFile(filename).getData(0), dtype=bool)
+         else:
+             raise ValueError(
+                 "unknown extension {0}, unable to load matrix!\n".format(ext)
+--- a/binoculars/backends/io7.py
++++ b/binoculars/backends/io7.py
+@@ -454,9 +454,9 @@ def load_matrix(filename):
+     if os.path.exists(filename):
+         ext = os.path.splitext(filename)[-1]
+         if ext == ".txt":
+-            return numpy.array(numpy.loadtxt(filename), dtype=numpy.bool)
++            return numpy.array(numpy.loadtxt(filename), dtype=bool)
+         elif ext == ".npy":
+-            return numpy.array(numpy.load(filename), dtype=numpy.bool)
++            return numpy.array(numpy.load(filename), dtype=bool)
+         else:
+             raise ValueError(
+                 "unknown extension {0}, unable to load matrix!\n".format(ext)
+--- a/binoculars/backends/sixs.py
++++ b/binoculars/backends/sixs.py
+@@ -1007,7 +1007,7 @@ class FlyScanUHV(SIXS):
+             mask = numpy.zeros((256, 257)).astype(bool)
+         else:
+             detector = ALL_DETECTORS[detector.name]()
+-            mask = detector.mask.astype(numpy.bool)
++            mask = detector.mask.astype(bool)
+         maskmatrix = load_matrix(fnmask)
+         if maskmatrix is not None:
+             mask = numpy.bitwise_or(mask, maskmatrix)
+@@ -1524,9 +1524,9 @@ def load_matrix(filename):
+     if os.path.exists(filename):
+         ext = os.path.splitext(filename)[-1]
+         if ext == ".txt":
+-            return numpy.array(numpy.loadtxt(filename), dtype=numpy.bool)
++            return numpy.array(numpy.loadtxt(filename), dtype=bool)
+         elif ext == ".npy":
+-            mask = numpy.array(numpy.load(filename), dtype=numpy.bool)
++            mask = numpy.array(numpy.load(filename), dtype=bool)
+             print("loaded mask sum: ", numpy.sum(mask))
+             return mask
+         else:
+--- a/binoculars/space.py
++++ b/binoculars/space.py
+@@ -773,7 +773,7 @@ class Space(object):
+         intensity     data intensity array"""
+ 
+         if limits is not None:
+-            invalid = numpy.zeros(intensity.shape).astype(numpy.bool)
++            invalid = numpy.zeros(intensity.shape).astype(bool)
+             for coord, sl in zip(coordinates, limits):
+                 if sl.start is None and sl.stop is not None:
+                     invalid += coord > sl.stop
+--- a/scripts/binoculars-fitaid
++++ b/scripts/binoculars-fitaid
+@@ -207,9 +207,9 @@ class RodData(FitData):
+             if key not in group:
+                 dataset = group.create_dataset(key, (self.rodlength(),))
+                 dataset = group.create_dataset(mkey, (self.rodlength(),),
+-                                               dtype=numpy.bool)
++                                               dtype=bool)
+                 dataset.write_direct(
+-                    numpy.ones(self.rodlength(), dtype=numpy.bool)
++                    numpy.ones(self.rodlength(), dtype=bool)
+                 )
+             group[key][index] = value
+             group[mkey][index] = 0
+--- a/scripts/binoculars-gui
++++ b/scripts/binoculars-gui
+@@ -1156,7 +1156,7 @@ class LimitWidget(QWidget):
+             hbox.addWidget(box)
+             box.stateChanged.connect(self.update_checkbox)
+ 
+-        self.state = numpy.array(self.state, dtype = numpy.bool)
++        self.state = numpy.array(self.state, dtype = bool)
+         self.init_checkbox()
+ 
+         vbox.addLayout(hbox)
diff -Nru binoculars-0.0.12/debian/patches/series binoculars-0.0.12/debian/patches/series
--- binoculars-0.0.12/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ binoculars-0.0.12/debian/patches/series	2023-01-11 17:46:15.000000000 +0100
@@ -0,0 +1 @@
+numpy-1.24.patch


More information about the Debian-pan-maintainers mailing list