@@ -496,19 +496,21 @@ Sparsity
496496In several cases, it is not necessary to have waveforms on all channels. This is especially true for high-density
497497probes, such as Neuropixels, because the waveforms of a unit will only appear on a small set of channels.
498498Sparsity 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
514516methods 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
0 commit comments