Skip to content

silence_periods() might have an issue at the very end of a recording #4082

@JeffreyBoucher

Description

@JeffreyBoucher

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:

Image

The "end_frame"

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    preprocessingRelated to preprocessing module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions