blank_staturation with a window around saturation signal#1541
Open
JulesLebert wants to merge 6 commits intoSpikeInterface:mainfrom
Open
blank_staturation with a window around saturation signal#1541JulesLebert wants to merge 6 commits intoSpikeInterface:mainfrom
JulesLebert wants to merge 6 commits intoSpikeInterface:mainfrom
Conversation
h-mayorquin
requested changes
Apr 14, 2023
Collaborator
There was a problem hiding this comment.
Thanks for your contribution.
My thinking in order of descending importance:
- I think that the
ClipRecordingsegment should not be modified. Right now, it is very straightforward and does its own thing very well. If we really want to have something like this we can just create anotherRecordingSegment. In brief, I feel the price of complexity is worse than the price of a small duplication. Finally, this should have some tests. - Are you sure that you need the loop for the numpy implementation? I think that you can calculate where the indexes of
np.werechange by more than one (np.diff) an just expand to the left and right accordingly. This will avoid the inner loop which is the most costly part of your function. Am I missing something? - I think that numba in general will play bad with our way of parallelizing with the
ChunkRecordingExecutor. The former because I am not sure if it will require recompling per core which is usually a higher cost than the operation it implements. Have you tested this?
alejoe91
reviewed
May 23, 2023
Member
|
@JulesLebert is this still being worked on? |
| def _replace_slice_max_numba(traces, a_max, frames_before, frames_after, value_max): | ||
| m, n = traces.shape | ||
| to_clear = np.zeros(m, dtype=np.bool_) | ||
| for j in range(n): |
Member
There was a problem hiding this comment.
you are looping channel then time.
I have the intuition that the reverse would be faster to have coalesing memory access.
no ?
Member
|
@JulesLebert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The preprocessing function that removes saturation just remove the samples where the signal reaches the threshold. This changes allow to also remove the signal around these saturations points (useful to remove parts of a recording where the cable was disconnected for example).
The problem with the modified clip function in pure python is that it is very slow. I have tried a vectorised approach that uses a convolve function from scipy.signal but it only improves performances marginally. Therefore, I have included a numba implementation of the function that increases the speed by ~10 times on my machine and that will only run if numba is installed.