-
Notifications
You must be signed in to change notification settings - Fork 2
/
plot_ff.m
40 lines (35 loc) · 1.1 KB
/
plot_ff.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
% Compute a plot fano factor as a function of time. Use the binned data
% in unit_yes_trial etc. The FF is variance over mean for some time bin
% (here
%
% This code will compute the fano factor for a selected single neuron and
% for each behavioral condition.
%
% blue: lick right
% red: lick left
%
%
% Ziqiang Wei
load('ephysDataset.mat')
sampleRate = 14.84;
cellId = 1;
% Fano factor is computed as the variance of spike counts across trial over
% its mean across trial
% Divide spike rate by sample rate to get spike count;
% Divide variance of spike rate by sample rate squared to get variance of spike count
meanR = mean(ephysDataset(cellId).sr_right,1)/sampleRate;
meanL = mean(ephysDataset(cellId).sr_left,1)/sampleRate;
varR = var(ephysDataset(cellId).sr_right,1)/sampleRate^2;
varL = var(ephysDataset(cellId).sr_left,1)/sampleRate^2;
FF_R = varR./meanR;
FF_L = varL./meanL;
figure
hold on
plot(timeTag, FF_R,'b')
plot(timeTag, FF_L,'r')
gridxy([-2.6 -1.3 0],'Color','k','Linestyle','--') ;
xlim([-3.0 1.5]);
xlabel('Time from movement (sec)')
ylabel('Fano factor')
hold off