spikeinterface
0.93.0

Contents:

  • Overview
  • Installation
  • Getting started tutorial
  • Modules documentation
  • Modules tutorials
    • Core tutorials
    • Extractors tutorials
    • Toolkit tutorials
    • Sorters tutorials
    • Comparison tutorials
    • Widgets tutorials
      • RecordingExtractor Widgets Gallery
      • SortingExtractor Widgets Gallery
      • Waveforms Widgets Gallery
        • Extract spike waveforms
      • Peaks Widgets Gallery
  • Compatible Technology
  • Installing Spike Sorters
  • Viewers
  • Contribute
  • API
  • Release notes
  • Contact Us
spikeinterface
  • »
  • Modules tutorials »
  • Waveforms Widgets Gallery
  • Edit on GitHub

Note

Click here to download the full example code

Waveforms Widgets Gallery¶

Here is a gallery of all the available widgets using a pair of RecordingExtractor-SortingExtractor objects.

import matplotlib.pyplot as plt

import spikeinterface as si
import spikeinterface.extractors as se
import spikeinterface.widgets as sw
First, let’s download a simulated dataset

from the repo ‘https://gin.g-node.org/NeuralEnsemble/ephy_testing_data’

local_path = si.download_dataset(remote_path='mearec/mearec_test_10s.h5')
recording = se.MEArecRecordingExtractor(local_path)
sorting = se.MEArecSortingExtractor(local_path)
print(recording)
print(sorting)

Out:

/home/docs/checkouts/readthedocs.org/user_builds/spikeinterface/conda/0.93.0/lib/python3.8/site-packages/MEArec/tools.py:339: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(mearec_version) >= '1.5.0':
/home/docs/checkouts/readthedocs.org/user_builds/spikeinterface/conda/0.93.0/lib/python3.8/site-packages/MEArec/tools.py:339: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(mearec_version) >= '1.5.0':
MEArecRecordingExtractor: 32 channels - 1 segments - 32.0kHz - 10.000s
  file_path: /home/docs/spikeinterface_datasets/ephy_testing_data/mearec/mearec_test_10s.h5
MEArecSortingExtractor: 10 units - 1 segments - 32.0kHz
  file_path: /home/docs/spikeinterface_datasets/ephy_testing_data/mearec/mearec_test_10s.h5

Extract spike waveforms¶

For convenience, metrics are computed on the WaveformExtractor object that gather recording/sorting and extracted waveforms in a single object

folder = 'waveforms_mearec'
we = si.extract_waveforms(recording, sorting, folder,
    load_if_exists=True,
    ms_before=1, ms_after=2., max_spikes_per_unit=500,
    n_jobs=1, chunk_size=30000)

plot_unit_waveforms()¶

unit_ids = sorting.unit_ids[:4]

sw.plot_unit_waveforms(we, unit_ids=unit_ids)
template #0, template #1, template #2, template #3

Out:

<spikeinterface.widgets.unitwaveforms.UnitWaveformsWidget object at 0x7fee9986d850>

plot_unit_templates()¶

unit_ids = sorting.unit_ids

sw.plot_unit_templates(we, unit_ids=unit_ids, ncols=5)
template #0, template #1, template #2, template #3, template #4, template #5, template #6, template #7, template #8, template #9

Out:

<spikeinterface.widgets.unitwaveforms.UnitWaveformsWidget object at 0x7feea323d280>

plot_unit_probe_map()¶

unit_ids = sorting.unit_ids[:4]
sw.plot_unit_probe_map(we, unit_ids=unit_ids)
#0, #1, #2, #3

Out:

<spikeinterface.widgets.unitprobemap.UnitProbeMapWidget object at 0x7fee999d4d00>

plot_unit_waveform_density_map()¶

This is your best friend to check over merge

unit_ids = sorting.unit_ids[:4]
sw.plot_unit_waveform_density_map(we, unit_ids=unit_ids, max_channels=5)
plot 3 waveforms gallery

Out:

<spikeinterface.widgets.unitwaveformdensitymap.UnitWaveformDensityMapWidget object at 0x7fee999f4880>

plot_amplitudes_distribution()¶

sw.plot_amplitudes_distribution(we)
plot 3 waveforms gallery

Out:

<spikeinterface.widgets.amplitudes.AmplitudeDistributionWidget object at 0x7fee999f00a0>

plot_amplitudes_timeseres()¶

sw.plot_amplitudes_timeseries(we)
segment 0

Out:

/home/docs/checkouts/readthedocs.org/user_builds/spikeinterface/conda/0.93.0/lib/python3.8/site-packages/MEArec/tools.py:339: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(mearec_version) >= '1.5.0':
/home/docs/checkouts/readthedocs.org/user_builds/spikeinterface/conda/0.93.0/lib/python3.8/site-packages/MEArec/tools.py:339: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(mearec_version) >= '1.5.0':

<spikeinterface.widgets.amplitudes.AmplitudeTimeseriesWidget object at 0x7fee9a844ee0>

plot_units_depth_vs_amplitude()¶

sw.plot_units_depth_vs_amplitude(we)
plot 3 waveforms gallery

Out:

<spikeinterface.widgets.depthamplitude.UnitsDepthAmplitudeWidget object at 0x7fee9a8b7370>

plot_unit_localization()¶

sw.plot_unit_localization(we, method='center_of_mass')



plt.show()
plot 3 waveforms gallery

Total running time of the script: ( 0 minutes 2.681 seconds)

Download Python source code: plot_3_waveforms_gallery.py

Download Jupyter notebook: plot_3_waveforms_gallery.ipynb

Gallery generated by Sphinx-Gallery

Previous Next

© Copyright 2021, Alessio Paolo Buccino, Cole Hurwitz, Jeremy Magland, Matthias Hennig, Samuel Garcia. Revision e7b849ed.

Built with Sphinx using a theme provided by Read the Docs.