-
Notifications
You must be signed in to change notification settings - Fork 2
/
Plot_Peaks_On_Coactivity.m
65 lines (57 loc) · 1.47 KB
/
Plot_Peaks_On_Coactivity.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function Plot_Peaks_On_Coactivity(coactivity,peak_indices,sequence,noise_group,...
plot_peak_number,colors,width)
% Plot Peaks
%
% Plot_Peaks_On_Coactivity(coactivity,peak_indices,group_indices,noise_group,...
% plot_peak_number,group_colors,width)
%
% Pérez-Ortega Jesús - March 2018
% modified May 2019
% modified Feb 2020
n = max(sequence);
switch(nargin)
case 5
plot_peak_number = false;
width = 1;
colors = Read_Colors(n);
case 6
width = 1;
colors = Read_Colors(n);
case 7
width = 1;
end
F = length(peak_indices);
peaks = max(peak_indices);
% Find vectors
%
for i = 1:peaks
peak = find(peak_indices==i);
group = sequence(i);
if ~ismember(group,noise_group)
x = peak(1)-width:peak(end)+width;
x(x<=0) = [];
x(x>=F) = [];
if length(x)==1
plot(x,coactivity(x),'.','color',colors(group,:),'markersize',10)
else
plot(x,coactivity(x),'-','color',colors(group,:),'linewidth',1.5)
end
if plot_peak_number
max_peak = max(coactivity(x));
text(peak(1),max_peak,num2str(i))
end
end
end
%}
% rethinking
%{
id = find(peak_indices>0);
ensembles = unique(sequence)';
for i = ensembles
% Create binary signal to identify the lenght of each activation
x = [];
x(id(sequence==i)) = 1;
x = logical(x);
plot(find(x),coactivity(x),'.','color',colors(i,:),'markersize',10)
end
%}