flatironinstitute / ironclust

Spike sorting software being developed at Flatiron Institute, based on JRCLUST (Janelia Rocket Cluster)
Apache License 2.0
28 stars 7 forks source link

Stim Latency Tool #6

Closed zsperry closed 5 years ago

zsperry commented 5 years ago

I know this one might take a bit longer, and I'm going to try to hack together a version myself in the meantime, but it would be great to have a tool to calculate latency from an event to cluster timing, something that would show a PSTH with a mean/median latency based on input times from the .nev (like "Import Events" in the "Add Event Trial" though you could generalize it so other users can import different event time files). Should probably have options to control the PSTH (bin size/number, maximum time). It would also be cool to designate one of the units as a stimulation artifact, in case there's an issue with the .nev event timing. Let me know what you think...

jamesjun commented 5 years ago

PSTH tool already exists. Please take a look here: https://github.com/JaneliaSciComp/JRCLUST/wiki/PSTH-view

It could improve though.

-James

On Thu, Nov 29, 2018 at 3:22 PM zsperry notifications@github.com wrote:

I know this one might take a bit longer, and I'm going to try to hack together a version myself in the meantime, but it would be great to have a tool to calculate latency from an event to cluster timing, something that would show a PSTH with a mean/median latency based on input times from the .nev (like "Import Events" in the "Add Event Trial" though you could generalize it so other users can import different event time files). Should probably have options to control the PSTH (bin size/number, maximum time). It would also be cool to designate one of the units as a stimulation artifact, in case there's an issue with the .nev event timing. Let me know what you think...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jamesjun/ironclust/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AIhwuKBMdawCemod6UFrPR0BZ-zDNmIDks5u0EIigaJpZM4Y6cm8 .

zsperry commented 5 years ago

Fantastic, guess that's one we hadn't looked at together! I'll read up and let you know if I have questions, glad I didn't dive in to making one :P

-Zach

On Thu, Nov 29, 2018 at 3:49 PM James Jun notifications@github.com wrote:

PSTH tool already exists. Please take a look here: https://github.com/JaneliaSciComp/JRCLUST/wiki/PSTH-view

It could improve though.

-James

On Thu, Nov 29, 2018 at 3:22 PM zsperry notifications@github.com wrote:

I know this one might take a bit longer, and I'm going to try to hack together a version myself in the meantime, but it would be great to have a tool to calculate latency from an event to cluster timing, something that would show a PSTH with a mean/median latency based on input times from the .nev (like "Import Events" in the "Add Event Trial" though you could generalize it so other users can import different event time files). Should probably have options to control the PSTH (bin size/number, maximum time). It would also be cool to designate one of the units as a stimulation artifact, in case there's an issue with the .nev event timing. Let me know what you think...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jamesjun/ironclust/issues/6, or mute the thread < https://github.com/notifications/unsubscribe-auth/AIhwuKBMdawCemod6UFrPR0BZ-zDNmIDks5u0EIigaJpZM4Y6cm8

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jamesjun/ironclust/issues/6#issuecomment-442987905, or mute the thread https://github.com/notifications/unsubscribe-auth/AVNxB8bG_bhlLJK2ZsVOtAHOuJsgb7Blks5u0EhRgaJpZM4Y6cm8 .

zsperry commented 5 years ago

I added a few lines to the file extension case structure so this would read in events from .nev, same as i did for the Trials menu.

elseif matchFileExt_(vcFile_trial,'.nev') vcFile_nev = vcFile_trial; [~,hFile]=ns_OpenFile(vcFile_nev); vi_event = find(strcmp({hFile.Entity.EntityType}, 'Event')); [~, S_EntityInfo] = ns_GetEntityInfo(hFile, vi_event); vrTime_trial = zeros(S_EntityInfo.ItemCount, 1); for iT = 1:numel(vrTime_trial) [~, vrTime_trial(iT)]=ns_GetEventData(hFile, vi_event, iT); end

jamesjun commented 5 years ago

Thanks Zach, I will add this feature today and update.

-James

On Tue, Dec 4, 2018 at 1:16 PM zsperry notifications@github.com wrote:

I added a few lines to the file extension case structure so this would read in events from .nev, same as i did for the Trials menu.

elseif matchFileExt_(vcFile_trial,'.nev') vcFile_nev = vcFile_trial; [,hFile]=ns_OpenFile(vcFile_nev); vi_event = find(strcmp({hFile.Entity.EntityType}, 'Event')); [, S_EntityInfo] = ns_GetEntityInfo(hFile, vi_event); vrTime_trial = zeros(S_EntityInfo.ItemCount, 1); for iT = 1:numel(vrTime_trial) [~, vrTime_trial(iT)]=ns_GetEventData(hFile, vi_event, iT); end

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jamesjun/ironclust/issues/6#issuecomment-444201775, or mute the thread https://github.com/notifications/unsubscribe-auth/AIhwuKDC2zHW4J0c250gB8fY0l1Bnaarks5u1rvngaJpZM4Y6cm8 .

zsperry commented 5 years ago

Working with the new tool, and it loads the .nev file pretty well. I also like the new "settings" menu. But the PSTH I get looks very different than it used to...do I need to play with the settings? Here's a sample, let me know if you need more info. Currently using matlab 2017a.

image

jamesjun commented 5 years ago

Thanks for providing the details on the version number. Could you please tell me which .nev file you loaded ? I might have that file on my local drive to reproduce the error.

jamesjun commented 5 years ago

I believe this happens when there is only one trial in .nev file. Please try leaving the channel number empty after you select add PSTH channel menu. It will include all the event labels. You can select preview after adding the PSTH channel from .nev file to see what event labels are included.

jamesjun commented 5 years ago

I found a bug in the code that calculates the bar plot above and fixed it in v4.3.3.