Skip to content

Commit cdf84b4

Browse files
authored
Merge pull request #3173 from zm711/load-if-exists-docs
Add explainer of compute always computing in the analyzer (vs WaveformExtractor behavior)
2 parents c10326a + 0c0fdd6 commit cdf84b4

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

doc/modules/core.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,15 @@ examples is seen below:
360360
["random_spikes", "waveforms", "templates", "noise_levels"]
361361
)
362362
363+
Note that any extension entered into the :code:`compute` function will be computed. Thus, even if an extension has already been computed
364+
it will be recomputed when :code:`compute` is called even if the parameters are the same.
365+
To check if an extension has already been computed and reload it, you can simply do:
366+
367+
.. code-block:: python
368+
369+
if sorting_analyzer.has_extension("templates"):
370+
templates_extension = sorting_analyzer.get_extension("templates")
371+
363372
It is important when calculating extensions to remember which backend you are using. :code:`compute` accepts an argument
364373
:code:`save` which will write results to disk if using the :code:`zarr` or :code:`binary_folder` backends. If your :code:`SortingAnalyzer`
365374
is in memory using :code:`save=True` **will not** write to disk since spikeinterface does not know where to save it.

examples/tutorials/core/plot_4_sorting_analyzer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@
129129

130130
###############################################################################
131131
# Note that there are a few different ways to calculate extensions. You might find it easier
132-
# to keep the calculation parameters in a dictionary. Let's recalculate everything using this notation:
132+
# to keep the calculation parameters in a dictionary. Let's recalculate everything using this notation
133+
# (note that extensions will be recomputed when we call compute even if the parameters are the same):
133134

134135
job_kwargs = dict(n_jobs=8, chunk_duration="1s", progress_bar=True)
135136
compute_dict = {

examples/tutorials/waveform_extractor_to_sorting_analyzer.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ looks slightly different. Let's calculate these extensions, and also add a param
349349
)
350350
351351
Note that if a parent is recomputed, all its children are deleted to maintain data consistency.
352+
Also note that the ``load_if_exists`` semantic that was found in the ``WaveformExtractor`` has
353+
been removed from the ``SortingAnalyzer``. This means that each call to ``compute`` will recompute
354+
and overwrite the previous results. Adjust your scripts according to account for this new behavior.
352355
Read more about this, the extensions and their keyword arguments in the
353356
`postprocessing module documentation <https://spikeinterface.readthedocs.io/en/latest/modules/postprocessing.html>`_
354357

0 commit comments

Comments
 (0)