File: Fixed-compatibility-with-recent-versions-of-scipy.ndimage.patch

package info (click to toggle)
spectral-cube 0.6.6-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,416 kB
  • sloc: python: 13,240; makefile: 154
file content (49 lines) | stat: -rw-r--r-- 2,036 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Thomas Robitaille <thomas.robitaille@gmail.com>
Date: Tue, 10 Jun 2025 12:46:30 +0100
Subject: Fixed compatibility with recent versions of scipy.ndimage

Closes: #1114721
URL: https://github.com/radio-astro-tools/spectral-cube/pull/951
---
 spectral_cube/spectral_cube.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/spectral_cube/spectral_cube.py b/spectral_cube/spectral_cube.py
index ffb0039..c4ee9bf 100644
--- a/spectral_cube/spectral_cube.py
+++ b/spectral_cube/spectral_cube.py
@@ -1933,6 +1933,8 @@ class BaseSpectralCube(BaseNDClass, MaskableArrayMixinClass,
         if not include.any():
             return (slice(0),)*3
 
+        include = include.astype(int, copy=False)
+
         slices = ndimage.find_objects(np.broadcast_arrays(include,
                                                           self._data)[0])[0]
 
@@ -2974,6 +2976,8 @@ class BaseSpectralCube(BaseNDClass, MaskableArrayMixinClass,
                              "options.  Either specify num_cores=1 or "
                              "parallel=True")
 
+        print("HERE", parallel, use_memmap)
+
         if parallel and use_memmap:
 
             # it is not possible to run joblib parallelization without memmap
@@ -3000,6 +3004,7 @@ class BaseSpectralCube(BaseNDClass, MaskableArrayMixinClass,
 
                         # Overload apply_async and set callback=self.callback
                         def apply_async(self, func, callback=None):
+                            print("APPLY ASYNC")
                             cbs = MultiCallback(callback, self.callback)
                             return super().apply_async(func, cbs)
 
@@ -3019,6 +3024,8 @@ class BaseSpectralCube(BaseNDClass, MaskableArrayMixinClass,
                                   warnings.ImportWarning)
                 parallel = False
 
+        print("FINALLY HERE")
+
         # this isn't an else statement because we want to catch the case where
         # the above clause fails on ImportError
         if not parallel or not use_memmap: