예제 #1
0
export_to_phy(we_TDC, './phy_folder_for_TDC',
              compute_pc_features=False, compute_amplitudes=True)

##############################################################################
# Then you can run the template-gui with: :code:`phy template-gui phy/params.py`
# and manually curate the results.


##############################################################################
# Quality metrics for the spike sorting output are very important to asses the spike sorting performance.
# The :code:`spikeinterface.toolkit.qualitymetrics` module implements several quality metrics
# to assess the goodness of sorted units. Among those, for example,
# are signal-to-noise ratio, ISI violation ratio, isolation distance, and many more.
# Theses metrics are built on top of WaveformExtractor class and return a dictionary with the unit ids as keys:

snrs = st.compute_snrs(we_TDC)
print(snrs)
isi_violations_rate, isi_violations_count = st.compute_isi_violations(we_TDC, isi_threshold_ms=1.5)
print(isi_violations_rate)
print(isi_violations_count)

##############################################################################
# All theses quality mertics can be computed in one shot and returned as
# a :code:`pandas.Dataframe`

metrics = st.compute_quality_metrics(we_TDC, metric_names=['snr', 'isi_violation', 'amplitude_cutoff'])
print(metrics)

##############################################################################
# Quality metrics can be also used to automatically curate the spike sorting
# output. For example, you can select sorted units with a SNR above a 
예제 #2
0
                          max_spikes_per_unit=500,
                          n_jobs=1,
                          chunk_size=30000)
print(we)

##############################################################################
# The :code:`spikeinterface.toolkit.qualitymetrics` submodule has a set of functions that allow users to compute
# metrics in a compact and easy way. To compute a single metric, one can simply run one of the
# quality metric functions as shown below. Each function has a variety of adjustable parameters that can be tuned.

firing_rates = st.compute_firing_rate(we)
print(firing_rates)
isi_violation_ratio, isi_violations_rate, isi_violations_count = st.compute_isi_violations(
    we)
print(isi_violation_ratio)
snrs = st.compute_snrs(we)
print(snrs)

##############################################################################
# Some metrics are based on the principal component scores, so they require a
# :code:`WaveformsPrincipalComponent` object as input:

pc = st.compute_principal_components(we,
                                     load_if_exists=True,
                                     n_components=3,
                                     mode='by_channel_local')
print(pc)

pc_metrics = st.calculate_pc_metrics(pc, metric_names=['nearest_neighbor'])
print(pc_metrics)