-
Notifications
You must be signed in to change notification settings - Fork 2
/
Get_Normalized_Instant_Freq.m
39 lines (35 loc) · 1.02 KB
/
Get_Normalized_Instant_Freq.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
% Get Normalized Instantaneous Frequency from raster
%
% Instantaneous frequency = inverse of ISI
%
% By Jesús Pérez-Ortega jan-2018
% modified feb-2018
% modified jan-2019
function freqs = Get_Normalized_Instant_Freq(data,fps,norm_type,bin)
if(nargin==3)
bin=0;
end
[c,f]=size(data);
freqs=zeros([c f]);
for i=1:c
% Get frequencies
freqs(i,:)=Get_Instant_Freq(data(i,:),fps);
if(~freqs(i,:))
freqs(i,:)=zeros(1,f);
else
% Normalize the firing frequency
if (bin)
freqs(i,:)=smooth(freqs(i,:),bin);
end
if (~strcmp(norm_type,'none'))
freqs(i,:)=freqs(i,:)-mean(freqs(i,:));
switch(norm_type)
case 'norm'
freqs(i,:)=freqs(i,:)/max(freqs(i,:)); % Normalize
case 'zscore'
freqs(i,:)=freqs(i,:)/std(freqs(i,:)); % Z-score
end
end
end
end
end