MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
334 stars 239 forks source link

BUG: Gives me the following error when I try to run a tiff file on suite2p #1040

Closed kyesther00 closed 8 months ago

kyesther00 commented 9 months ago

Describe the issue:

Every time I run suite2p, it goes through the registration process that takes a few minutes and then gives me the following error.

Reproduce the code example:

>>>ERROR<<<
Traceback (most recent call last):
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\runpy.py", line 193, in _run_module_as_main
>>>ERROR<<<
    "__main__", mod_spec)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\__main__.py", line 78, in <module>
    main()
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\__main__.py", line 71, in main
    run_s2p(ops, db)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 429, in run_s2p
>>>ERROR<<<
    op = run_plane(op, ops_path=ops_path)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 292, in run_plane
    ops = pipeline(f_reg, f_raw, f_reg_chan2, f_raw_chan2, run_registration, ops, stat=stat)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 131, in pipeline
    classfile=classfile)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 152, in detection_wrapper
    classfile=classfile,
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 211, in select_rois
    percentile=ops.get('active_percentile', 0.0),
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sparsedetect.py", line 307, in sparsery
>>>ERROR<<<
    scale, estimate_mode = find_best_scale(I=I, spatial_scale=spatial_scale)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sparsedetect.py", line 266, in find_best_scale
    scale = estimate_spatial_scale(I=I)
  File "C:\Users\yk623\AppData\Local\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sparsedetect.py", line 256, in estimate_spatial_scale
    im, _ = mode(imap[ipk][isort[:50]], keepdims=True)

Error message:

TypeError: mode() got an unexpected keyword argument 'keepdims'
Interrupted by error (not finished)

Version information:

suite2p v0.11.1

Context for the issue:

No response

ryanirl commented 9 months ago

To fix this, your likely going to want to update scipy such that scipy>=1.9.0 as the keepdims argument was added in 1.9.0 (as listed here). Do note that a commit was made to suite2p in v0.14.2 to fix this (so updating suite2p would also likely fix this issue). Also, to ensure compatibility with Python and NumPy versions, I would consult this scipy reference before updating.

chriski777 commented 8 months ago

Hi @kyesther00, as @ryanirl mentioned, this is an issue that was patched in the latest version of suite2p. Could you try running suite2p again after updating to the latest version (v0.14.2)? I'll close this for now but feel free to reopen if the issue persists.

ayelettg commented 3 weeks ago

I begin with an x number of tiff files and after registration in suite2p I miss a small number... why does the total amount of tiff files change after registration?