annotate aim-mat/tools/AIsurface.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 % tool
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
tomwalters@0 7 %
bleeck@3 8 % (c) 2011, University of Southampton
bleeck@3 9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 10 % download of current version is on the soundsoftware site:
bleeck@3 11 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 12 % documentation and everything is on http://www.acousticscale.org
bleeck@3 13
tomwalters@0 14
tomwalters@0 15 function AIsurface(framestruct_a);
tomwalters@0 16 % plots the current frame (cframe)
tomwalters@0 17 % all relevant data must be in the frame-object
tomwalters@0 18
tomwalters@0 19 % framestruct.current_frame = current_frame;
tomwalters@0 20 % framestruct.scale_summe = scale_summe;
tomwalters@0 21 % framestruct.maximum_time_interval = maximum_time_interval; in ms!!!!
tomwalters@0 22 % framestruct.minimum_time_interval= minimum_time_interval;in ms!!!!
tomwalters@0 23 % framestruct.is_log='log' or 'linear';
tomwalters@0 24
tomwalters@0 25 if ~isstruct(framestruct_a)
tomwalters@0 26 % error('AIsum must be called with a structure');
tomwalters@0 27 framestruct.current_frame=framestruct_a;
tomwalters@0 28 else
tomwalters@0 29 framestruct=framestruct_a;
tomwalters@0 30 end
tomwalters@0 31
tomwalters@0 32 if ~isfield(framestruct,'show_time');
tomwalters@0 33 show_time=1;
tomwalters@0 34 else
tomwalters@0 35 show_time=framestruct.show_time;
tomwalters@0 36 end
tomwalters@0 37
tomwalters@0 38 if ~isfield(framestruct,'minimum_time_interval');
tomwalters@0 39 minimum_time_interval=1;
tomwalters@0 40 else
tomwalters@0 41 minimum_time_interval=framestruct.minimum_time_interval;
tomwalters@0 42 end
tomwalters@0 43
tomwalters@0 44 if ~isfield(framestruct,'maximum_time_interval');
tomwalters@0 45 maximum_time_interval=35;
tomwalters@0 46 else
tomwalters@0 47 maximum_time_interval=framestruct.maximum_time_interval;
tomwalters@0 48 end
tomwalters@0 49
tomwalters@0 50 if ~isfield(framestruct,'is_log');
tomwalters@0 51 is_log=1;
tomwalters@0 52 else
tomwalters@0 53 is_log=framestruct.is_log;;
tomwalters@0 54 end
tomwalters@0 55 current_frame=framestruct.current_frame;
tomwalters@0 56
tomwalters@0 57 srate=getsr(current_frame);
tomwalters@0 58 if is_log
tomwalters@0 59
tomwalters@0 60 t=minimum_time_interval;
tomwalters@0 61 ti=[t 2*t 4*t 8*t 16*t 32*t 64*t];
tomwalters@0 62 tix=(ti)/1000*srate; % there shell be the tix
tomwalters@0 63
tomwalters@0 64 ti=(ti);
tomwalters@0 65 ti=round(ti*100)/100;
tomwalters@0 66
tomwalters@0 67
tomwalters@0 68 min_x_screen=minimum_time_interval/1000*srate; % thats the first point we want to see on the screen
tomwalters@0 69 max_x_screen=maximum_time_interval/1000*srate; % thats the first point we want to see on the screen
tomwalters@0 70
tomwalters@0 71 else % its not logarithmic!
tomwalters@0 72 nr_labels=8;
tomwalters@0 73 xbis=getnrpoints(summe);
tomwalters@0 74 tix=0:xbis/nr_labels:xbis;
tomwalters@0 75 xstep=(maximum_time_interval-minimum_time_interval)*1000/nr_labels; %works from -35 to 5
tomwalters@0 76 xstep=round(xstep);
tomwalters@0 77 ti=([minimum_time_interval*1000:xstep:maximum_time_interval*1000]);
tomwalters@0 78 ti=round(ti*10)/10;
tomwalters@0 79
tomwalters@0 80 min_x_screen=0;
tomwalters@0 81 max_x_screen=maximum_time_interval/1000*srate; % thats the first point we want to see on the screen
tomwalters@0 82
tomwalters@0 83 end
tomwalters@0 84 % start plotting:
tomwalters@0 85 clf;
tomwalters@0 86 vals=getvalues(current_frame);
tomwalters@0 87 rvals=vals(:,end:-1:1);
tomwalters@0 88
tomwalters@0 89 h=surf(rvals,'LineStyle','none');
tomwalters@0 90 view([0 90]);
tomwalters@0 91 shading interp
tomwalters@0 92 % set the position of the axis so that it looks nice
tomwalters@0 93 set(gca,'Position',[0 0.06 0.92 0.96]);
tomwalters@0 94 set(gca,'YAxisLocation','right');
tomwalters@0 95
tomwalters@0 96 nr_channels=getnrchannels(current_frame);
tomwalters@0 97 axis([ min_x_screen max_x_screen 1 nr_channels ]);
tomwalters@0 98
tomwalters@0 99 % axis([min_x_screen max_x_screen 0 scale_summe]);
tomwalters@0 100
tomwalters@0 101 set(gca,'XDir','reverse') % turn them around, because the higher values shell end on the right
tomwalters@0 102 if is_log
tomwalters@0 103 set(gca,'XScale','log')
tomwalters@0 104 end
tomwalters@0 105 set(gca,'XTick',tix);
tomwalters@0 106 set(gca,'XTickLabel',ti);
tomwalters@0 107 set(gca,'YTickLabel',[]);
tomwalters@0 108 if is_log
tomwalters@0 109 text(min_x_screen*1.9,-200/5,'time interval (ms)'); % this is at a nice position
tomwalters@0 110 else
tomwalters@0 111 text(120,-200/5,'time interval (ms)'); % this is at a nice position
tomwalters@0 112 end
tomwalters@0 113
tomwalters@0 114 % make y-Ticks
tomwalters@0 115 nr_labels=8;
tomwalters@0 116 ystep=(nr_channels-1)/(nr_labels-1);
tomwalters@0 117 tiy=1:ystep:nr_channels;
tomwalters@0 118 cfs=getcf(current_frame);
tomwalters@0 119 ti=cfs(floor(tiy))/1000;
tomwalters@0 120 ti=round(ti*10)/10;
tomwalters@0 121 set(gca,'YTick',tiy);
tomwalters@0 122 set(gca,'YTickLabel',ti);
tomwalters@0 123
tomwalters@0 124 text(30,-2,'time interval (ms)'); % this is at a nice position