-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Hello everyone!
I have run into an error with silence_periods (in the process of running peak_detection) which only occurs for at least one concatenation of recordings, but appears consistently. the troublesome line is:
" traces[onset:offset, :] = noise[onset:offset]"
Within the "get_traces" function of silence_periods.py
The size of the noise ends up being too small to fit in traces... This happens only for the very last chunk of recording, and in this specific case, it seems to be off by exactly one sample, as shown below.
My recording object, importantly with sample count:

The "end_frame"

I plan to experiment with "just clipping off the errant sample since it is one sample at the end of the recording anyway"; whether this is sufficient will depend on whether the error crops up again.
In any case, thought I might report it! Let me know what can be done to clarify, though the hack solution of:
try:
traces[onset:offset, :] = noise[onset:offset]
except Exception as e:
noiseSize = np.shape(noise)[0]
tracesSize = np.shape(traces)[0]
offset = min(noiseSize,tracesSize)
traces[onset:offset, :] = noise[onset:offset]
is doing okay for now.
Thanks,
Jeff Boucher