Skip to content

Commit ddf2147

Browse files
authored
Merge branch 'main' into fix-randomness-in-tests
2 parents 7e46a5d + 81261e5 commit ddf2147

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

doc/modules/comparison.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,19 +523,19 @@ in the similarity of templates rather than spiking events.
523523
This enables us to use exactly the same tools for both types of comparisons, just by changing the way that agreement
524524
scores are computed.
525525

526-
The functions to compare templates take a list of :py:class:`~spikeinterface.core.WaveformExtractor` objects as input,
526+
The functions to compare templates take a list of :py:class:`~spikeinterface.core.SortingAnalyzer` objects as input,
527527
which are assumed to be from different sessions of the same animal over time. In this case, let's assume we have 5
528-
waveform extractors from day 1 (:code:`we_day1`) to day 5 (:code:`we_day5`):
528+
sorting analyzers from day 1 (:code:`analyzer_day1`) to day 5 (:code:`analyzer_day5`):
529529

530530
.. code-block:: python
531531
532-
we_list = [we_day1, we_day2, we_day3, we_day4, we_day5]
532+
analyzer_list = [analyzer_day1, analyzer_day2, analyzer_day3, analyzer_day4, analyzer_day5]
533533
534534
# match only day 1 and 2
535-
p_tcmp = sc.compare_templates(we1=we_day1, we2=we_day2, we1_name="Day1", we2_name="Day2")
535+
p_tcmp = sc.compare_templates(sorting_analyzer_1=analyzer_day1, sorting_analyzer2=analyzer_day2, name1="Day1", name2="Day2")
536536
537537
# match all
538-
m_tcmp = sc.compare_multiple_templates(waveform_list=we_list,
538+
m_tcmp = sc.compare_multiple_templates(waveform_list=analyzer_list,
539539
name_list=["D1", "D2", "D3", "D4", "D5"])
540540
541541

doc/modules/core.rst

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -496,19 +496,21 @@ Sparsity
496496
In several cases, it is not necessary to have waveforms on all channels. This is especially true for high-density
497497
probes, such as Neuropixels, because the waveforms of a unit will only appear on a small set of channels.
498498
Sparsity is defined as the subset of channels on which waveforms (and related information) are defined. Of course,
499-
sparsity is not global, but it is unit-specific.
499+
sparsity is not global, but it is unit-specific. Importantly, saving sparse waveforms, especially for high-density probes,
500+
dramatically reduces the size of the waveforms extension if computed.
500501

501-
**NOTE** As of version :code:`0.99.0` the default for a :code:`extract_waveforms()` has :code:`sparse=True`, i.e. every :code:`waveform_extractor`
502-
will be sparse by default. Thus for users that wish to have dense waveforms they must set :code:`sparse=False`. Keyword arguments
503-
can still be input into the :code:`extract_wavforms()` to generate the desired sparsity as explained below.
502+
**NOTE** As of :code:`0.101.0` all :code:`SortingAnalyzer`'s have a default of :code:`sparse=True`. This was first
503+
introduced in :code:`0.99.0` for :code:`WaveformExtractor`'s and will be the default going forward. To obtain dense
504+
waveforms you will need to set :code:`sparse=False` at the creation of the :code:`SortingAnalyzer`.
504505

505-
Sparsity can be computed from a :py:class:`~spikeinterface.core.WaveformExtractor` object with the
506-
:py:func:`~spikeinterface.core.compute_sparsity` function:
506+
507+
Sparsity can be computed from a :py:class:`~spikeinterface.core.SortingAnalyzer` object with the
508+
:py:func:`~spikeinterface.core.estimate_sparsity` function:
507509

508510
.. code-block:: python
509511
510-
# in this case 'we' should be a dense waveform_extractor
511-
sparsity = compute_sparsity(we, method="radius", radius_um=40)
512+
# in this case 'analyzer' should be a dense SortingAnalyzer
513+
sparsity = compute_sparsity(analyzer, method="radius", radius_um=40)
512514
513515
The returned :code:`sparsity` is a :py:class:`~spikeinterface.core.ChannelSparsity` object, which has convenient
514516
methods to access the sparsity information in several ways:
@@ -529,17 +531,19 @@ There are several methods to compute sparsity, including:
529531
* | :code:`method="by_property"`: selects channels based on a property, such as :code:`group`. This method is recommended
530532
| when working with tetrodes.
531533
532-
The computed sparsity can be used in several postprocessing and visualization functions. In addition, a "dense"
533-
:py:class:`~spikeinterface.core.WaveformExtractor` can be saved as "sparse" as follows:
534+
The computed sparsity can be used in several postprocessing and visualization functions. In addition, this sparsity can be
535+
used when creating a :py:class:`~spikeinterface.core.SortingAnalyzer` which cause the :code:`sparse` boolean to be ignored.
534536

535537
.. code-block:: python
536538
537-
we_sparse = we.save(sparsity=sparsity, folder="waveforms_sparse")
539+
analyzer_sparse = si.create_sorting_analyzer(
540+
sorting=sorting,
541+
recording=recording,
542+
sparsity=sparsity,
543+
format='binary_folder',
544+
folder="sparse_analyzer"
545+
)
538546
539-
The :code:`we_sparse` object will now have an associated sparsity (:code:`we.sparsity`), which is automatically taken
540-
into consideration for downstream analysis (with the :py:meth:`~spikeinterface.core.WaveformExtractor.is_sparse`
541-
method). Importantly, saving sparse waveforms, especially for high-density probes, dramatically reduces the size of the
542-
waveforms folder.
543547
544548
.. _save_load:
545549

doc/modules/postprocessing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ This extension computes the principal components of the waveforms. There are sev
205205
* "by_channel_global": fits the same PCA model to all channels (also termed temporal PCA)
206206
* "concatenated": concatenates all channels and fits a PCA model on the concatenated data
207207

208-
If the input :code:`WaveformExtractor` is sparse, the sparsity is used when computing the PCA.
208+
If the input :code:`SortingAnalyzer` is sparse, the sparsity is used when computing the PCA.
209209
For dense waveforms, sparsity can also be passed as an argument.
210210

211211
.. code-block:: python

0 commit comments

Comments
 (0)