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: GUI, error ROI detection cannot convert float infinity to integer #1090

Open klab-buffalo opened 4 months ago

klab-buffalo commented 4 months ago

Describe the issue:

updated version (updated Feb 14, 2024), using GUI, during ROI detection there was an error. 'cannot convert float infinity to integer' Windows10 errorFeb14

Reproduce the code example:

(suite2p) C:\Users\priv.skuhlman>python -m suite2p
loaded default ops
saved current settings in GUI as default ops
Input format: sbx
{'data_path': ['//itorg.ad.buffalo.edu/ubfs/research/JSMBS/PHB/skuhlman/data1/RawCaDataArchive/Brian/slc200_1R/slc200_1R_220602', '//itorg.ad.buffalo.edu/ubfs/research/JSMBS/PHB/skuhlman/data1/RawCaDataArchive/Brian/slc200_1R/slc200_1R_220726'], 'subfolders': [], 'sbx_ndeadcols': -1, 'save_path0': '//itorg.ad.buffalo.edu/ubfs/research/JSMBS/PHB/skuhlman/data1/ProcessedDataArchive/Sandy/Brian_Ex_RFMstability/slc200_1R', 'fast_disk': '//itorg.ad.buffalo.edu/ubfs/research/JSMBS/PHB/skuhlman/data1/ProcessedDataArchive/Sandy/Brian_Ex_RFMstability/slc200_1R', 'input_format': 'sbx'}
Running suite2p with command:
python -u -W ignore -m suite2p --ops C:\Users\priv.skuhlman\.suite2p\ops\ops.npy --db C:\Users\priv.skuhlman\.suite2p\ops\db.npy

Error message:

Traceback (most recent call last):
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\runpy.py", line 197, in _run_module_as_main
>>>ERROR<<<
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\__main__.py", line 84, in <module>
>>>ERROR<<<
    main()
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\__main__.py", line 77, in main
    run_s2p(ops, db)
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 547, in run_s2p
    op = run_plane(op, ops_path=ops_path)
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 342, in run_plane
>>>ERROR<<<
    ops = pipeline(f_reg, f_raw, f_reg_chan2, f_raw_chan2, run_registration, ops,
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 171, in pipeline
    ops, stat = detection.detection_wrapper(f_reg, ops=ops, classfile=classfile)
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 178, in detection_wrapper
    stat = select_rois(
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 246, in select_rois
    ops, stat = sourcery.sourcery(mov=mov, ops=ops)
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sourcery.py", line 405, in sourcery
    S, StU, StS = getStU(ops, U)
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sourcery.py", line 67, in getStU
    S = create_neuropil_basis(ops, Lyc, Lxc)
  File "C:\ProgramData\anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sourcery.py", line 128, in create_neuropil_basis
    ntilesY = 1 + 2 * int(
OverflowError: cannot convert float infinity to integer
Interrupted by error (not finished)

Version information:

suite2p v0.14.3

Context for the issue:

Necessary to use ROI detect in GUI

imrilifshitz commented 3 months ago

Thank you for your comment. We face the same issue in our lab, but only when setting the sparse mode option to zero. Since working in sparse mode reduces the number of detected ROIs, we would like to know how can we avoid this error ("cannot convert float infinity to integer") when sparse_mode=0.

Any idea would be very much appreciated.

carsen-stringer commented 3 months ago

Hmm could your diameter be set to zero? https://github.com/MouseLand/suite2p/blob/be8830d69ef46728d77e030aa80ed5b6ee7d1dfd/suite2p/detection/sourcery.py#L128

imrilifshitz commented 3 months ago

It was indeed zero. We thought that the anatomical parameters are not relevant since we don't use Cellpose. What are the units of the diameter? Is it in pixels?

Thank you very much for the quick response, Imri

On Thu, Apr 4, 2024 at 2:12 PM carsen-stringer @.***> wrote:

Hmm could your diameter be set to zero? https://github.com/MouseLand/suite2p/blob/be8830d69ef46728d77e030aa80ed5b6ee7d1dfd/suite2p/detection/sourcery.py#L128

— Reply to this email directly, view it on GitHub https://github.com/MouseLand/suite2p/issues/1090#issuecomment-2036875698, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWKSFBMMHQWXLWVQF7ZMNJ3Y3UYSPAVCNFSM6AAAAABDKRFOYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZWHA3TKNRZHA . You are receiving this because you commented.Message ID: @.***>

carsen-stringer commented 3 months ago

Oh yeah sorry the documentation is unclear here, it should be in pixel units. It is used for sourcery and for Cellpose (if you are in anatomical mode).