Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5610518
Refactor aftifacts detection.
samuelgarcia Jan 6, 2026
ef3e820
Integrate the saturation detector
samuelgarcia Jan 21, 2026
a71dade
Progagate new periods dtype to SilencedPeriodsRecording with backward…
samuelgarcia Jan 21, 2026
0d709e6
oups
samuelgarcia Jan 21, 2026
7ab75c0
oups
samuelgarcia Jan 21, 2026
7c7446e
Applying extras from other PR, adding voltage_per_sec_threshold.
JoeZiminski Jan 29, 2026
86e6924
Rename uV_per_sec_threshold.
JoeZiminski Jan 29, 2026
8b17890
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 29, 2026
4d507ad
Updates testing converting to int.
JoeZiminski Feb 6, 2026
6546166
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 6, 2026
5fd5ddd
Merge branch 'main' into artifact_detector_refactor
alejoe91 Feb 11, 2026
dc5a030
solve conflicts
alejoe91 Mar 16, 2026
4df3ff0
Use diff_threshold_uV, clean up, extend tests
alejoe91 Mar 17, 2026
fb9867b
fix: get rid of forkserver mp_context
alejoe91 Mar 17, 2026
a8c3ef5
cast traces to float32 to aboid overflow issues
alejoe91 Mar 17, 2026
3f0b371
Merge branch 'main' into artifact_detector_refactor
alejoe91 Mar 17, 2026
b6544db
Fix envelope and remove mute_window_ms
alejoe91 Mar 18, 2026
6032924
Add check_for_peak_source in run_node_pipeline and update api.rst
alejoe91 Mar 19, 2026
0b1a098
raise if saturation is None
alejoe91 Mar 20, 2026
c7fa4ff
fix: collapsing events 1-sample off
alejoe91 Mar 20, 2026
c5c8134
fix overlapping collaped events: they must be from the same segment
alejoe91 Mar 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ def create_cache_folder(tmp_path_factory):
return cache_folder


@pytest.fixture(scope="module")
def debug_plots(request):
"""Return True if debug plots should be shown."""
return request.config.getoption("--debug-plots")


def pytest_addoption(parser):
parser.addoption(
"--debug-plots",
action="store_true",
default=False,
help="Enable debug plots during tests",
)


def pytest_collection_modifyitems(config, items):
"""
This function marks (in the pytest sense) the tests according to their name and file_path location
Expand Down
3 changes: 3 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ spikeinterface.preprocessing
.. autofunction:: detect_bad_channels
.. autofunction:: detect_and_interpolate_bad_channels
.. autofunction:: detect_and_remove_bad_channels
.. autofunction:: detect_artifact_periods
.. autofunction:: detect_artifact_periods_by_envelope
.. autofunction:: detect_saturation_periods
.. autofunction:: directional_derivative
.. autofunction:: filter
.. autofunction:: gaussian_filter
Expand Down
18 changes: 11 additions & 7 deletions src/spikeinterface/core/node_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,16 +495,17 @@ def find_parents_of_type(list_of_parents, parent_type):
return parents


def check_graph(nodes):
def check_graph(nodes, check_for_peak_source=True):
"""
Check that node list is orderd in a good (parents are before children)
"""

node0 = nodes[0]
if not isinstance(node0, PeakSource):
raise ValueError(
"Peak pipeline graph must have as first element a PeakSource (PeakDetector or PeakRetriever or SpikeRetriever"
)
if check_for_peak_source:
node0 = nodes[0]
if not isinstance(node0, PeakSource):
raise ValueError(
"Peak pipeline graph must have as first element a PeakSource (PeakDetector or PeakRetriever or SpikeRetriever"
)

for i, node in enumerate(nodes):
assert isinstance(node, PipelineNode), f"Node {node} is not an instance of PipelineNode"
Expand Down Expand Up @@ -532,6 +533,7 @@ def run_node_pipeline(
verbose=False,
skip_after_n_peaks=None,
recording_slices=None,
check_for_peak_source=True,
):
"""
Machinery to compute in parallel operations on peaks and traces.
Expand Down Expand Up @@ -587,6 +589,8 @@ def run_node_pipeline(
Optionaly give a list of slices to run the pipeline only on some chunks of the recording.
It must be a list of (segment_index, frame_start, frame_stop).
If None (default), the function iterates over the entire duration of the recording.
check_for_peak_source : bool, default True
Whether to check that the first node is a PeakSource (PeakDetector or PeakRetriever or

Returns
-------
Expand All @@ -595,7 +599,7 @@ def run_node_pipeline(
If squeeze_output=True and only one output then directly np.array.
"""

check_graph(nodes)
check_graph(nodes, check_for_peak_source=check_for_peak_source)

job_kwargs = fix_job_kwargs(job_kwargs)
assert all(isinstance(node, PipelineNode) for node in nodes)
Expand Down
2 changes: 2 additions & 0 deletions src/spikeinterface/preprocessing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
PreprocessingPipeline,
)

from .detect_artifacts import detect_artifact_periods, detect_artifact_periods_by_envelope, detect_saturation_periods

# for snippets
from .align_snippets import AlignSnippets
from warnings import warn
Expand Down
Loading
Loading