comparison demo/plot_strobes.m @ 0:74dedb26614d

Initial checkin of AIM-MAT version 1.5 (6.4.2011).
author tomwalters
date Fri, 20 May 2011 12:32:31 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:74dedb26614d
1 % demonstration file for 'aim-mat'
2 %
3 % (c) 2006-2008, University of Cambridge, Medical Research Council
4 % Written by Tom Walters (tcw24@cam.ac.uk)
5 % http://www.pdn.cam.ac.uk/cnbh/aim2006
6 % $Date: 2008-06-10 18:00:16 +0100 (Tue, 10 Jun 2008) $
7 % $Revision: 585 $
8
9 function plot_strobes(input, options, current_scale, titlestr)
10
11 start_time=options.minimum_time;
12 stop_time=options.maximum_time;
13
14 sig=input.data.signal;
15 current_frame=input.data.nap;
16 strobes=input.data.strobes;
17 input.info.current_plot=4;
18 str=get_graphics_options(input,input.info.current_strobes_module);
19 str.minimum_time_interval=start_time;
20 str.maximum_time_interval=stop_time;
21 duration=stop_time-start_time;
22 sig=getpart(sig,start_time,stop_time);
23 nrchan=getnrchannels(current_frame);
24 temp_scale=1; % for debugging
25 % make the dots of a size of constant ratio to the window size
26 axpos=get(gcf,'Position');
27 marker_dot_size=axpos(3)/168;
28
29 %several channels
30 hand=plot(current_frame/temp_scale,str);hold on
31 xlabel('time (ms)');ylabel('Frequency (kHz)');title(titlestr);
32 colscale=length(hsv)/nrchan;
33 for i=1:nrchan
34 if isfield(strobes,'grouped')
35 nr_sources=size(strobes.cross_strobes{1}.source_cross_channel_value,2);
36 cols=hsv;
37 % first plot the originals
38 % herestrobes=strobes.original{i};
39 % nr_here=length(herestrobes.strobes);
40 % col=cols(round(i*colscale),:);
41 % xoffs=-0.001;
42 % for j=1:nr_here
43 % time=herestrobes.strobes(j);
44 % if time>start_time & time<start_time+duration
45 % val=herestrobes.strobe_vals(j);%/current_scale*max(current_frame);
46 % plot3(time2bin(sig,time+xoffs),i,val,'Marker','o','MarkerFaceColor',col,'MarkerEdgeColor',col,'MarkerSize',3);
47 % end
48 % end
49
50 % then plot all the different connections
51 herestrobesproces=strobes.cross_strobes{i};
52 herestrobes=herestrobesproces.strobe_times;
53 col=cols(round(i*colscale),:);
54 cursize=1;
55 nr_here=length(herestrobes);
56 for j=1:nr_here
57 count=0;
58 for k=1:nr_sources
59 target_chan_act=herestrobesproces.source_cross_channel_value(j,k);
60 if target_chan_act>1
61 colnr=round(k*length(hsv)/nr_sources);
62 colnr=min(colnr,length(hsv));
63 colnr=max(colnr,1);
64 col=cols(colnr,:);
65 cursize=target_chan_act/100;
66 else
67 continue
68 end
69 time=herestrobes(j);
70 if time>start_time & time<start_time+duration
71 offx=(stop_time-start_time)/80*count;
72 count=count+1;
73 val=herestrobesproces.strobe_vals(j)/temp_scale;%/current_scale*max(current_frame);
74 if strcmp(handles.screen_modus,'paper')
75 p=plot3(time2bin(sig,time+offx),i,val,'Marker','o','MarkerSize',4,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',1);
76 else
77 plot3(time2bin(sig,time+offx),i,val,'Marker','o','MarkerFaceColor','r','MarkerEdgeColor','w','MarkerSize',cursize);
78 end
79 end
80 end
81 end
82 else % only one set of strobes
83 herestrobes=strobes{i};
84 nr_here=length(herestrobes.strobes);
85 % marker_dot_size=4;
86 for j=1:nr_here
87 time=herestrobes.strobes(j);
88 if time>start_time & time<stop_time
89 % if j<=length(herestrobes.strobe_vals)
90 val=herestrobes.strobe_vals(j);%/current_scale*max(current_frame);
91 %if strcmp(handles.screen_modus,'paper')
92 % p=plot3(time2bin(sig,time),i,val/temp_scale,'Marker','o','MarkerSize',4,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',1);
93 %else
94 plot3(time2bin(sig,time),i,val,'Marker','o','MarkerSize',marker_dot_size,'MarkerFaceColor','r','MarkerEdgeColor','r','LineWidth',1);
95 %end
96 % end
97 end
98 end
99 end % one or two strobe sources
100 end
101 zmin=0;zmax=max(current_frame)/current_scale;
102
103 % TCW AIM 2006
104 % if hand_scaling == 1
105 set(gca,'Zlim',[zmin,1/current_scale]);
106 % else
107 % set(gca,'Zlim',[zmin,zmax]);
108 % end
109
110 %set(gca,'Zlim',[zmin,zmax]);
111 % if strcmp(handles.screen_modus,'paper')
112 % par=get(hand,'parent');
113 % set(par,'FontSize',12);xlab=get(par,'xlabel');set(xlab,'FontSize',12);ylab=get(par,'ylabel');set(ylab,'FontSize',12);
114 % end
115
116 hold off
117