Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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.widgets as sw
##############################################################################
# First, let's create a toy example with the `extractors` module:
recording, sorting = se.example_datasets.toy_example(duration=10, num_channels=4, seed=0)
##############################################################################
# plot_timeseries()
# ~~~~~~~~~~~~~~~~~
w_ts = sw.plot_timeseries(recording)
w_ts1 = sw.plot_timeseries(recording, trange=[5, 8])
recording.set_channel_groups(channel_ids=recording.get_channel_ids(), groups=[0, 0, 1, 1])
w_ts2 = sw.plot_timeseries(recording, trange=[5, 8], color_groups=True)
##############################################################################
# **Note**: each function returns a widget object, which allows to access the figure and axis.
w_ts.figure.suptitle("Recording by group")
w_ts.ax.set_ylabel("Channel_ids")
##############################################################################
# plot_electrode_geometry()
# ~~~~~~~~~~~~~~~~~~~~~~~~~
w_el = sw.plot_electrode_geometry(recording)
##############################################################################
Here is a gallery of all the available widgets using RecordingExtractor objects.
'''
import spikeinterface.extractors as se
import spikeinterface.widgets as sw
##############################################################################
# First, let's create a toy example with the `extractors` module:
recording, sorting = se.example_datasets.toy_example(duration=10, num_channels=4, seed=0)
##############################################################################
# plot_timeseries()
# ~~~~~~~~~~~~~~~~~
w_ts = sw.plot_timeseries(recording)
w_ts1 = sw.plot_timeseries(recording, trange=[5, 8])
recording.set_channel_groups(channel_ids=recording.get_channel_ids(), groups=[0, 0, 1, 1])
w_ts2 = sw.plot_timeseries(recording, trange=[5, 8], color_groups=True)
##############################################################################
# **Note**: each function returns a widget object, which allows to access the figure and axis.
w_ts.figure.suptitle("Recording by group")
w_ts.ax.set_ylabel("Channel_ids")
##############################################################################
# plot_electrode_geometry()
# ~~~~~~~~~~~~~~~~~~~~~~~~~
w_el = sw.plot_electrode_geometry(recording)
##############################################################################
# First, let's create a toy example with the :code:`extractors` module:
recording, sorting_true = se.example_datasets.toy_example(duration=10, num_channels=4, seed=0)
##############################################################################
# :code:`recording` is a :code:`RecordingExtractor` object, which extracts information about channel ids, channel locations
# (if present), the sampling frequency of the recording, and the extracellular traces. :code:`sorting_true` is a
# :code:`SortingExtractor` object, which contains information about spike-sorting related information, including unit ids,
# spike trains, etc. Since the data are simulated, :code:`sorting_true` has ground-truth information of the spiking
# activity of each unit.
#
# Let's use the :code:`widgets` module to visualize the traces and the raster plots.
w_ts = sw.plot_timeseries(recording, trange=[0,5])
w_rs = sw.plot_rasters(sorting_true, trange=[0,5])
##############################################################################
# This is how you retrieve info from a :code:`RecordingExtractor`...
channel_ids = recording.get_channel_ids()
fs = recording.get_sampling_frequency()
num_chan = recording.get_num_channels()
print('Channel ids:', channel_ids)
print('Sampling frequency:', fs)
print('Number of channels:', num_chan)
##############################################################################
# ...and a :code:`SortingExtractor`
unit_ids = sorting_true.get_unit_ids()
##############################################################################
# First, let's create a toy example with the `extractors` module:
recording, sorting = se.example_datasets.toy_example(duration=10, num_channels=4, seed=0)
##############################################################################
# plot_timeseries()
# ~~~~~~~~~~~~~~~~~
w_ts = sw.plot_timeseries(recording)
w_ts1 = sw.plot_timeseries(recording, trange=[5, 8])
recording.set_channel_groups(channel_ids=recording.get_channel_ids(), groups=[0, 0, 1, 1])
w_ts2 = sw.plot_timeseries(recording, trange=[5, 8], color_groups=True)
##############################################################################
# **Note**: each function returns a widget object, which allows to access the figure and axis.
w_ts.figure.suptitle("Recording by group")
w_ts.ax.set_ylabel("Channel_ids")
##############################################################################
# plot_electrode_geometry()
# ~~~~~~~~~~~~~~~~~~~~~~~~~
w_el = sw.plot_electrode_geometry(recording)
##############################################################################
# plot_spectrum()
# ~~~~~~~~~~~~~~~~
w_sp = sw.plot_spectrum(recording)