You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to create a fake spike sorting which just picks huge spikes and ignores everything else. So the code for this task is pretty simple and works well:
I read the results of this "sortering" by my usual tool:
importsys,osimportspikeinterface.fullassiimportspikeinterface_gui## This cerate a Qt appapp=spikeinterface_gui.mkQApp()
# reload the waveform foldertry:
rc=si.load_extractor(sys.argv[1]+"/preprocessed")
exceptBaseExceptionase:
print(f"Cannot preprocessed data from {sys.argv[1]}/preprocessed: {e}")
exit(1)
ifos.path.isdir(sys.argv[1]+'/waveforms-clean'):
try:
we=si.WaveformExtractor.load_from_folder(sys.argv[1]+'/waveforms-clean')
exceptBaseExceptionase:
print(f"Cannot load waveform from {sys.argv[1]}/waveforms-clean: {e}")
exit(1)
print('have read waveforms-clean')
elifos.path.isdir(sys.argv[1]+'/waveforms'):
try:
we=si.WaveformExtractor.load_from_folder(sys.argv[1]+'/waveforms')
exceptBaseExceptionase:
print(f"Cannot load waveform from {sys.argv[1]}/waveforms: {e}")
exit(1)
print('have read waveforms')
else:
exit(1)
pca=si.compute_principal_components(we, load_if_exists=True, mode='by_channel_local', n_components=3)
ccg=si.compute_correlograms(we,load_if_exists=True, window_ms=2000, bin_ms=1)
isi=si.compute_isi_histograms(we,load_if_exists=True, window_ms=2000, bin_ms=1)
#DB>>sr=si.load_extractor(sys.argv[1]+'/sorting-saved')
srspikes=sr.to_spike_vector()
wespikes=we.sorting.to_spike_vector()
print(srspikes.size)
print(wespikes.size)
#<<DB# create the mainwindow and showwin=spikeinterface_gui.MainWindow(we)
win.show()
# run the main Qt6 loopapp.exec()
The problem is that:
if I set detect_threshold in the "sorter" below 5., which gives "spikes" at each electrode - the viewer works just fine
If I set detect_threshold higher than 5, means only a few spikes are selected, it returns an error
python read-sorting.py detect-highamp
have read waveforms
10419
10419
/home/rth/.local/apps/spikes/lib/python3.10/site-packages/spikeinterface/postprocessing/unit_localization.py:366: RuntimeWarning: invalid value encountered in divide
com = np.sum(wf_data[:, np.newaxis] * local_contact_locations, axis=0) / np.sum(wf_data)
Traceback (most recent call last):
File "/home/rth/spikeinterface/read-sorting.py", line 44, in <module>
win = spikeinterface_gui.MainWindow(we)
File "/home/rth/.local/apps/spikes/lib/python3.10/site-packages/spikeinterface_gui/mainwindow.py", line 23, in __init__
self.controller = SpikeinterfaceController(waveform_extractor, verbose=verbose)
File "/home/rth/.local/apps/spikes/lib/python3.10/site-packages/spikeinterface_gui/controller.py", line 115, in __init__
self.spikes['sample_index'] = spikes_['sample_index']
ValueError: could not broadcast input array from shape (10419,) into shape (9201,)
Note, that number of spikes are the same in saved sorter and in we.sorting, but somehow it is different inside the GUI. Any ideas what it may be?
The text was updated successfully, but these errors were encountered:
I try to create a fake spike sorting which just picks huge spikes and ignores everything else. So the code for this task is pretty simple and works well:
I read the results of this "sortering" by my usual tool:
The problem is that:
detect_threshold
in the "sorter" below 5., which gives "spikes" at each electrode - the viewer works just finedetect_threshold
higher than 5, means only a few spikes are selected, it returns an errorNote, that number of spikes are the same in saved sorter and in
we.sorting
, but somehow it is different inside the GUI. Any ideas what it may be?The text was updated successfully, but these errors were encountered: