Skip to content

Commit a071605

Browse files
committed
Zach's suggestion and more docstring fixes
1 parent f95658e commit a071605

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/spikeinterface/core/sortinganalyzer.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ def __repr__(self) -> str:
230230
txt = f"{clsname}: {nchan} channels - {nunits} units - {nseg} segments - {self.format}"
231231
if self.is_sparse():
232232
txt += " - sparse"
233-
if self.has_recording() or self.has_temporary_recording():
233+
if self.has_recording():
234234
txt += " - has recording"
235+
if self.has_temporary_recording():
236+
txt += " - has temporary recording"
235237
ext_txt = f"Loaded {len(self.extensions)} extensions: " + ", ".join(self.extensions.keys())
236238
txt += "\n" + ext_txt
237239
return txt
@@ -350,7 +352,7 @@ def create_memory(cls, sorting, recording, sparsity, return_scaled, rec_attribut
350352
def create_binary_folder(cls, folder, sorting, recording, sparsity, return_scaled, rec_attributes):
351353
# used by create and save_as
352354

353-
assert recording is not None, "To create a SortingAnalyzer you need recording not None"
355+
assert recording is not None, "To create a SortingAnalyzer you need to specify the recording"
354356

355357
folder = Path(folder)
356358
if folder.is_dir():
@@ -1221,7 +1223,7 @@ def compute(self, input, save=True, extension_params=None, verbose=False, **kwar
12211223
extensions[ext_name] = ext_params
12221224
self.compute_several_extensions(extensions=extensions, save=save, verbose=verbose, **job_kwargs)
12231225
else:
1224-
raise ValueError("SortingAnalyzer.compute() need str, dict or list")
1226+
raise ValueError("SortingAnalyzer.compute() needs a str, dict or list")
12251227

12261228
def compute_one_extension(self, extension_name, save=True, verbose=False, **kwargs) -> "AnalyzerExtension":
12271229
"""
@@ -1357,7 +1359,7 @@ def compute_several_extensions(self, extensions, save=True, verbose=False, **job
13571359
extension_class = get_extension_class(extension_name)
13581360
assert (
13591361
self.has_recording() or self.has_temporary_recording()
1360-
), f"Extension {extension_name} need the recording"
1362+
), f"Extension {extension_name} requires the recording"
13611363

13621364
for variable_name in extension_class.nodepipeline_variables:
13631365
result_routage.append((extension_name, variable_name))
@@ -1605,17 +1607,17 @@ def _sort_extensions_by_dependency(extensions):
16051607
def _get_children_dependencies(extension_name):
16061608
"""
16071609
Extension classes have a `depend_on` attribute to declare on which class they
1608-
depend. For instance "templates" depend on "waveforms". "waveforms depends on "random_spikes".
1610+
depend on. For instance "templates" depends on "waveforms". "waveforms" depends on "random_spikes".
16091611
1610-
This function is making the reverse way : get all children that depend of a
1612+
This function is going the opposite way: it finds all children that depend on a
16111613
particular extension.
16121614
1613-
This is recursive so this includes : children and so grand children and great grand children
1615+
The implementation is recursive so that the output includes children, grand children, great grand children, etc.
16141616
1615-
This function is usefull for deleting on recompute.
1616-
For instance recompute the "waveforms" need to delete "template"
1617-
This make sens if "ms_before" is change in "waveforms" because the template also depends
1618-
on this parameters.
1617+
This function is useful for deleting existing extensions on recompute.
1618+
For instance, recomputing the "waveforms" needs to delete the "templates", since the latter depends on the former.
1619+
For this particular example, if we change the "ms_before" parameter of the "waveforms", also the "templates" will
1620+
require recomputation as this parameter is inherited.
16191621
"""
16201622
names = []
16211623
children = _extension_children[extension_name]

0 commit comments

Comments
 (0)