Open EricThomson opened 7 months ago
Couple of things: most of these are very simple. randrange()
deprecation is out of our control I just dumped stuff in here without thinking too much that's a Python standard library thing with v 3.10. The only one that will take some thinking/time is the np.matrix()
one, and that is still not deprecated (it's not even very concrete it's just pending). Maybe better to handle that with the push to Numpy 2+ definitely don't want to rush it, it is used in about 20 places in the code base, in important places. The others were all simple syntax changes. Testing them now.
caiman\source_extraction\cnmf\spatial.py:844: DeprecationWarning: Please use grey_dilation from the scipy.ndimage namespace, the scipy.ndimage.morphology namespace is deprecated. from scipy.ndimage.morphology import grey_dilation. (evaluate_components)
I'm getting the same warning (repeated many many times) from line 955 of spatial.py (construct_dilate_parallel
):
from scipy.ndimage.morphology import generate_binary_structure, iterate_structure, grey_dilation
Since these are now imported at the top level, this line can just be removed, right?
@ethanbb Ah, yes. Good spot. I've been trying to remove non-toplevel imports when I find them.
You want to do it or shall I?
I can do it no problem! I'll do a quick search for any other similar cases first.
So actually there is this comment in the same file:
which seems to imply that the local imports are needed for ipyparallel or multiprocessing workers. But I don't think that's true; anything defined at the module level, including imports, should be accessible to the workers regardless of how they are launched, right?
Turned off warnings and checked for upcoming deprecations. Most of these are repeated many times in the different notebooks, just noting the warnings not where they are occurring in the code base:
[x] caiman\utils\visualization.py:783: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use
matplotlib.colormaps[name]
ormatplotlib.colormaps.get_cmap(obj)
instead. (colormap = matplotlib.cm.get_cmap(cmap) # choose any matplotlib colormap here)[x] caiman\source_extraction\cnmf\spatial.py:844: DeprecationWarning: Please use
grey_dilation
from thescipy.ndimage
namespace, thescipy.ndimage.morphology
namespace is deprecated. from scipy.ndimage.morphology import grey_dilation. (evaluate_components)A couple to not handle now, or not our problem:
random.py:370: DeprecationWarning: non-integer arguments to randrange() have been deprecated since Python 3.10 and will be removed in a subsequent version return self.randrange(a, b+1) (nb_view_components) [not our direct problem other than Python versioning, which is our problem -- for Windows users Python 3.10 is currently the main successful build, so ... 😬 ]
caiman\base\rois.py:56: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray. Coor = np.matrix([np.outer(np.ones(d2), np.arange(d1)).ravel(), [Handle later -- see note below in first comment]