SpikeInterface / spikeinterface

A Python-based module for creating flexible and robust spike sorting pipelines.
https://spikeinterface.readthedocs.io
MIT License
533 stars 187 forks source link

WaveClus sorting frozen in Matlab initializing #2212

Closed Hobart10 closed 8 months ago

Hobart10 commented 1 year ago

Hi, in running Wave_Clus in local, the sorter just froze in initilizing Matlab, any idea how to fix? Thank you so much!

si.WaveClusSorter.set_waveclus_path(WC_path)
sorter_params = {'enable_sort_filter': False, 'enable_detect_filter': False}
sorting_wc = si.run_sorter(sorter_name='waveclus', recording=recording_saved, remove_existing_folder=True, output_folder=Path(bin_folder) / 'results_wc', verbose=True, **sorter_params)
Hobart10 commented 1 year ago

Error info:

Num. channels = 64, Num. timepoints = 3000000, duration = 5.0 minutes
Running waveclus in [Y:\EphysData\441EphysData\Wireless\231024\SItest\results_wc_demo02\sorter_output..](file:///Y:/EphysData/441EphysData/Wireless/231024/SItest/results_wc_demo02/sorter_output..)
RUNNING SHELL SCRIPT: [Y:\EphysData\441EphysData\Wireless\231024\SItest\results_wc_demo02\sorter_output\run_waveclus.bat](file:///Y:/EphysData/441EphysData/Wireless/231024/SItest/results_wc_demo02/sorter_output/run_waveclus.bat)

(SI) [y:\EphysData\Data_demo_SI0.99](file:///Y:/EphysData/Data_demo_SI0.99)>Y:

(SI) [y:\EphysData\Data_demo_SI0.99](file:///Y:/EphysData/Data_demo_SI0.99)>cd [Y:\EphysData\441EphysData\Wireless\231024\SItest\results_wc_demo02\sorter_output](file:///Y:/EphysData/441EphysData/Wireless/231024/SItest/results_wc_demo02/sorter_output) 

(SI) [Y:\EphysData\441EphysData\Wireless\231024\SItest\results_wc_demo02\sorter_output](file:///Y:/EphysData/441EphysData/Wireless/231024/SItest/results_wc_demo02/sorter_output)>matlab -nosplash -wait -log -r "waveclus_master('Y:\EphysData\441EphysData\Wireless\231024\SItest\results_wc_demo02\sorter_output', 'C:\Users\Lenovo\.conda\envs\SI\wave_clus')" 

Operation terminated by user during <a href="matlab:matlab.internal.language.introspective.errorDocCallback('amp_detect_pol')" style="font-weight:bold">amp_detect_pol</a>

In <a href="matlab:matlab.internal.language.introspective.errorDocCallback('Get_spikes_pol>get_spikes_pol_single', 'C:\Users\Lenovo\.conda\envs\SI\wave_clus\Batch_files\Get_spikes_pol.m', 138)" style="font-weight:bold">Get_spikes_pol>get_spikes_pol_single</a> (<a href="matlab: opentoline('C:\Users\Lenovo\.conda\envs\SI\wave_clus\Batch_files\Get_spikes_pol.m',138,0)">line 138</a>)

        [spikes, new_index,thr{n}] = amp_detect_pol(x,par_ch{1}); %all the channels should have the same parameters
...

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Error running waveclus
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?66582f34-69ea-490a-a3f7-48d29c50b0dd) or open in a [text editor](command:workbench.action.openLargeOutput?66582f34-69ea-490a-a3f7-48d29c50b0dd). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...
---------------------------------------------------------------------------
SpikeSortingError                         Traceback (most recent call last)
[y:\EphysData\Data_demo_SI0.99\SpikeInterface_Tutorial_0.99_exercise.ipynb](file:///Y:/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb) Cell 65 line 7
      [4](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=3) # new_base_path = Path(r"\\10.50.4.1\Personal\Yukai Xu")
      [5](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=4) # folder_wcOut = folder_wcOut.as_posix().replace('Y:', new_base_path.as_posix())
      [6](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=5) sorter_params_wc = {'enable_sort_filter': False, 'enable_detect_filter': False}
----> [7](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=6) sorting_wc_demo = si.run_sorter(sorter_name='waveclus', recording=recording_saved,
      [8](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=7)                              output_folder=Path(folder_wcOut), verbose = True,
      [9](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=8)                              **sorter_params_wc)
     [10](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=9) # We can check the output object:
     [11](vscode-notebook-cell:/y%3A/EphysData/Data_demo_SI0.99/SpikeInterface_Tutorial_0.99_exercise.ipynb#Y115sZmlsZQ%3D%3D?line=10) sorting_wc_demo

File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\sorters\runsorter.py:147](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:147), in run_sorter(sorter_name, recording, output_folder, remove_existing_folder, delete_output_folder, verbose, raise_error, docker_image, singularity_image, delete_container_files, with_output, **sorter_params)
    [140](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:140)             container_image = singularity_image
    [141](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:141)     return run_sorter_container(
    [142](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:142)         container_image=container_image,
    [143](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:143)         mode=mode,
    [144](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:144)         **common_kwargs,
    [145](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:145)     )
--> [147](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:147) return run_sorter_local(**common_kwargs)

File [~\.conda\envs\SI\spikeinterface\src\spikeinterface\sorters\runsorter.py:173](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:173), in run_sorter_local(sorter_name, recording, output_folder, remove_existing_folder, delete_output_folder, verbose, raise_error, with_output, **sorter_params)
    [171](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:171) SorterClass.set_params_to_folder(recording, output_folder, sorter_params, verbose)
    [172](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:172) SorterClass.setup_recording(recording, output_folder, verbose=verbose)
--> [173](https://file+.vscode-resource.vscode-cdn.net/y%3A/EphysData/Data_demo_SI0.99/~/.conda/envs/SI/spikeinterface/src/spikeinterface/sorters/runsorter.py:173) SorterClass.run_from_folder(output_folder, raise_error, verbose)
...
  File "C:\Users\Lenovo\.conda\envs\SI\spikeinterface\src\spikeinterface\sorters\external\waveclus.py", line 229, in _run_from_folder
    raise Exception(f"Result file does not exist: {result_fname}")
Exception: Result file does not exist: [Y:\EphysData\441EphysData\Wireless\231024\SItest\results_wc_demo02\sorter_output\times_results.mat](file:///Y:/EphysData/441EphysData/Wireless/231024/SItest/results_wc_demo02/sorter_output/times_results.mat)
alejoe91 commented 1 year ago

Hi! For sorter specific problems, I would open an issue on the sorter main page. Maybe @ferchaure can help!

Hobart10 commented 1 year ago

Thank you!! If further messages are required, will be happy to provide : )

Hi! For sorter specific problems, I would open an issue on the sorter main page. Maybe @ferchaure can help!

ferchaure commented 1 year ago

Hi, all. Sorry, but the WaveClus's repository is archived. Probably new forks (and developers) will take its place in the future. Can you show me the .log file inside the folder?

Just a remainder: WaveClus isn't design for more than ~4 channels. It doesn't handle collisions, I wouldn't recommend using it for 64 channels, at least all proceed together.

Hobart10 commented 1 year ago

Thank you Fernando!! Will try sort by group and then merge. The .log file is attached. waveclus.log

Hi, all. Sorry, but the WaveClus's repository is archived. Probably new forks (and developers) will take its place in the future. Can you show me the .log file inside the folder?

Just a remainder: WaveClus isn't design for more than ~4 channels. It doesn't handle collisions, I wouldn't recommend using it for 64 channels, at least all proceed together.

ferchaure commented 1 year ago

It looks normal, maybe give it more time?

Another test is to run the script Y:\EphysData\441EphysData\Wireless\231024\SItest\results_wc_demo\sorter_output\waveclus_master.m on matlab to check if its crashing. But it looks like a limited RAM issue

zm711 commented 8 months ago

I'll close this as it is a waveclu issue, but feel free to open new issues if something else comes up :)