Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_import():
import spikeinterface.extractors as se
import spikeinterface.toolkit as st
import spikeinterface.sorters as ss
import spikeinterface.comparison as sc
import spikeinterface.widgets as sw
# se
recording, sorting_true = se.example_datasets.toy_example(duration=60, num_channels=4, seed=0)
# st
rec_f = st.preprocessing.bandpass_filter(recording)
# ss
print(ss.available_sorters())
# sc
sc.compare_two_sorters(sorting_true, sorting_true)
# sw
sw.plot_timeseries(rec_f)
"""
import spikeinterface.extractors as se
import spikeinterface.sorters as ss
##############################################################################
# First, let's create a toy example:
recording, sorting_true = se.example_datasets.toy_example(duration=10, seed=0)
##############################################################################
# Check available sorters
# --------------------------
#
print(ss.available_sorters())
##############################################################################
# This will list the sorters installed in the machine. Each spike sorter
# is implemented in a class. To access the class names you can run:
print(ss.installed_sorter_list)
##############################################################################
# Change sorter parameters
# -----------------------------------
#
default_ms4_params = ss.Mountainsort4Sorter.default_params()
print(default_ms4_params)
##############################################################################
print(recording_prb.get_channel_locations())
##############################################################################
# Using the :code:`toolkit`, you can perform pre-processing on the recordings. Each pre-processing function also returns
# a :code:`RecordingExtractor`, which makes it easy to build pipelines. Here, we filter the recording and apply common
# median reference (CMR)
recording_f = st.preprocessing.bandpass_filter(recording, freq_min=300, freq_max=6000)
recording_cmr = st.preprocessing.common_reference(recording_f, reference='median')
##############################################################################
# Now you are ready to spikesort using the :code:`sorters` module!
# Let's first check which sorters are implemented and which are installed
print('Available sorters', ss.available_sorters())
print('Installed sorters', ss.installed_sorter_list)
##############################################################################
# The :code:`ss.installed_sorter_list` will list the sorters installed in the machine. Each spike sorter
# is implemented as a class. We can see we have Klusta and Mountainsort4 installed.
# Spike sorters come with a set of parameters that users can change. The available parameters are dictionaries and
# can be accessed with:
print(ss.get_default_params('mountainsort4'))
print(ss.get_default_params('klusta'))
##############################################################################
# Let's run mountainsort4 and change one of the parameter, the detection_threshold:
sorting_MS4 = ss.run_mountainsort4(recording=recording_cmr, detect_threshold=6)