Skip to content

Peaks (node_pipeline) detected in the margin of the chunks #2213

Open
@maxjuv

Description

@maxjuv

Hi,
I wanted to try the efficiency of a chained peak detection and peak localization. With the same parameters, on the same recording I tried two pipelines (chained vs separated detection/localisation). The chained pipeline crashes at waveform extraction. In fact, some peaks are too close to border.
My code for chained detection/localization, SI version 0.100.dev0 :

extract_dense_waveforms = ExtractDenseWaveforms(recording, ms_before=0.5, ms_after=0.5, return_output=False)
pipeline_nodes = [extract_dense_waveforms,
                 LocalizeMonopolarTriangulation(recording,parents=[extract_dense_waveforms],  **loc_kwargs)]
peaks, peaks_location = detect_peaks(recording,
                                     method='locally_exclusive_torch',
                                     pipeline_nodes = pipeline_nodes ,
                                    **kwargs)

My code for separated detection/localization:

peaks = detect_peaks(recording, method='locally_exclusive_torch', **kwargs)
peaks_location = localize_peaks(recording, peaks,  method='monopolar_triangulation' , **loc_kwargs )

To be noted, for the peak detection I used exclude_sweep_ms=0.1

I tracked the workflow of the node_pipeline and I think the issue comes from the line below.

extra_margin = max_margin - node.get_trace_margin()

For peak detection node.get_trace_margin() returns exclude_sweep_ms in samples. If an exclusion sweep is defined, then the margin (called extra_margin) for peak detection in refined. It appeared that peaks can be detected in this extra_margin, which is not a problem if detection and localization are not chained. However, if chained, the peak in the In the case peak localization is chained, the waveforms of the peaks in the extra_margin can no longer be extracted. Finally, if exclude_sweep_ms is set to 0, the chained pipeline workes. With the following observation, I think the issue is located L508 in core.node_pipeline.py

Cheers
Maxime

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsortingcomponentsRelated to sortingcomponents module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions