-
Notifications
You must be signed in to change notification settings - Fork 237
blank_staturation with a window around saturation signal #1541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
|
@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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are looping channel then time.
I have the intuition that the reverse would be faster to have coalesing memory access.
no ?
|
@JulesLebert |
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.