Skip to content
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

getWaveforms Bug: Spikes near start or end of recording #21

Open
nmtimme opened this issue Dec 6, 2023 · 3 comments
Open

getWaveforms Bug: Spikes near start or end of recording #21

nmtimme opened this issue Dec 6, 2023 · 3 comments

Comments

@nmtimme
Copy link

nmtimme commented Dec 6, 2023

Hi,

Thanks for making this great resource!

I found a bug in the getWaveForms script. If it selects spike times near the beginning or end of the recording, it will produce an indexing error on line 54. I suggest adding:

curSpikeTimes((curSpikeTimes + gwfparams.wfWin(1)) < 1) = [];
curSpikeTimes((curSpikeTimes + gwfparams.wfWin(end)) > size(mmf.Data.x,2)) = [];

after line 49.

Thanks again for making and sharing this code!

~Nick

@nsteinme
Copy link
Collaborator

nsteinme commented Dec 6, 2023 via email

@nmtimme
Copy link
Author

nmtimme commented Dec 7, 2023

Hi Nick,

I've created the pull request (#22 ). I didn't see any tests that could be run on the new code, but if I just missed them, please let me know and I will run them in the fork. Thanks!

~Nick

@Andrea3v
Copy link

Just want to report that l also found this issue and corrected it with a similar approach after line 49:

    indx1           = curSpikeTimes+gwfparams.wfWin(end)<nSamp;
    indx2           = curSpikeTimes+gwfparams.wfWin(1)>=1;
    curSpikeTimes   = curSpikeTimes(indx1&indx2);     % skips the spike times whose waveform would fall outside the range 1:nSamp 

thanks
~Andre

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants