Ejemplo n.º 1
0
from probeinterface.plotting import plot_probe

plot_probe(probe)

##############################################################################
# Using the :code:`toolkit`, you can perform preprocessing 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).
# All theses preprocessing steps are "lazy". The computation is done on demand when we call
# `recording.get_traces(...)` or when we save the object to disk.

recording_cmr = recording
recording_f = st.bandpass_filter(recording, freq_min=300, freq_max=6000)
print(recording_f)
recording_cmr = st.common_reference(recording_f, reference='global', operator='median')
print(recording_cmr)

# this computes and saves the recording after applying the preprocessing chain
recording_preprocessed = recording_cmr.save(format='binary')
print(recording_preprocessed)

##############################################################################
# Now you are ready to spike sort 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_sorters())

##############################################################################
# The :code:`ss.installed_sorters()` will list the sorters installed in the machine.
Ejemplo n.º 2
0
##############################################################################
# Change reference
# -------------------
#
# In many cases, before spike sorting, it is wise to re-reference the
# signals to reduce the common-mode noise from the recordings.
#
# To re-reference in :code:`spiketoolkit` you can use the :code:`common_reference`
# function. Both common average reference (CAR) and common median
# reference (CMR) can be applied. Moreover, the average/median can be
# computed on different groups. Single channels can also be used as
# reference.

recording_car = st.common_reference(recording,
                                    reference='global',
                                    operator='average')
recording_cmr = st.common_reference(recording,
                                    reference='global',
                                    operator='median')
recording_single = st.common_reference(recording,
                                       reference='single',
                                       ref_channels=[1])
recording_single_groups = st.common_reference(recording,
                                              reference='single',
                                              groups=[[0, 1], [2, 3]],
                                              ref_channels=[0, 2])

trace0_car = recording_car.get_traces(segment_index=0)[:, 0]
trace0_cmr = recording_cmr.get_traces(segment_index=0)[:, 0]
trace0_single = recording_single.get_traces(segment_index=0)[:, 0]