Skip to content

Commit c4eb8a5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 28476cc commit c4eb8a5

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/spikeinterface/core/node_pipeline.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,16 @@ def get_trace_margin(self):
8787
def get_dtype(self):
8888
return base_peak_dtype
8989

90-
def get_peak_slice(self, segment_index, start_frame, end_frame, ):
90+
def get_peak_slice(
91+
self,
92+
segment_index,
93+
start_frame,
94+
end_frame,
95+
):
9196
# not needed for PeakDetector
9297
raise NotImplementedError
9398

99+
94100
# this is used in sorting components
95101
class PeakDetector(PeakSource):
96102
pass
@@ -474,7 +480,7 @@ def run_node_pipeline(
474480
nodes,
475481
job_kwargs,
476482
job_name="pipeline",
477-
#mp_context=None,
483+
# mp_context=None,
478484
gather_mode="memory",
479485
gather_kwargs={},
480486
squeeze_output=True,
@@ -506,7 +512,7 @@ def run_node_pipeline(
506512
The gather consists of concatenating features related to peaks (localization, pca, scaling, ...) into a single big vector.
507513
These vectors can be in "memory" or in files ("npy")
508514
509-
515+
510516
Parameters
511517
----------
512518
@@ -533,7 +539,7 @@ def run_node_pipeline(
533539
skip_after_n_peaks : None | int
534540
Skip the computation after n_peaks.
535541
This is not an exact because internally this skip is done per worker in average.
536-
542+
537543
Returns
538544
-------
539545
outputs: tuple of np.array | np.array
@@ -596,7 +602,7 @@ def _compute_peak_pipeline_chunk(segment_index, start_frame, end_frame, worker_c
596602

597603
recording_segment = recording._recording_segments[segment_index]
598604
node0 = nodes[0]
599-
605+
600606
if isinstance(node0, (SpikeRetriever, PeakRetriever)):
601607
# in this case PeakSource could have no peaks and so no need to load traces just skip
602608
peak_slice = i0, i1 = node0.get_peak_slice(segment_index, start_frame, end_frame, max_margin)
@@ -676,7 +682,6 @@ def _compute_peak_pipeline_chunk(segment_index, start_frame, end_frame, worker_c
676682
return
677683

678684

679-
680685
class GatherToMemory:
681686
"""
682687
Gather output of nodes into list and then demultiplex and np.concatenate

src/spikeinterface/core/tests/test_node_pipeline.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_run_node_pipeline(cache_folder_creation):
8787

8888
peak_retriever = PeakRetriever(recording, peaks)
8989
# this test when no spikes in last chunks
90-
peak_retriever_few = PeakRetriever(recording, peaks[:peaks.size//2])
90+
peak_retriever_few = PeakRetriever(recording, peaks[: peaks.size // 2])
9191

9292
# channel index is from template
9393
spike_retriever_T = SpikeRetriever(
@@ -212,13 +212,14 @@ def test_skip_after_n_peaks():
212212
nodes = [node0, node1]
213213

214214
skip_after_n_peaks = 30
215-
some_amplitudes = run_node_pipeline(recording, nodes, job_kwargs, gather_mode="memory", skip_after_n_peaks=skip_after_n_peaks)
215+
some_amplitudes = run_node_pipeline(
216+
recording, nodes, job_kwargs, gather_mode="memory", skip_after_n_peaks=skip_after_n_peaks
217+
)
216218

217219
assert some_amplitudes.size >= skip_after_n_peaks
218220
assert some_amplitudes.size < spikes.size
219221

220222

221-
222223
# the following is for testing locally with python or ipython. It is not used in ci or with pytest.
223224
if __name__ == "__main__":
224225
# folder = Path("./cache_folder/core")

0 commit comments

Comments
 (0)