Skip to content

Commit f273020

Browse files
authored
Merge pull request #3167 from alejoe91/update-docs
Extend docs and API for generation module
2 parents 588ff5f + 2957720 commit f273020

File tree

7 files changed

+215
-64
lines changed

7 files changed

+215
-64
lines changed

doc/api.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,60 @@ spikeinterface.curation
338338
spikeinterface.generation
339339
-------------------------
340340

341+
Core
342+
~~~~
341343
.. automodule:: spikeinterface.generation
342344

345+
.. autofunction:: generate_recording
346+
.. autofunction:: generate_sorting
347+
.. autofunction:: generate_snippets
348+
.. autofunction:: generate_templates
349+
.. autofunction:: generate_recording_by_size
350+
.. autofunction:: generate_ground_truth_recording
351+
.. autofunction:: add_synchrony_to_sorting
352+
.. autofunction:: synthesize_random_firings
353+
.. autofunction:: inject_some_duplicate_units
354+
.. autofunction:: inject_some_split_units
355+
.. autofunction:: synthetize_spike_train_bad_isi
356+
.. autofunction:: inject_templates
357+
.. autofunction:: noise_generator_recording
358+
.. autoclass:: InjectTemplatesRecording
359+
.. autoclass:: NoiseGeneratorRecording
360+
361+
Drift
362+
~~~~~
363+
.. automodule:: spikeinterface.generation
364+
365+
.. autofunction:: generate_drifting_recording
366+
.. autofunction:: generate_displacement_vector
367+
.. autofunction:: make_one_displacement_vector
343368
.. autofunction:: make_linear_displacement
344369
.. autofunction:: move_dense_templates
345370
.. autofunction:: interpolate_templates
346371
.. autoclass:: DriftingTemplates
347372
.. autoclass:: InjectDriftingTemplatesRecording
348373

374+
Hybrid
375+
~~~~~~
376+
.. automodule:: spikeinterface.generation
377+
378+
.. autofunction:: generate_hybrid_recording
379+
.. autofunction:: estimate_templates_from_recording
380+
.. autofunction:: select_templates
381+
.. autofunction:: scale_template_to_range
382+
.. autofunction:: relocate_templates
383+
.. autofunction:: fetch_template_object_from_database
384+
.. autofunction:: fetch_templates_database_info
385+
.. autofunction:: list_available_datasets_in_template_database
386+
.. autofunction:: query_templates_from_database
387+
388+
389+
Noise
390+
~~~~~
391+
.. automodule:: spikeinterface.generation
392+
393+
.. autofunction:: generate_noise
394+
349395

350396
spikeinterface.sortingcomponents
351397
--------------------------------

doc/how_to/benchmark_with_hybrid_recordings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ with known spiking activity. The template (aka average waveforms) of the
99
injected units can be from previous spike sorted data. In this example,
1010
we will be using an open database of templates that we have constructed
1111
from the International Brain Laboratory - Brain Wide Map (available on
12-
`DANDI <https://dandiarchive.org/dandiset/000409?search=IBL&page=2&sortOption=0&sortDir=-1&showDrafts=true&showEmpty=false&pos=9>`__).
12+
`DANDI <https://dandiarchive.org/dandiset/000409?search=IBL&page=2&sortOption=0&sortDir=-1&showDrafts=true&showEmpty=false&pos=9>`_).
1313

1414
Importantly, recordings from long-shank probes, such as Neuropixels,
1515
usually experience drifts. Such drifts have to be taken into account in

doc/modules/generation.rst

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
Generation module
22
=================
33

4-
The :py:mod:`spikeinterface.generation` provides functions to generate recordings containing spikes.
5-
This module proposes several approaches for this including purely synthetic recordings as well as "hybrid" recordings (where templates come from true datasets).
4+
The :py:mod:`spikeinterface.generation` provides functions to generate recordings containing spikes,
5+
which can be used as "ground-truth" for benchmarking spike sorting algorithms.
66

7+
There are several approaches to generating such recordings.
8+
One possibility is to generate purely synthetic recordings. Another approach is to use real
9+
recordings and add synthetic spikes to them, to make "hybrid" recordings.
10+
The advantage of the former is that the ground-truth is known exactly, which is useful for benchmarking.
11+
The advantage of the latter is that the spikes are added to real noise, which can be more realistic.
712

8-
The :py:mod:`spikeinterface.core.generate` already provides functions for generating synthetic data but this module will supply an extended and more complex
9-
machinery, for instance generating recordings that possess various types of drift.
13+
For hybrid recordings, the main challenge is to generate realistic spike templates.
14+
We therefore built an open database of templates that we have constructed from the International
15+
Brain Laboratory - Brain Wide Map (available on
16+
`DANDI <https://dandiarchive.org/dandiset/000409?search=IBL&page=2&sortOption=0&sortDir=-1&showDrafts=true&showEmpty=false&pos=9>`_).
17+
You can check out this collection of over 600 templates from this `web app <https://spikeinterface.github.io/hybrid_template_library/>`_.
18+
19+
The :py:mod:`spikeinterface.generation` module offers tools to interact with this database to select and download templates,
20+
manupulating (e.g. rescaling and relocating them), and construct hybrid recordings with them.
21+
Importantly, recordings from long-shank probes, such as Neuropixels, usually experience drifts.
22+
Such drifts can be taken into account in order to smoothly inject spikes into the recording.
23+
24+
The :py:mod:`spikeinterface.generation` also includes functions to generate different kinds of drift signals and drifting
25+
recordings, as well as generating synthetic noise profiles of various types.
26+
27+
Some of the generation functions are defined in the :py:mod:`spikeinterface.core.generate` module, but also exposed at the
28+
:py:mod:`spikeinterface.generation` level for convenience.

0 commit comments

Comments
 (0)