Skip to content

Scipy version incompatibility #37

@joaquinhernandezg

Description

@joaquinhernandezg

When running MUSELET step3 the code raises

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[2], line 1
----> 1 muselet("../MUSE/DATACUBE_FINAL_ZAP.fits", step=3, n_cpu=10)

File ~/anaconda3/envs/python38/lib/python3.8/site-packages/mpdaf/sdetect/muselet.py:1620, in muselet(file_cube, file_expmap, step, delta, fw, sex_config, sex_config_nb, radius, ima_size, nlines_max, clean, skyclean, write_nbcube, cleanup, workdir, n_cpu)
   1616     step2(file_cube, sex_config=sex_config, sex_config_nb=sex_config_nb,
   1617             dir_=workdir, n_cpu=n_cpu)
   1619 if step <= 3:
-> 1620     step3(file_cube, clean=clean, skyclean=skyclean, radius=radius,
   1621             ima_size=ima_size, nlines_max=nlines_max, dir_=workdir,
   1622             n_cpu=n_cpu)
   1624 if cleanup:
   1625     remove_files(workdir)

File ~/anaconda3/envs/python38/lib/python3.8/site-packages/mpdaf/sdetect/muselet.py:1495, in step3(file_cube, clean, skyclean, radius, ima_size, nlines_max, dir_, n_cpu)
   1493 #merge raw detections in lines and objects
   1494 cat_lines = find_lines(cat_clean, cube, radius, n_cpu=n_cpu)
-> 1495 cat_objects = find_objects(cat_lines, dir_, cube, radius, n_cpu=n_cpu)
   1497 #write raw catalogues,
   1498 #perhaps useful for debugging / user to do own postprocessing
   1499 file = dir_ / 'cat_raw.fit'

File ~/anaconda3/envs/python38/lib/python3.8/site-packages/mpdaf/sdetect/muselet.py:1055, in find_objects(cat, dir_, cube, radius, n_cpu)
   1052 for i_iter in range(100): #some not too large number of max iterations
   1054     ids_old = ids.copy()
-> 1055     ids = assign_objects(coord_lines, coord_group, flux_lines, max_dist,
   1056                 n_cpu=n_cpu)
   1058     #find new group centers
   1059     uniq_ids = np.unique(ids)

File ~/anaconda3/envs/python38/lib/python3.8/site-packages/mpdaf/sdetect/muselet.py:946, in assign_objects(coord_lines, coord_group, flux_lines, max_dist, n_cpu)
    943 tree_lines = cKDTree(coord_lines)
    944 tree_group = cKDTree(coord_group)
--> 946 dist, ids = tree_group.query(coord_lines, 1, distance_upper_bound=max_dist,
    947                     n_jobs=n_cpu)
    949 mask = ~np.isfinite(dist) #not grouped
    950 ids[mask] = -1

File _ckdtree.pyx:783, in scipy.spatial._ckdtree.cKDTree.query()

File _ckdtree.pyx:387, in scipy.spatial._ckdtree.get_num_workers()

TypeError: Unexpected keyword argument {'n_jobs': 10}

I am using scipy 1.10.1
The issue is related to scipy deprecating the argument "n_jobs" in >= 1.9.0, renaming it to "workers"(https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.cKDTree.query.html)

I suggest forcing a scipy version <1.9.0 when installing or passing a different argument name depending the scipy version in /mpdaf/sdetect/muselet.py to allow retrocompatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions