annotate aim-mat/gui/aim_replotgraphic.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % procedure for 'aim-mat'
tomwalters@0 2 %function handles=replotgraphic(handles,options)
tomwalters@0 3 %
tomwalters@0 4 % INPUT VALUES:
tomwalters@0 5 % handles
tomwalters@0 6 % options: fields indicate, which graphic is to plot:
tomwalters@0 7 % withtime=options.withtime;
tomwalters@0 8 % withfre=options.withfre;
tomwalters@0 9 % withsignal=options.withsignal;
tomwalters@0 10 % figure_handle=options.figure_handle;
tomwalters@0 11 % RETURN VALUE:
tomwalters@0 12 % updated handles
tomwalters@0 13 %
tomwalters@0 14 % plots the current graphic in the GUI or in the current windowhandle
bleeck@3 15 %
tomwalters@0 16 % (c) 2011, University of Southampton
bleeck@3 17 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 18 % download of current version is on the soundsoftware site:
bleeck@3 19 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 20 % documentation and everything is on http://www.acousticscale.org
bleeck@3 21
bleeck@3 22
tomwalters@0 23
tomwalters@0 24 function handles=aim_replotgraphic(handles,options)
tomwalters@0 25
tomwalters@0 26 withtime=options.withtime;
tomwalters@0 27 withfre=options.withfre;
tomwalters@0 28 withsignal=options.withsignal;
tomwalters@0 29 figure_handle=options.figure_handle;
tomwalters@0 30
tomwalters@0 31 %TCW AIM2006 - added hand scaling so that when on the slider scale value is absolutely
tomwalters@0 32 %absolute. This is set in init_aim_gui (can we find anywhere better to do
tomwalters@0 33 %this?)
tomwalters@0 34 hand_scaling=handles.hand_scaling;
tomwalters@0 35
tomwalters@0 36 if isfield(options,'display_single_channel')
tomwalters@0 37 do_single_channel=1;
tomwalters@0 38 else
tomwalters@0 39 do_single_channel=0;
tomwalters@0 40 options.display_single_channel=1; % in case, the frame has only one channel
tomwalters@0 41 end
tomwalters@0 42
tomwalters@0 43 % where
tomwalters@0 44 current_plot=handles.info.current_plot;
tomwalters@0 45 if ~ishandle(figure_handle)
tomwalters@0 46 new_fig=figure;
tomwalters@0 47 handles.info.current_figure=new_fig;
tomwalters@0 48 end
tomwalters@0 49
tomwalters@0 50 figure(figure_handle);
tomwalters@0 51 clf
tomwalters@0 52 set(gca,'Position',[0 0.1 0.92 0.89]);
tomwalters@0 53 cur_axis=gca;
tomwalters@0 54
tomwalters@0 55 win=get(cur_axis,'Parent');
tomwalters@0 56 set(win,'NumberTitle','off');
tomwalters@0 57 namestr=aim_getwindowtitle(handles); % get the title of the current window
tomwalters@0 58 set(win,'Name',namestr);
tomwalters@0 59
tomwalters@0 60 relative_axis=get(gca,'Position'); % the relative axis for the plot. Everything is plotted inside
tomwalters@0 61 % define up to four graphic areas for the different plots inside the axis
tomwalters@0 62 % given in 'relative_axis'
tomwalters@0 63 [myaxes1,myaxes2,myaxes3,myaxes4]=aim_define_plot_areas(handles,relative_axis,options);
tomwalters@0 64 % 1: signal window at top
tomwalters@0 65 % 2: main window in middle
tomwalters@0 66 % 3: temporal profile
tomwalters@0 67 % 4: frequency profile
tomwalters@0 68
tomwalters@0 69 % find out about the signal, length and duration
tomwalters@0 70 sig=handles.data.signal;
tomwalters@0 71 % len=getlength(sig);
tomwalters@0 72
tomwalters@0 73
tomwalters@0 74 if current_plot>=6
tomwalters@0 75 sai=handles.data.sai;
tomwalters@0 76 if handles.with_graphic==0
tomwalters@0 77 current_frame_number=handles.current_frame_nr;
tomwalters@0 78 else
tomwalters@0 79 current_frame_number=round(slidereditcontrol_get_value(handles.currentslidereditcombi));
tomwalters@0 80 end
tomwalters@0 81 if current_frame_number<=length(sai) && current_frame_number>0
tomwalters@0 82 start_time=getcurrentframestarttime(sai{current_frame_number});
tomwalters@0 83 else
tomwalters@0 84 start_time=getminimumtime(sig);
tomwalters@0 85 current_frame_number=1; % error!
tomwalters@0 86 handles.currentslidereditcombi=slidereditcontrol_set_value(handles.currentslidereditcombi,length(sai));
tomwalters@0 87 end
tomwalters@0 88 duration=getlength(sai{current_frame_number});
tomwalters@0 89 else
tomwalters@0 90 start_time=slidereditcontrol_get_value(handles.currentslidereditcombi);
tomwalters@0 91 duration=slidereditcontrol_get_value(handles.slideredit_duration);
tomwalters@0 92 end
tomwalters@0 93 stop_time=start_time+duration;
tomwalters@0 94
tomwalters@0 95 % in case of auditory image, we simply want the last part of the signal:
tomwalters@0 96 if stop_time>getmaximumtime(sig);
tomwalters@0 97 start_time=getmaximumtime(sig)-duration;
tomwalters@0 98 stop_time=getmaximumtime(sig);
tomwalters@0 99 end
tomwalters@0 100 if start_time < getminimumtime(sig)
tomwalters@0 101 start_time =getminimumtime(sig);
tomwalters@0 102 end
tomwalters@0 103 % sig=getpart(sig,start_time,stop_time);
tomwalters@0 104
tomwalters@0 105
tomwalters@0 106 % The signal window
tomwalters@0 107 if withsignal
tomwalters@0 108 set(myaxes1,'Visible','on');
tomwalters@0 109 % axes(myaxes1);
tomwalters@0 110 % sig=getpart(sig,start_time,stop_time);
tomwalters@0 111 if strcmp(handles.screen_modus,'paper')
tomwalters@0 112 h=plot(sig,[start_time stop_time],myaxes1);
tomwalters@0 113 set(h,'Color','k');
tomwalters@0 114 set(h,'LineWidth',1.5);
tomwalters@0 115 else
tomwalters@0 116 plot(sig,[start_time stop_time],myaxes1);
tomwalters@0 117 end
tomwalters@0 118 if min(sig)==0 % for niceness: Clicktrains are cut away otherwise
tomwalters@0 119 ax=axis;
tomwalters@0 120 ax(3)=-0.1;
tomwalters@0 121 axis(ax);
tomwalters@0 122 end
tomwalters@0 123 title('');set(gca,'XTick',[]);set(gca,'YTick',[]);xlabel('');ylabel('');
tomwalters@0 124 end
tomwalters@0 125
tomwalters@0 126
tomwalters@0 127
tomwalters@0 128 % from here: plot in axes2:
tomwalters@0 129 % axes(myaxes2);
tomwalters@0 130 set(myaxes2,'XDir','normal')
tomwalters@0 131 set(myaxes2,'XScale','lin');
tomwalters@0 132 if handles.with_graphic==1
tomwalters@0 133 current_scale=slidereditcontrol_get_value(handles.slideredit_scale);
tomwalters@0 134 else
tomwalters@0 135 current_scale=options.data_scale;
tomwalters@0 136 end
tomwalters@0 137
tomwalters@0 138 switch current_plot
tomwalters@0 139 case {-1,0,1} % signal
tomwalters@0 140 set(myaxes2,'Visible','off');
tomwalters@0 141 case 2% pcp
tomwalters@0 142 sig=handles.data.pcp;
tomwalters@0 143 % current_frame=getpart(sig,start_time,stop_time);
tomwalters@0 144 ca=plot(sig,[start_time stop_time]);
tomwalters@0 145 set(gca,'YTick',[]);
tomwalters@0 146 ax=axis;
tomwalters@0 147 ax(3)=ax(3)/current_scale;
tomwalters@0 148 ax(4)=ax(4)/current_scale;
tomwalters@0 149 axis(ax);
tomwalters@0 150 title('');xlabel('');ylabel('');
tomwalters@0 151 case 3% bmm
tomwalters@0 152 current_frame=handles.data.bmm;
tomwalters@0 153 str=get_graphics_options(handles,handles.info.current_bmm_module);
tomwalters@0 154 str.minimum_time_interval=start_time;
tomwalters@0 155 str.maximum_time_interval=stop_time;
tomwalters@0 156 nrchan=getnrchannels(handles.data.bmm);
tomwalters@0 157 if do_single_channel || nrchan==1
tomwalters@0 158 sig=getsinglechannel(current_frame,options.display_single_channel);
tomwalters@0 159 % sig=getpart(sig,start_time,stop_time);
tomwalters@0 160 ymin=min(current_frame)*1.1;ymax=max(current_frame)*1.1;
tomwalters@0 161 plot(sig,[start_time stop_time ymin ymax]);
tomwalters@0 162 set(gca,'Ylim',[ymin,ymax]);set(gca,'YAxisLocation','right');
tomwalters@0 163 xlabel('time (ms)');ylabel('amplitude');title('');
tomwalters@0 164 else
tomwalters@0 165 hand=plot(current_frame,str,myaxes2);
tomwalters@0 166 zmin=min(current_frame)/current_scale;zmax=max(current_frame)/current_scale;
tomwalters@0 167
tomwalters@0 168 %set(gca,'Zlim',[zmin,zmax]);
tomwalters@0 169
tomwalters@0 170 %TCW AIM 2006
tomwalters@0 171 if hand_scaling == 1
tomwalters@0 172 set(gca,'Zlim',[0,1/current_scale]);
tomwalters@0 173 else
tomwalters@0 174 %TCW AIM 2006 to get this frequency axis correct, this lower
tomwalters@0 175 %limit of the z axis really needs to be zero
tomwalters@0 176 set(gca,'Zlim',[0,zmax]);
tomwalters@0 177 end
tomwalters@0 178
tomwalters@0 179 xlabel('time (ms)');ylabel('Frequency (kHz)');title('');
tomwalters@0 180 if strcmp(handles.screen_modus,'paper')
tomwalters@0 181 par=get(hand,'parent');
tomwalters@0 182 set(par,'FontSize',12);xlab=get(par,'xlabel');set(xlab,'FontSize',12);ylab=get(par,'ylabel');set(ylab,'FontSize',12);
tomwalters@0 183 end
tomwalters@0 184 end
tomwalters@0 185 case 4% nap
tomwalters@0 186 current_frame=handles.data.nap;
tomwalters@0 187 str=get_graphics_options(handles,handles.info.current_nap_module);
tomwalters@0 188 str.minimum_time_interval=start_time;
tomwalters@0 189 str.maximum_time_interval=stop_time;
tomwalters@0 190 nrchan=getnrchannels(current_frame);
tomwalters@0 191 if do_single_channel || nrchan==1
tomwalters@0 192 sig=getsinglechannel(current_frame,options.display_single_channel);
tomwalters@0 193 % sig=getpart(sig,start_time,stop_time);
tomwalters@0 194 ymin=0;
tomwalters@0 195 ymax=max(current_frame)*1.1;
tomwalters@0 196 plot(sig,[start_time stop_time]);
tomwalters@0 197 set(gca,'Ylim',[ymin,ymax]);set(gca,'YAxisLocation','right');
tomwalters@0 198 xlabel('time (ms)');ylabel('amplitude');title('');
tomwalters@0 199 else
tomwalters@0 200 hand=plot(current_frame,str);
tomwalters@0 201 zmin=0;zmax=max(current_frame)/current_scale;
tomwalters@0 202
tomwalters@0 203 %TCW AIM 2006
tomwalters@0 204 if hand_scaling == 1
tomwalters@0 205 set(gca,'Zlim',[zmin,1/current_scale]);
tomwalters@0 206 else
tomwalters@0 207 set(gca,'Zlim',[zmin,zmax]);
tomwalters@0 208 end
tomwalters@0 209
tomwalters@0 210 %set(gca,'Zlim',[zmin,zmax]);
tomwalters@0 211
tomwalters@0 212
tomwalters@0 213 xlabel('time (ms)');ylabel('Frequency (kHz)');title('');
tomwalters@0 214
tomwalters@0 215 if strcmp(handles.screen_modus,'paper')
tomwalters@0 216 par=get(hand,'parent');
tomwalters@0 217 set(par,'FontSize',12);xlab=get(par,'xlabel');set(xlab,'FontSize',12);ylab=get(par,'ylabel');set(ylab,'FontSize',12);
tomwalters@0 218 end
tomwalters@0 219 end
tomwalters@0 220 case 5% strobes
tomwalters@0 221 current_frame=handles.data.nap;
tomwalters@0 222 strobes=handles.data.strobes;
tomwalters@0 223 str=get_graphics_options(handles,handles.info.current_strobes_module);
tomwalters@0 224 str.minimum_time_interval=start_time;
tomwalters@0 225 str.maximum_time_interval=stop_time;
tomwalters@0 226 nrchan=getnrchannels(current_frame);
tomwalters@0 227 temp_scale=1; % for debugging
tomwalters@0 228 % make the dots of a size of constant ratio to the window size
tomwalters@0 229 axpos=get(gcf,'Position');
tomwalters@0 230 marker_dot_size=axpos(3)/168;
tomwalters@0 231 if do_single_channel || nrchan==1 % only one channel
tomwalters@0 232
tomwalters@0 233 chan_nr=options.display_single_channel;
tomwalters@0 234 % chan_nr = [chan_nr-2 chan_nr-1 chan_nr chan_nr+1];
tomwalters@0 235 % chan_nr = [chan_nr-1 chan_nr];
tomwalters@0 236 chan_nr = chan_nr;
tomwalters@0 237 chan_nr=chan_nr(chan_nr>0 & chan_nr < getnrchannels(current_frame));
tomwalters@0 238 options.display_single_channel=chan_nr;
tomwalters@0 239
tomwalters@0 240 plot_single_channel_strobes(current_frame,options,handles,str,strobes,current_scale,duration);
tomwalters@0 241 else %several channels
tomwalters@0 242 hand=plot(current_frame/temp_scale,str,myaxes2);hold on
tomwalters@0 243 xlabel('time (ms)');ylabel('Frequency (kHz)');title('');
tomwalters@0 244 colscale=length(hsv)/nrchan;
tomwalters@0 245 for i=1:nrchan
tomwalters@0 246 if isfield(strobes,'grouped')
tomwalters@0 247 nr_sources=size(strobes.cross_strobes{1}.source_cross_channel_value,2);
tomwalters@0 248 cols=hsv;
tomwalters@0 249 % first plot the originals
tomwalters@0 250 % herestrobes=strobes.original{i};
tomwalters@0 251 % nr_here=length(herestrobes.strobes);
tomwalters@0 252 % col=cols(round(i*colscale),:);
tomwalters@0 253 % xoffs=-0.001;
tomwalters@0 254 % for j=1:nr_here
tomwalters@0 255 % time=herestrobes.strobes(j);
tomwalters@0 256 % if time>start_time & time<start_time+duration
tomwalters@0 257 % val=herestrobes.strobe_vals(j);%/current_scale*max(current_frame);
tomwalters@0 258 % plot3(time2bin(sig,time+xoffs),i,val,'Marker','o','MarkerFaceColor',col,'MarkerEdgeColor',col,'MarkerSize',3);
tomwalters@0 259 % end
tomwalters@0 260 % end
tomwalters@0 261
tomwalters@0 262 % then plot all the different connections
tomwalters@0 263 herestrobesproces=strobes.cross_strobes{i};
tomwalters@0 264 herestrobes=herestrobesproces.strobe_times;
tomwalters@0 265 col=cols(round(i*colscale),:);
tomwalters@0 266 cursize=1;
tomwalters@0 267 nr_here=length(herestrobes);
tomwalters@0 268 for j=1:nr_here
tomwalters@0 269 count=0;
tomwalters@0 270 for k=1:nr_sources
tomwalters@0 271 target_chan_act=herestrobesproces.source_cross_channel_value(j,k);
tomwalters@0 272 if target_chan_act>1
tomwalters@0 273 colnr=round(k*length(hsv)/nr_sources);
tomwalters@0 274 colnr=min(colnr,length(hsv));
tomwalters@0 275 colnr=max(colnr,1);
tomwalters@0 276 col=cols(colnr,:);
tomwalters@0 277 cursize=target_chan_act/100;
tomwalters@0 278 else
tomwalters@0 279 continue
tomwalters@0 280 end
tomwalters@0 281 time=herestrobes(j);
tomwalters@0 282 if time>start_time && time<start_time+duration
tomwalters@0 283 offx=(stop_time-start_time)/80*count;
tomwalters@0 284 count=count+1;
tomwalters@0 285 val=herestrobesproces.strobe_vals(j)/temp_scale;%/current_scale*max(current_frame);
tomwalters@0 286 if strcmp(handles.screen_modus,'paper')
tomwalters@0 287 p=plot3(time2bin(sig,time+offx),i,val,'Marker','o','MarkerSize',4,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',1);
tomwalters@0 288 else
tomwalters@0 289 plot3(time2bin(sig,time+offx),i,val,'Marker','o','MarkerFaceColor','r','MarkerEdgeColor','w','MarkerSize',cursize);
tomwalters@0 290 end
tomwalters@0 291 end
tomwalters@0 292 end
tomwalters@0 293 end
tomwalters@0 294 else % only one set of strobes
tomwalters@0 295 herestrobes=strobes{i};
tomwalters@0 296 nr_here=length(herestrobes.strobes);
tomwalters@0 297 % marker_dot_size=4;
tomwalters@0 298 for j=1:nr_here
tomwalters@0 299 time=herestrobes.strobes(j);
tomwalters@0 300 if time>start_time && time<start_time+duration
tomwalters@0 301 % if j<=length(herestrobes.strobe_vals)
tomwalters@0 302 val=herestrobes.strobe_vals(j);%/current_scale*max(current_frame);
tomwalters@0 303 if strcmp(handles.screen_modus,'paper')
tomwalters@0 304 p=plot3(time2bin(sig,time-start_time),i,val/temp_scale,'Marker','o','MarkerSize',4,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',1);
tomwalters@0 305 else
tomwalters@0 306 plot3(time2bin(sig,time-start_time),i,val,'Marker','o','MarkerSize',marker_dot_size,'MarkerFaceColor','r','MarkerEdgeColor','r','LineWidth',1);
tomwalters@0 307 end
tomwalters@0 308 % end
tomwalters@0 309 end
tomwalters@0 310 end
tomwalters@0 311 end % one or two strobe sources
tomwalters@0 312 end
tomwalters@0 313 zmin=0;zmax=max(current_frame)/current_scale;
tomwalters@0 314
tomwalters@0 315 % TCW AIM 2006
tomwalters@0 316 if hand_scaling == 1
tomwalters@0 317 set(gca,'Zlim',[zmin,1/current_scale]);
tomwalters@0 318 else
tomwalters@0 319 set(gca,'Zlim',[zmin,zmax]);
tomwalters@0 320 end
tomwalters@0 321
tomwalters@0 322 %set(gca,'Zlim',[zmin,zmax]);
tomwalters@0 323 if strcmp(handles.screen_modus,'paper')
tomwalters@0 324 par=get(hand,'parent');
tomwalters@0 325 set(par,'FontSize',12);xlab=get(par,'xlabel');set(xlab,'FontSize',12);ylab=get(par,'ylabel');set(ylab,'FontSize',12);
tomwalters@0 326 end
tomwalters@0 327 end
tomwalters@0 328 hold off
tomwalters@0 329 case 6% sai
tomwalters@0 330 sai=handles.data.sai;
tomwalters@0 331 current_frame=sai{current_frame_number};
tomwalters@0 332 allmax=getallmaxvalue(current_frame);
tomwalters@0 333 str=get_graphics_options(handles,handles.info.current_sai_module);
tomwalters@0 334 str.extra_options=getfield(handles.all_options.sai,handles.info.current_sai_module);
tomwalters@0 335 nrchan=getnrchannels(current_frame);
tomwalters@0 336 if do_single_channel || nrchan==1
tomwalters@0 337 current_frame=current_frame;
tomwalters@0 338 sig=getsinglechannel(current_frame,options.display_single_channel);
tomwalters@0 339 h=plot(sig,str);set(gca,'YAxisLocation','right');
tomwalters@0 340 set(gca,'YLim',[0 allmax*1.1]);
tomwalters@0 341 else
tomwalters@0 342 hand=plot(current_frame,str,myaxes2);
tomwalters@0 343 %%% TCW - AIM2006
tomwalters@0 344 %zmin=0;zmax=50/current_scale;
tomwalters@0 345 zmin=0;zmax=(max(current_frame)+eps*1000)/current_scale;
tomwalters@0 346 %%%
tomwalters@0 347
tomwalters@0 348 %TCW AIM 2006
tomwalters@0 349 if hand_scaling == 1
tomwalters@0 350 set(gca,'Zlim',[zmin,1/current_scale]);
tomwalters@0 351 else
tomwalters@0 352 set(gca,'Zlim',[zmin,zmax]);
tomwalters@0 353 end
tomwalters@0 354
tomwalters@0 355 %set(gca,'Zlim',[zmin,zmax]);
tomwalters@0 356 if strcmp(handles.screen_modus,'paper')
tomwalters@0 357 par=get(hand,'parent');
tomwalters@0 358 set(par,'FontSize',12);xlab=get(par,'xlabel');set(xlab,'FontSize',12);ylab=get(par,'ylabel');set(ylab,'FontSize',12);
tomwalters@0 359 end
tomwalters@0 360 end
tomwalters@0 361 xlabel('time interval (ms)');ylabel('Frequency (kHz)');title('');
tomwalters@0 362 case 7% user module
tomwalters@0 363 usermodule=handles.data.usermodule;
tomwalters@0 364 nr_frames=length(usermodule);
tomwalters@0 365 current_frame_number=round(slidereditcontrol_get_value(handles.currentslidereditcombi));
tomwalters@0 366
tomwalters@0 367 current_data=handles.data.usermodule;
tomwalters@0 368 first_data=current_data{1};
tomwalters@0 369 if isobject(first_data) && isoftype(first_data,'frame')
tomwalters@0 370 current_frame=current_data{current_frame_number};
tomwalters@0 371 else
tomwalters@0 372 current_frame=sai{current_frame_number};
tomwalters@0 373 end
tomwalters@0 374 plotting_frame=current_frame*current_scale;
tomwalters@0 375
tomwalters@0 376 generating_module_string=get(handles.listbox6,'String');
tomwalters@0 377 generating_module=generating_module_string(get(handles.listbox6,'Value'));
tomwalters@0 378 generating_module=generating_module{1};
tomwalters@0 379 generating_functionline=['handles.all_options.usermodule.' generating_module '.displayfunction'];
tomwalters@0 380 eval(sprintf('display_function=%s;',generating_functionline'));
tomwalters@0 381 if strcmp(display_function,'')
tomwalters@0 382 str=get_graphics_options(handles,handles.info.calculated_usermodule_module);
tomwalters@0 383 plot(plotting_frame,str,myaxes2);
tomwalters@0 384 xlabel('time interval (ms)');ylabel('Frequency (kHz)');title('');
tomwalters@0 385 else
tomwalters@0 386 generating_options_line=['options=handles.all_options.usermodule.' generating_module ';'];
tomwalters@0 387 eval(generating_options_line);
tomwalters@0 388 options.handles=handles;
tomwalters@0 389 plotstr=sprintf('%s(usermodule,options,%d,myaxes2)',display_function,current_frame_number);
tomwalters@0 390 eval(plotstr);
tomwalters@0 391 end
tomwalters@0 392 end
tomwalters@0 393
tomwalters@0 394 % now do the axes 3 and 4 (the two profiles)
tomwalters@0 395 if current_plot>1 && withtime
tomwalters@0 396 % axes(myaxes2);
tomwalters@0 397 set(myaxes2,'XTick',[]);
tomwalters@0 398 set(get(myaxes2,'xlabel'),'string','');
tomwalters@0 399
tomwalters@0 400 if current_plot<6
tomwalters@0 401 str.minimum_time_interval=start_time;
tomwalters@0 402 str.maximum_time_interval=start_time+duration;
tomwalters@0 403 str.is_log=0;
tomwalters@0 404 str.time_reversed=0;
tomwalters@0 405 str.time_profile_scale=-1; % decide on your own!
tomwalters@0 406 else
tomwalters@0 407 if current_plot==6
tomwalters@0 408 str=get_graphics_options(handles,handles.info.calculated_sai_module);
tomwalters@0 409 str.time_profile_scale=-1; %variable scaling
tomwalters@0 410 % TCW AIM2006 WAS:
tomwalters@0 411 %str.time_profile_scale=1; %fixed scaling
tomwalters@0 412 else
tomwalters@0 413 str=get_graphics_options(handles,handles.info.calculated_usermodule_module);
tomwalters@0 414 end
tomwalters@0 415 end
tomwalters@0 416 hand=plottemporalprofile(current_frame,str,myaxes3);
tomwalters@0 417 if current_plot<6
tomwalters@0 418 set(get(myaxes3,'xlabel'),'string','time (ms)');
tomwalters@0 419 % xlabel('time (ms)')
tomwalters@0 420 elseif getxaxis(current_frame)=='0'
tomwalters@0 421 set(get(myaxes3,'xlabel'),'string','Time-Interval, Peak-Frequency product, \ith');
tomwalters@0 422 % xlabel('Time-Interval, Peak-Frequency product, \ith') %brute force method change by Rich
tomwalters@0 423 elseif strcmp(getxaxis(current_frame),'harmonic ratio')
tomwalters@0 424 set(get(myaxes3,'xlabel'),'string','harmonic ratio');
tomwalters@0 425 % xlabel('harmonic ratio') %brute force method change by Stefan we must do something about this!!
tomwalters@0 426 else
tomwalters@0 427 set(get(myaxes3,'xlabel'),'string','time interval (ms)');
tomwalters@0 428 % xlabel('time interval (ms)')
tomwalters@0 429 end
tomwalters@0 430 title('');
tomwalters@0 431 set(gca,'XMinorTick','off');
tomwalters@0 432 if strcmp(handles.screen_modus,'paper')
tomwalters@0 433 set(hand,'Color','k');
tomwalters@0 434 set(hand,'LineWidth',1.5);
tomwalters@0 435 par=get(hand,'parent');
tomwalters@0 436 set(par,'FontSize',12);
tomwalters@0 437 xlab=get(par,'xlabel');
tomwalters@0 438 set(xlab,'FontSize',12);
tomwalters@0 439 end
tomwalters@0 440
tomwalters@0 441 else
tomwalters@0 442 set(myaxes2,'TickLength',[0.01,0.01]);
tomwalters@0 443 end
tomwalters@0 444
tomwalters@0 445 if current_plot>1 && withfre
tomwalters@0 446 set(myaxes2,'YTick',[]);
tomwalters@0 447 set(get(myaxes2,'ylabel'),'string','');
tomwalters@0 448 % ylabel('');
tomwalters@0 449 % axes(myaxes4);
tomwalters@0 450 % cla
tomwalters@0 451
tomwalters@0 452
tomwalters@0 453 if current_plot<6
tomwalters@0 454 str.minimum_time_interval=start_time;
tomwalters@0 455 str.maximum_time_interval=start_time+duration;
tomwalters@0 456 str.frequency_profile_scale=-1; % decide on your own according to momentan state
tomwalters@0 457 else
tomwalters@0 458 str.frequency_profile_scale=1; % fixed scaling
tomwalters@0 459
tomwalters@0 460 end
tomwalters@0 461
tomwalters@0 462 if getxaxis(current_frame)=='0'
tomwalters@0 463 hand=plotfrequencyprofile(current_frame,str,myaxes4);
tomwalters@0 464 set(get(myaxes4,'xlabel'),'string','Mellin variable c');
tomwalters@0 465 % set(get(myaxes4,'xlabel'),'string','Mellin variable, \it{c/2\pi');
tomwalters@0 466 % xlabel('Mellin variable, \it{c/2\pi}'); %brute force change by Rich
tomwalters@0 467 str.shrink_range=-1;
tomwalters@0 468 elseif strcmp(getxaxis(current_frame),'harmonic ratio')
tomwalters@0 469 str.frequency_profile_scale=-1;
tomwalters@0 470 hand=plotfrequencyprofile(current_frame,str,myaxes4);
tomwalters@0 471 set(get(myaxes4,'xlabel'),'string','scale variable');
tomwalters@0 472 % xlabel('scale variable'); %
tomwalters@0 473 else
tomwalters@0 474 % str.shrink_range=1/0.85;
tomwalters@0 475 str.shrink_range=1;
tomwalters@0 476 hand=plotfrequencyprofile(current_frame,str,myaxes4);
tomwalters@0 477 set(get(myaxes4,'xlabel'),'string','Frequency (kHz)');
tomwalters@0 478 % xlabel('Frequency (kHz)');
tomwalters@0 479 end
tomwalters@0 480 if strcmp(handles.screen_modus,'paper')
tomwalters@0 481 set(hand,'Color','k');
tomwalters@0 482 set(hand,'LineWidth',1.5);
tomwalters@0 483 par=get(hand,'parent');
tomwalters@0 484 set(par,'FontSize',12);
tomwalters@0 485 xlab=get(par,'xlabel');
tomwalters@0 486 set(xlab,'FontSize',12);
tomwalters@0 487 % set(get(hand,
tomwalters@0 488 end
tomwalters@0 489
tomwalters@0 490 else
tomwalters@0 491 set(myaxes2,'TickLength',[0.01,0.01]);
tomwalters@0 492 end
tomwalters@0 493
tomwalters@0 494 if isfield(handles.info,'domovie') % no more actions!
tomwalters@0 495 return
tomwalters@0 496 end
tomwalters@0 497
tomwalters@0 498
tomwalters@0 499 % handles potential other windows
tomwalters@0 500 if isfield(handles.info,'children') && ~isfield(handles.info,'iscallfromchild') && current_plot <7
tomwalters@0 501 % first check, whether the child is still there:
tomwalters@0 502 if ~ishandle(handles.info.children.single_channel.windowhandle)
tomwalters@0 503 rmfield(handles.info,'children');
tomwalters@0 504 return
tomwalters@0 505 end
tomwalters@0 506 channr=single_channel_gui('getchannelnumber');
tomwalters@0 507 handles.info.children.single_channel.channelnumber=channr;
tomwalters@0 508 single_channel_gui(handles);
tomwalters@0 509
tomwalters@0 510 end
tomwalters@0 511
tomwalters@0 512
tomwalters@0 513
tomwalters@0 514
tomwalters@0 515 function str=get_graphics_options(handles,module_name)
tomwalters@0 516 % returns the graphic options, if they exist
tomwalters@0 517
tomwalters@0 518 str=[];
tomwalters@0 519 if isfield(handles.all_options.graphics,module_name)
tomwalters@0 520 str=getfield(handles.all_options.graphics,module_name);
tomwalters@0 521 else
tomwalters@0 522 % disp(sprintf('graphics part for module %s not found. Check version',module_name));
tomwalters@0 523 switch handles.info.current_plot
tomwalters@0 524 case {1,2,3,4,5}
tomwalters@0 525 opstr.is_log=0;
tomwalters@0 526 opstr.time_reversed=0;
tomwalters@0 527 opstr.plotstyle='waterfall';
tomwalters@0 528 opstr.plotcolor='k';
tomwalters@0 529 opstr.display_time=0;
tomwalters@0 530 case {6}
tomwalters@0 531 opstr.is_log=1;
tomwalters@0 532 opstr.time_reversed=1;
tomwalters@0 533 opstr.plotstyle='waterfall';
tomwalters@0 534 opstr.plotcolor='k';
tomwalters@0 535 opstr.minimum_time=0.001;
tomwalters@0 536 opstr.maximum_time=0.032;
tomwalters@0 537 opstr.display_time=0;
tomwalters@0 538 end
tomwalters@0 539 end
tomwalters@0 540
tomwalters@0 541
tomwalters@0 542 function plot_single_channel_strobes(current_frame,options,handles,str,strobes,current_scale,duration)
tomwalters@0 543 start_time=str.minimum_time_interval;
tomwalters@0 544 stop_time=str.maximum_time_interval;
tomwalters@0 545
tomwalters@0 546 nr_channels=length(options.display_single_channel);
tomwalters@0 547
tomwalters@0 548 count=0;
tomwalters@0 549 for channr=options.display_single_channel
tomwalters@0 550 count=count+1;
tomwalters@0 551 sig=getsinglechannel(current_frame,channr);
tomwalters@0 552 sigpart=getpart(sig,start_time,stop_time);
tomwalters@0 553 ymin=0;ymax=max(current_frame)*1.2;
tomwalters@0 554 if strcmp(handles.screen_modus,'paper')
tomwalters@0 555 % hand=plot(sigpart,[getminimumtime(sigpart),getminimumtime(sigpart)+getlength(sigpart)]);
tomwalters@0 556 hand=plot(sig,[start_time stop_time]);
tomwalters@0 557 set(hand,'Color','k');
tomwalters@0 558 set(hand,'LineWidth',1.5);
tomwalters@0 559 ylabel('NAP amplitude');
tomwalters@0 560 par=get(hand,'parent');
tomwalters@0 561 set(par,'FontSize',12);
tomwalters@0 562 xlab=get(par,'xlabel');
tomwalters@0 563 set(xlab,'FontSize',12);
tomwalters@0 564 set(gca,'Ytick',[]);
tomwalters@0 565 set(gca,'YAxisLocation','right');
tomwalters@0 566 else
tomwalters@0 567 switch count
tomwalters@0 568 case 1
tomwalters@0 569 color='b';
tomwalters@0 570 case 2
tomwalters@0 571 color='m';
tomwalters@0 572 end
tomwalters@0 573 plot(sigpart,[getminimumtime(sigpart),getminimumtime(sigpart)+getlength(sigpart)],color);
tomwalters@0 574 end
tomwalters@0 575 hold on
tomwalters@0 576
tomwalters@0 577 athres=handles.data.thresholds;%*current_scale/getallmaxvalue(current_frame);
tomwalters@0 578 thres=getsinglechannel(athres,channr);
tomwalters@0 579 thres=getpart(thres,start_time,stop_time);
tomwalters@0 580 hand=plot(thres,[start_time stop_time 0 max(current_frame)/current_scale],'g');
tomwalters@0 581 if strcmp(handles.screen_modus,'paper')
tomwalters@0 582 set(hand,'Color','k');
tomwalters@0 583 set(hand,'LineWidth',1.5);
tomwalters@0 584 par=get(hand,'parent');
tomwalters@0 585 set(par,'FontSize',12);
tomwalters@0 586 xlab=get(par,'xlabel');
tomwalters@0 587 ylabel('NAP amplitude');
tomwalters@0 588 set(xlab,'FontSize',12);
tomwalters@0 589 else
tomwalters@0 590 xlabel('time (ms)');ylabel('amplitude');title('');set(gca,'YAxisLocation','right');
tomwalters@0 591 end
tomwalters@0 592 herestrobes=strobes{channr};
tomwalters@0 593 nr_here=length(herestrobes.strobes);
tomwalters@0 594 for j=1:nr_here
tomwalters@0 595 time=herestrobes.strobes(j);
tomwalters@0 596 if time>start_time & time<start_time+duration
tomwalters@0 597 val=herestrobes.strobe_vals(j);%*current_scale/max(current_frame);
tomwalters@0 598 if strcmp(handles.screen_modus,'paper')
tomwalters@0 599 p=plot(time2bin(thres,time),val,'Marker','o','MarkerSize',8,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',1);
tomwalters@0 600 else
tomwalters@0 601 %plot(time2bin(thres,time),val,'.r');
tomwalters@0 602 plot(time.*1000, val, 'r.');
tomwalters@0 603 end
tomwalters@0 604 end
tomwalters@0 605 end
tomwalters@0 606 set(gca,'Ylim',[ymin,ymax]);
tomwalters@0 607 end