Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference in clusters sorted by spykingcircus2 and mountainsort5 #3040

Open
kshtjkumar opened this issue Jun 18, 2024 · 8 comments
Open

Difference in clusters sorted by spykingcircus2 and mountainsort5 #3040

kshtjkumar opened this issue Jun 18, 2024 · 8 comments
Labels
question General question regarding SI sorters Related to sorters module

Comments

@kshtjkumar
Copy link

Hi ,
I have a question regarding the significant disparity in the number of clusters identified by MountainSort5 and SpykingCircus2. I have a tetrode recording that lasts for 1277 seconds. When I use SpykingCircus2 for sorting, I get 153 clusters, of which 78 have an ISI violation ratio below 0.5. In contrast, the same recording sorted with MountainSort5 results in only 4 clusters, with just 1 cluster exceeding the ISI threshold.

What could be causing such a large difference in the number of clusters?

here is what the probe looks like:
Figure 63

this is the raster form the mountainsort5:
Figure 65

@yger
Copy link
Collaborator

yger commented Jun 19, 2024

I don't know which version of spikeinterface you are using, but lots of improvements have been made to circus2 in the main branch. Since it is unlikely that you can find so many clusters on few channels, either there is a mismatch in the parameters, or something weird with the data for sc2. Are they properly filtered/preprocessed? Are you setting apply_preprocessing=False if you have preprocessing the data with your own filters?

@zm711
Copy link
Collaborator

zm711 commented Jun 19, 2024

Also I'll tag @magland, so he can comment if he wants about MS5 stuff.

@kshtjkumar
Copy link
Author

kshtjkumar commented Jun 19, 2024

I don't know which version of spikeinterface you are using, but lots of improvements have been made to circus2 in the main branch. Since it is unlikely that you can find so many clusters on few channels, either there is a mismatch in the parameters, or something weird with the data for sc2. Are they properly filtered/preprocessed? Are you setting apply_preprocessing=False if you have preprocessing the data with your own filters?

I am using v0.100.6, I am passing the preprocessed data to the sc2 sorter, it is re-referenced, notch filtered and bandpassed(300-6000).

@magland
Copy link
Member

magland commented Jun 19, 2024

@kshtjkumar I would play with the ms5 parameters. I'm thinking especially about the detect threshold.

@kshtjkumar
Copy link
Author

@kshtjkumar I would play with the ms5 parameters. I'm thinking especially about the detect threshold.

Could you please suggest on how to go with that ?

@magland
Copy link
Member

magland commented Jun 20, 2024

@kshtjkumar I would play with the ms5 parameters. I'm thinking especially about the detect threshold.

Could you please suggest on how to go with that ?

Could you provide the code/script you are using to run this? Then we can show how to adjust the parameters.

@alejoe91 alejoe91 added question General question regarding SI sorters Related to sorters module labels Jun 21, 2024
@kshtjkumar
Copy link
Author

@kshtjkumar I would play with the ms5 parameters. I'm thinking especially about the detect threshold.

Could you please suggest on how to go with that ?

Could you provide the code/script you are using to run this? Then we can show how to adjust the parameters.

sure:

recording_ecog = spre.bandpass_filter(recording_resampled_ecog, freq_min=300, freq_max = 6000 ) #bandpass filter
recording_notch_ecog = spre.notch_filter(recording_ecog,q = 50)  #notch_filter 
rec_ecog_ref = spre.common_reference(recording_notch_ecog, operator="median", reference="global")  #rereferencing the data 
rec_normed = spre.zscore(recording=rec_ecog_ref)
rec_2 = spre.whiten(rec_normed) 
sorting_rec = ms5.sorting_scheme2(rec_2,
            sorting_parameters=ms5.Scheme2SortingParameters(
                phase1_detect_channel_radius=150,
                detect_channel_radius=50,
                training_duration_sec=60
            )
        )
print(output_folder)
print("Sorter found", len(sorting_rec.get_unit_ids()), "units")
sorting_rec = sorting_rec.remove_empty_units()
print("Sorter found", len(sorting_rec.get_unit_ids()), "non empty units")

@magland
Copy link
Member

magland commented Jun 25, 2024

The parameter to add to Scheme2SortingParameters is detect_threshold. You can see ms5 parameters here

https://github.com/flatironinstitute/mountainsort5/blob/main/docs/scheme2.md

And the defaults are here

https://github.com/flatironinstitute/mountainsort5/blob/main/mountainsort5/schemes/Scheme2SortingParameters.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question regarding SI sorters Related to sorters module
Projects
None yet
Development

No branches or pull requests

5 participants