Extend artifact detection: DetectAndRemoveArtifacts preprocessor and signed saturation#4539
Extend artifact detection: DetectAndRemoveArtifacts preprocessor and signed saturation#4539alejoe91 wants to merge 38 commits intoSpikeInterface:mainfrom
DetectAndRemoveArtifacts preprocessor and signed saturation#4539Conversation
|
Hello, this is great. Part of (my) pipeline philosophy is that you can load a pipeline from a dumped json/pickle: I don't know how this will work when one argument is a recording object? Might just work? And I also like the idea that you can specify a pipeline externally without reference to the recording, which this breaks. But more philosophical than practical... I can't really see a way around this. |
I have a suggestion. We can have some "magic" string:
What do you think? |
saturation application with apodization
for more information, see https://pre-commit.ci
oliche
left a comment
There was a problem hiding this comment.
It's good to go, maybe we could state that this apodization is a number of samples ?
Thanks a lot for looking at this !
Renamed |
| def __init__( | ||
| self, | ||
| recording: BaseRecording, | ||
| recording_to_detect: BaseRecording | None = None, |
There was a problem hiding this comment.
So the idea of the magic string is to allow this to be
| recording_to_detect: BaseRecording | None = None, | |
| recording_to_detect: BaseRecording | str | None = None, |
?
So that a user could pass a preprocessing pipeline
{
'common_reference': {},
'bandpass_filter': {},
'detect_and_remove_artifacts': {'recording_to_detect': 'raw'}
}
or even
{
'phase_shift': {},
'common_reference': {},
'bandpass_filter': {},
'detect_and_remove_artifacts': {'recording_to_detect': 'phase_shift'}
}
When I type it out like this, it looks reasonable. But it only works if you're using a pipeline, since:
phase_shift_recording = si.phase_shift(raw)
remove_artifacts_recording = si.dectect_and_remove_artifacts(phase_shift_recording, recording_to_detect = 'phase_shift')
makes no sense.
Maybe we could add a private kwarg _using_pipeline, and you can only use a string if this is set to true? Or maybe the Pipeline object can be responsible for converting the string into a recording.
Or maybe right now we just add the "raw" option?
This PR introduces a
DetectAndRemoveArtifactsRecordingclass so that it can be used in the preprocessing pipeline.Users can pass a
recording_to_detect: in this case, saturation/artifacts are detected on that recording (e.g., raw) and applied to the preprocessor parent (preprocessed)Also extended saturation to optionally provide the "sign" of the saturation events. This can be useful to further inspect saturation issues and track down experimental causes to the saturation.