K-L w/ Fiser lab
How to read stim times and spike times for K-L stims analysis:
Step 1: Make sure all of the cells have been imported to the experiment.mat file for the experiment you want to analyze:
ds = dirstruct([MYPATHNAME '2053-01-02']) ; % or whatever your experiment is named
importspikedata(ds); % import all records from the multichannel acquisition system
Optional Step: Use the built-in functions to explore the spiketimes and stimtimes:
stimtimes = kl_extractstimtimes(ds,'t00001'); % substitute your own directory for t00001
spiketimes = kl_extractspiketimes(ds,'t00001'); % substitute your own directory for t00001
Step 2: Create time-bins of the spike trains associated with the various events for a given directory. (check out help MarjenaData2SpikeBins)
[FULLPATH, TRES, SPIKES_IN_BINS, TIMEBINS, EVENTTIMES, NUMCELLS] = ...
The EventData is in the order 'blank', 'noise', 'gratings', 'movie' (the KL_matrix below will be in the same order)
Step 3: Calculate the event-by-event KL (check out help MarjenaData2SpikeBins)
[KL_matrix, H_matrix] = JohannaKL(spikes);
See help JohannaKL for the information on the outputs. This doesn't yet perform any scrambling of the spiketime bins in time or across channels.
That's it for now!
If you have lots of Intan .rhd files in a single directory, you can concatenate them into one with the function concat_rhd_files(dirname).
You can use the Intan sorter to extract spikes from Intan files