MouseLand / suite2p

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

ValueError: could not broadcast input array from shape (19,416,416) into shape (18,416,416) #1068

Open gistempert opened 10 months ago

gistempert commented 10 months ago

Describe the issue:

The binning of suite2p failed

Reproduce the code example:

'subfolders': [], 'save_path0': 'E:/Analysis/data_picture/2P_data/CA1_RCAMP4_Syn_odor_1207', 'fast_disk': 'E:/Analysis/data_picture/2P_data/CA1_RCAMP4_Syn_odor_1207', 'input_format': 'tif'}
tif
** Found 1 tifs - converting to binary **
2880 frames of binary, time 120.83 sec.
5760 frames of binary, time 239.50 sec.
8640 frames of binary, time 363.24 sec.
 11520 frames of binary, time 487.78 sec.
time 488.06 sec. Wrote 11520 frames per binary for 1 planes
>>>>>>>>>>>>>>>>>>>>> PLANE 0 <<<<<<<<<<<<<<<<<<<<<<
NOTE: not registered / registration forced with ops['do_registration']>1
      (no previous offsets to delete)
NOTE: applying default C:\Users\Temper\.suite2p\classifiers\classifier_user.npy
----------- REGISTRATION
Reference frame, 16.99 sec.
Registered 720/11520 in 72.15s
Registered 1440/11520 in 143.71s
Registered 2160/11520 in 214.76s
Registered 2880/11520 in 284.58s
Registered 3600/11520 in 354.82s
Registered 4320/11520 in 424.72s
Registered 5040/11520 in 494.06s
Registered 5760/11520 in 563.31s
Registered 6480/11520 in 633.10s
Registered 7200/11520 in 704.33s
Registered 7920/11520 in 774.71s
Registered 8640/11520 in 844.81s
Registered 9360/11520 in 915.05s
Registered 10080/11520 in 984.69s
Registered 10800/11520 in 1054.09s
Registered 11520/11520 in 1123.66s
----------- Total 1145.31 sec
----------- REGISTRATION STEP 2
(making mean image (excluding bad frames)
Registered 720/11520 in 74.61s
Registered 1440/11520 in 148.89s
Registered 2160/11520 in 222.03s
Registered 2880/11520 in 294.92s
Registered 3600/11520 in 365.15s
Registered 4320/11520 in 436.12s
Registered 5040/11520 in 508.06s
Registered 5760/11520 in 579.17s
Registered 6480/11520 in 649.47s
Registered 7200/11520 in 721.92s
Registered 7920/11520 in 793.94s
Registered 8640/11520 in 866.40s
Registered 9360/11520 in 938.18s
Registered 10080/11520 in 1009.36s
Registered 10800/11520 in 1080.94s
Registered 11520/11520 in 1152.51s
----------- Total 2299.24 sec
Registration metrics, 58.03 sec.
   ----------- ROI DETECTION
Binning movie in chunks of length 21
>>>ERROR<<<
Traceback (most recent call last):
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\runpy.py", line 194, in _run_module_as_main
>>>ERROR<<<
    return _run_code(code, main_globals, None,
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\runpy.py", line 87, in _run_code
>>>ERROR<<<
    exec(code, run_globals)
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\site-packages\suite2p\__main__.py", line 78, in <module>
>>>ERROR<<<
    main()
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\site-packages\suite2p\__main__.py", line 71, in main
>>>ERROR<<<
    run_s2p(ops, db)
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 443, in run_s2p
>>>ERROR<<<
    op = run_plane(op, ops_path=ops_path)
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 296, in run_plane
    ops = pipeline(f_reg, f_raw, f_reg_chan2, f_raw_chan2, run_registration, ops, stat=stat)
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 129, in pipeline
>>>ERROR<<<
    ops, stat = detection.detection_wrapper(f_reg,
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 112, in detection_wrapper
    mov = bin_movie(f_reg, bin_size, yrange=yrange, 
  File "C:\Users\Temper\Anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 61, in bin_movie
>>>ERROR<<<
    mov[ik : ik + n_bins] = data
ValueError: could not broadcast input array from shape (19,416,416) into shape (18,416,416)
Interrupted by error (not finished)

Error message:

No response

Version information:

v0.13.0

Context for the issue:

No response

stavskar commented 9 months ago

Hello, I have the same error in some of the files. Have you figured it out?

chriski777 commented 9 months ago

Hi @gistempert and @stavskar, does this issue persist on the latest version of suite2p? If so, could one of you provide a link to a dataset for which you are getting this error?

stavskar commented 9 months ago

Hi, I have sent the dataset to: cski@andrew.cmu.edu

chriski777 commented 9 months ago

Hi @stavskar, thanks for sending it. I'll get to it as soon as I can and let you know!

chriski777 commented 7 months ago

Hey @stavskar, what ops parameters do you end up using for this run of suite2p?

stavskar commented 7 months ago

Hi, I have sent you a screenshot with the parameters that I used in your email.

chriski777 commented 7 months ago

@stavskar, sorry for the long wait. By any chance, do you have a much smaller dataset for which you could reproduce this error with?

stavskar commented 7 months ago

No, I don't have a smaller dataset at the moment.

liadJB commented 6 months ago

Hi, was this problem solved? I am also encountering this problem. For me it happens in register.py line 465: f_align_out[k:min(k + batch_size, n_frames)] = frames

gistempert commented 3 months ago

My another data has this problem again.

gistempert commented 3 months ago

My another data has this problem again.

=Interesting thing: both of the failed data have 11520 frames in total with 360 batch size. maybe this number has some problem.