.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorials/qualitymetrics/plot_3_quality_metrics.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_tutorials_qualitymetrics_plot_3_quality_metrics.py: Quality Metrics Tutorial ======================== After spike sorting, you might want to validate the 'goodness' of the sorted units. This can be done using the :code:`qualitymetrics` submodule, which computes several quality metrics of the sorted units. .. GENERATED FROM PYTHON SOURCE LINES 9-18 .. code-block:: Python import spikeinterface.core as si from spikeinterface.qualitymetrics import ( compute_snrs, compute_firing_rates, compute_isi_violations, compute_quality_metrics, ) .. GENERATED FROM PYTHON SOURCE LINES 19-20 First, let's generate a simulated recording and sorting .. GENERATED FROM PYTHON SOURCE LINES 20-25 .. code-block:: Python recording, sorting = si.generate_ground_truth_recording() print(recording) print(sorting) .. rst-class:: sphx-glr-script-out .. code-block:: none GroundTruthRecording (InjectTemplatesRecording): 4 channels - 25.0kHz - 1 segments 250,000 samples - 10.00s - float32 dtype - 3.81 MiB GroundTruthSorting (NumpySorting): 10 units - 1 segments - 25.0kHz .. GENERATED FROM PYTHON SOURCE LINES 26-30 Create SortingAnalyzer ----------------------- For quality metrics we need first to create a :code:`SortingAnalyzer`. .. GENERATED FROM PYTHON SOURCE LINES 30-34 .. code-block:: Python analyzer = si.create_sorting_analyzer(sorting=sorting, recording=recording, format="memory") print(analyzer) .. rst-class:: sphx-glr-script-out .. code-block:: none estimate_sparsity (no parallelization): 0%| | 0/10 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_3_quality_metrics.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_3_quality_metrics.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_