HS2 icon indicating copy to clipboard operation
HS2 copied to clipboard

bug with the 0.3.7 version

Open benkiisma opened this issue 2 years ago • 2 comments

Hello, I have an error when running Herdingspikes on spikeInterface.

Code

sorting_HS = ss.run_herdingspikes(recording_loaded, output_folder='results_HS', 
                                  filter=False, verbose=True)
print('Found', len(sorting_HS.get_unit_ids()), 'units')

Error

herdingspikes version<0.3.99 uses the OLD spikeextractors with NewToOldRecording.
Consider updating herdingspikes (pip install herdingspikes>=0.3.99)
# Generating new position and neighbor files from data file
# Not Masking any Channels
# Sampling rate: 30000
# Localization On
# Number of recorded channels: 32
# Analysing frames: 4428544; Seconds: 147.61813333333333
# Frames before spike in cutout: 9
# Frames after spike in cutout: 54
# tcuts: 39 84
# tInc: 100000
# Analysing frames from -39 to 100084  (0.0%)
# Analysing frames from 99961 to 200084  (2.3%)
# Analysing frames from 199961 to 300084  (4.5%)
# Analysing frames from 299961 to 400084  (6.8%)
# Analysing frames from 399961 to 500084  (9.0%)
# Analysing frames from 499961 to 600084  (11.3%)
# Analysing frames from 599961 to 700084  (13.5%)
# Analysing frames from 699961 to 800084  (15.8%)
# Analysing frames from 799961 to 900084  (18.1%)
# Analysing frames from 899961 to 1000084  (20.3%)
# Analysing frames from 999961 to 1100084  (22.6%)
# Analysing frames from 1099961 to 1200084  (24.8%)
# Analysing frames from 1199961 to 1300084  (27.1%)
# Analysing frames from 1299961 to 1400084  (29.4%)
# Analysing frames from 1399961 to 1500084  (31.6%)
# Analysing frames from 1499961 to 1600084  (33.9%)
# Analysing frames from 1599961 to 1700084  (36.1%)
# Analysing frames from 1699961 to 1800084  (38.4%)
# Analysing frames from 1799961 to 1900084  (40.6%)
# Analysing frames from 1899961 to 2000084  (42.9%)
# Analysing frames from 1999961 to 2100084  (45.2%)
# Analysing frames from 2099961 to 2200084  (47.4%)
# Analysing frames from 2199961 to 2300084  (49.7%)
# Analysing frames from 2299961 to 2400084  (51.9%)
# Analysing frames from 2399961 to 2500084  (54.2%)
# Analysing frames from 2499961 to 2600084  (56.5%)
# Analysing frames from 2599961 to 2700084  (58.7%)
# Analysing frames from 2699961 to 2800084  (61.0%)
# Analysing frames from 2799961 to 2900084  (63.2%)
# Analysing frames from 2899961 to 3000084  (65.5%)
# Analysing frames from 2999961 to 3100084  (67.7%)
# Analysing frames from 3099961 to 3200084  (70.0%)
# Analysing frames from 3199961 to 3300084  (72.3%)
# Analysing frames from 3299961 to 3400084  (74.5%)
# Analysing frames from 3399961 to 3500084  (76.8%)
# Analysing frames from 3499961 to 3600084  (79.0%)
# Analysing frames from 3599961 to 3700084  (81.3%)
# Analysing frames from 3699961 to 3800084  (83.5%)
# Analysing frames from 3799961 to 3900084  (85.8%)
# Analysing frames from 3899961 to 4000084  (88.1%)
# Analysing frames from 3999961 to 4100084  (90.3%)
# Analysing frames from 4099961 to 4200084  (92.6%)
# Analysing frames from 4199961 to 4300084  (94.8%)
# Analysing frames from 4299961 to 4400084  (97.1%)
# Analysing frames from 4399961 to 4428544  (99.4%)
# Detection completed, time taken: 0:00:00.740824
# Time per frame: 0:00:00.000167
# Time per sample: 0:00:00.000005
Loaded 0 spikes.
Error running herdingspikes
Traceback (most recent call last):
  File "/Users/ismail/opt/anaconda3/envs/si090/lib/python3.8/site-packages/spikeinterface/sorters/basesorter.py", line 200, in run_from_folder
    SorterClass._run_from_folder(output_folder, sorter_params, verbose)
  File "/Users/ismail/opt/anaconda3/envs/si090/lib/python3.8/site-packages/spikeinterface/sorters/herdingspikes/herdingspikes.py", line 226, in _run_from_folder
    uids = C.spikes.cl.unique()
  File "/Users/ismail/opt/anaconda3/envs/si090/lib/python3.8/site-packages/pandas/core/generic.py", line 5583, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'cl'

/Users/ismail/opt/anaconda3/envs/si090/lib/python3.8/site-packages/herdingspikes/hs2.py:161: UserWarning: Loading an empty file results_HS/HS2_detected.bin . This usually happens when no spikes weredetected due to the detection parameters being set too strictly
  warnings.warn(
---------------------------------------------------------------------------
SpikeSortingError                         Traceback (most recent call last)
Input In [74], in <cell line: 2>()
      1 # run spike sorting on entire recording
----> 2 sorting_HS = ss.run_herdingspikes(recording_loaded, output_folder='results_HS', 
      3                                   filter=False, verbose=True)
      4 print('Found', len(sorting_HS.get_unit_ids()), 'units')

File ~/opt/anaconda3/envs/si090/lib/python3.8/site-packages/spikeinterface/sorters/runsorter.py:468, in run_herdingspikes(*args, **kwargs)
    467 def run_herdingspikes(*args, **kwargs):
--> 468     return run_sorter('herdingspikes', *args, **kwargs)

File ~/opt/anaconda3/envs/si090/lib/python3.8/site-packages/spikeinterface/sorters/runsorter.py:67, in run_sorter(sorter_name, recording, output_folder, remove_existing_folder, delete_output_folder, verbose, raise_error, docker_image, singularity_image, with_output, **sorter_params)
     61 if singularity_image is not None:
     62     return run_sorter_container(sorter_name, recording, 'singularity', singularity_image,
     63                                 output_folder=output_folder,
     64                                 remove_existing_folder=remove_existing_folder,
     65                                 delete_output_folder=delete_output_folder, verbose=verbose,
     66                                 raise_error=raise_error, with_output=with_output, **sorter_params)
---> 67 return run_sorter_local(sorter_name, recording, output_folder=output_folder,
     68                         remove_existing_folder=remove_existing_folder,
     69                         delete_output_folder=delete_output_folder,
     70                         verbose=verbose, raise_error=raise_error, with_output=with_output,
     71                         **sorter_params)

File ~/opt/anaconda3/envs/si090/lib/python3.8/site-packages/spikeinterface/sorters/runsorter.py:89, in run_sorter_local(sorter_name, recording, output_folder, remove_existing_folder, delete_output_folder, verbose, raise_error, with_output, **sorter_params)
     86 SorterClass.set_params_to_folder(
     87     recording, output_folder, sorter_params, verbose)
     88 SorterClass.setup_recording(recording, output_folder, verbose=verbose)
---> 89 SorterClass.run_from_folder(output_folder, raise_error, verbose)
     90 if with_output:
     91     sorting = SorterClass.get_result_from_folder(output_folder)

File ~/opt/anaconda3/envs/si090/lib/python3.8/site-packages/spikeinterface/sorters/basesorter.py:236, in BaseSorter.run_from_folder(cls, output_folder, raise_error, verbose)
    234 if has_error and raise_error:
    235     print(log['error_trace'])
--> 236     raise SpikeSortingError(
    237         f"Spike sorting failed. You can inspect the runtime trace in {output_folder}/spikeinterface_log.json")
    239 return run_time

SpikeSortingError: Spike sorting failed. You can inspect the runtime trace in results_HS/spikeinterface_log.json

Thank you for your help

benkiisma avatar Apr 02 '22 14:04 benkiisma

Hi, The problem is that no spikes are found.

Loaded 0 spikes.

There are two possibilities:

  • The data has strong fluctuations, e.g. some LFP signal. In this case you can try adding a bandpass (filter=True should do this).
  • The signal may be transposed.. What versions of spikeinterface do you have? Have you tried the latest herdingspikes? The issue is that the old spikenterface had the signal transposed in the extractor.

mhhennig avatar Apr 02 '22 16:04 mhhennig

I tried with filter=Truebut I have the same error.

I am using the latest version of Spikeinterface (0.93.0). I tried the latest herdingspikes but spikeinterface doesn't even detect the sorters. I have an error when running ss.installed_sorters(), but with the version 0.3.7, spikeinterface detect it. Maybe it will help if I tell you that I am using INTAN files.

Thank you for your help.

benkiisma avatar Apr 02 '22 18:04 benkiisma