separate check_graph() and propagate_node_instances()
@@ -8,7 +8,7 @@ from spikeinterface.core.recording_tools import get_noise_levels, get_channel_di
from ..core import get_chunk_with_margin
-from .peak_pipeline import PipelineNode, check_graph, run_nodes
+from .peak_pipeline import PipelineNode, check_graph, propagate_node_instances, run_nodes
from .tools import make_multi_method_doc
try:
@@ -58,7 +58,8 @@ def detect_peaks(recording, method='by_channel', pipeline_nodes=None, **kwargs):
method_args = method_class.check_params(recording, **method_kwargs)
if pipeline_nodes is not None:
- assert all(isinstance(node, PipelineNode) for node in pipeline_nodes)
+ check_graph(pipeline_nodes)
+
if job_kwargs['n_jobs'] > 1:
pipeline_nodes_ = [(node.__class__, node.to_dict()) for node in pipeline_nodes]
else:
@@ -102,6 +103,7 @@ def _init_worker_detect_peaks(recording, method, method_args, extra_margin, pipe
if pipeline_nodes is not None:
pipeline_nodes = [cls.from_dict(recording, kwargs) for cls, kwargs in pipeline_nodes]
+ propagate_node_instances(pipeline_nodes)
# create a local dict per worker
worker_ctx = {}
@@ -112,9 +114,6 @@ def _init_worker_detect_peaks(recording, method, method_args, extra_margin, pipe
worker_ctx['extra_margin'] = extra_margin
worker_ctx['pipeline_nodes'] = pipeline_nodes
- if pipeline_nodes is not None:
- check_graph(pipeline_nodes)
-
return worker_ctx
