SpikeInterface
0.100.0

Contents:

  • Overview
  • Installation
  • Importing SpikeInterface
  • Modules documentation
  • How to guides
  • Modules example gallery
    • Core tutorials
    • Extractors tutorials
    • Quality metrics tutorial
    • Comparison tutorial
    • Widgets tutorials
      • RecordingExtractor Widgets Gallery
      • SortingExtractor Widgets Gallery
      • Waveforms Widgets Gallery
        • Extract spike waveforms
      • Peaks Widgets Gallery
  • Installing Spike Sorters
  • Viewers
  • Development
  • API
  • Release notes
  • Contact Us
SpikeInterface
  • »
  • Modules example gallery »
  • Waveforms Widgets Gallery
  • Edit on GitHub

Note

Go to the end 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.postprocessing as spost
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)
MEArecRecordingExtractor: 32 channels - 32.0kHz - 1 segments - 320,000 samples - 10.00s
                          float32 dtype - 39.06 MiB
  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)

# pre-compute postprocessing data
_ = spost.compute_spike_amplitudes(we)
_ = spost.compute_unit_locations(we)
_ = spost.compute_spike_locations(we)
_ = spost.compute_template_metrics(we)
/home/docs/checkouts/readthedocs.org/user_builds/spikeinterface/checkouts/0.100.0/examples/modules_gallery/widgets/plot_3_waveforms_gallery.py:32: DeprecationWarning: load_if_exists=True/false is deprcated. Use load_waveforms() instead.
  we = si.extract_waveforms(recording, sorting, folder,

extract waveforms shared_memory multi buffer:   0%|          | 0/11 [00:00<?, ?it/s]
extract waveforms shared_memory multi buffer: 100%|##########| 11/11 [00:00<00:00, 656.68it/s]

extract waveforms memmap multi buffer:   0%|          | 0/11 [00:00<?, ?it/s]
extract waveforms memmap multi buffer: 100%|##########| 11/11 [00:00<00:00, 172.22it/s]

extract amplitudes:   0%|          | 0/10 [00:00<?, ?it/s]
extract amplitudes: 100%|##########| 10/10 [00:00<00:00, 419.95it/s]

localize peaks using center_of_mass:   0%|          | 0/10 [00:00<?, ?it/s]
localize peaks using center_of_mass: 100%|##########| 10/10 [00:00<00:00, 430.62it/s]

plot_unit_waveforms()¶

unit_ids = sorting.unit_ids[:4]

sw.plot_unit_waveforms(we, unit_ids=unit_ids, figsize=(16,4))
template #0, template #1, template #2, template #3
<spikeinterface.widgets.unit_waveforms.UnitWaveformsWidget object at 0x7f5cfb661840>

plot_unit_templates()¶

unit_ids = sorting.unit_ids

sw.plot_unit_templates(we, unit_ids=unit_ids, ncols=5, figsize=(16,8))
template #0, template #1, template #2, template #3, template #4, template #5, template #6, template #7, template #8, template #9
<spikeinterface.widgets.unit_templates.UnitTemplatesWidget object at 0x7f5cfb661a50>

plot_amplitudes()¶

sw.plot_amplitudes(we, plot_histograms=True, figsize=(12,8))
plot 3 waveforms gallery
<spikeinterface.widgets.amplitudes.AmplitudesWidget object at 0x7f5cfb661b70>

plot_unit_locations()¶

sw.plot_unit_locations(we, figsize=(4,8))
plot 3 waveforms gallery
<spikeinterface.widgets.unit_locations.UnitLocationsWidget object at 0x7f5cfb661f00>

plot_unit_waveform_density_map()¶

This is your best friend to check over merge

unit_ids = sorting.unit_ids[:4]
sw.plot_unit_waveforms_density_map(we, unit_ids=unit_ids, figsize=(14,8))
plot 3 waveforms gallery
<spikeinterface.widgets.unit_waveforms_density_map.UnitWaveformDensityMapWidget object at 0x7f5d0823f6a0>

plot_amplitudes_distribution()¶

sw.plot_all_amplitudes_distributions(we, figsize=(10,10))
plot 3 waveforms gallery
<spikeinterface.widgets.all_amplitudes_distributions.AllAmplitudesDistributionsWidget object at 0x7f5d082648b0>

plot_units_depths()¶

sw.plot_unit_depths(we, figsize=(10,10))
plot 3 waveforms gallery
<spikeinterface.widgets.unit_depths.UnitDepthsWidget object at 0x7f5d0b16e530>

plot_unit_probe_map()¶

unit_ids = sorting.unit_ids[:4]
sw.plot_unit_probe_map(we, unit_ids=unit_ids, figsize=(20,8))



plt.show()
#0, #1, #2, #3

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

Download Jupyter notebook: plot_3_waveforms_gallery.ipynb

Download Python source code: plot_3_waveforms_gallery.py

Gallery generated by Sphinx-Gallery

Previous Next

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

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