This is a static copy of a profile report

Home

genfigRms (1 call, 22.472 sec)
Generated 05-Aug-2011 13:01:31 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/plotting/genfigRms.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
packdfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
112
Ystd = integrateDown(Yintegrat...
117.882 s79.6%
101
Yn = notchFilter(Y);
11.126 s5.0%
102
Yn050 = notchFilter(Y,[0 0.05]...
11.115 s5.0%
103
Yn500 = notchFilter(Y,[0 0.5])...
11.104 s4.9%
57
d = cutObs(d, 'source', 'only'...
10.547 s2.4%
All other lines  0.700 s3.1%
Totals  22.472 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
integrateDownfunction117.882 s79.6%
notchFilterfunction33.345 s14.9%
cutObsfunction10.547 s2.4%
printfunction10.404 s1.8%
legendfunction10.142 s0.6%
subplotfunction40.022 s0.1%
gtitlefunction10.011 s0.0%
xlimfunction40.011 s0.0%
newplotfunction40.011 s0.0%
xlabelfunction20 s0%
ylimfunction40 s0%
ylabelfunction40 s0%
lineseriesfunction40 s0%
setwinsizefunction10 s0%
gcffunction20 s0%
getMainDirfunction10 s0%
Self time (built-ins, overhead, etc.)  0.098 s0.4%
Totals  22.472 s100% 
Code Analyzer results
Line numberMessage
1Input argument 'flags' might be unused, although a later one is used. Consider replacing it by ~.
1Input argument 'xc' might be unused, although a later one is used. Consider replacing it by ~.
1Input argument 'txt' might be unused, although a later one is used. Consider replacing it by ~.
1Input argument 'ax' might be unused, although a later one is used. Consider replacing it by ~.
1Input argument 'prop' might be unused, although a later one is used. Consider replacing it by ~.
1Extra semicolon is unnecessary.
34EXIST with two input arguments is generally faster and clearer than with one input argument.
35The value assigned to variable 'ax' might be unused.
45The value assigned to variable 'num' might be unused.
48The value assigned to variable 'plotsPerPage' might be unused.
49The value assigned to variable 'matrix' might be unused.
51The value assigned to variable 'plotoptions' might be unused.
115The value assigned to variable 'timeVal' might be unused.
Coverage results
[ Show coverage for parent directory ]
Total lines in function168
Non-code lines (comments, blank lines)82
Code lines (lines that can run)86
Code lines that did run65
Code lines that did not run21
Coverage (did run/can run)75.58 %
Function listing
   time   calls  line
1 function genfigRms(d, flags, xc, txt, ax, prop, type, field, saveplot);
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 % function genfigRms(d, flags, xc, txt, ax, prop, type, field, saveplot);
5 %
6 % d - data structure
7 % flag - flag structure
8 % xc - cell element of x and y data
9 % x{odd} - x axis data
10 % x{even} - y axis data Nx1 or Nx6 or Nx24
11 % txt - axis text
12 % txt{1} - title
13 % txt{2} - x axis
14 % txt{3} - y axis
15 % txt[4} - overall title
16 % txt{5} - legend
17 % ax - manual axis settings. [xmin xmax ymin ymax]
18 % prop - initialize properties of plotting
19 % p.style = {'flag','feature'}
20 % p.swap = swap to display plots in time.
21 % p.featmask= [bitmask for style='feature']
22 % type - 'rms'
23 % field - field to analyze
24 %
25 % Extensively modified by ogk on 16 June 2011.
26 %
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
1 29 if(nargin<9)
30 saveplot = 1;
31 end
32
33 % check for axis setting
1 34 if (~exist('ax'))
35 ax=[];
36 end
37
1 38 if(saveplot)
39 % get the directory to write to
1 40 maindir=getmaindir(d, field);
1 41 end
42
43 % num is the number of pages to be displayed.
44 % matrix is the size of each of the pages to be displayed.
1 45 num = 1;
46 %plotsPerPage = 6;
47 %matrix = [3 2];
1 48 plotsPerPage = 1;
1 49 matrix = [1 1];
50
1 51 plotoptions = {'b', 'g', 'r', 'c', 'm', 'y', 'k', ...
52 'b.', 'g.', 'r.', 'c.', 'm.', 'y.', 'k.', ...
53 'bo', 'go', 'ro', 'co', 'mo', 'yo', 'ko', ...
54 'bx', 'gx', 'rx', 'cx', 'mx', 'yx', 'kx'};
55
56 % first we cut only the on-source data
0.55 1 57 d = cutObs(d, 'source', 'only');
58
1 59 if(isempty(d.array.frame.features))
60 display('No data to display');
61 return;
62 end
63
64
65
1 66 switch (size(d.antenna0.receiver.data,2))
1 67 case 6
68 % The data to be acted on is:
69 I1 = d.antenna0.receiver.data(:,1);
70 I2 = d.antenna0.receiver.data(:,6);
71 Q = d.antenna0.receiver.data(:,2);
72 U = d.antenna0.receiver.data(:,3);
1 73 case 8
74 % The data to be acted on is:
75 I1 = d.antenna0.receiver.data(:,1);
76 I2 = d.antenna0.receiver.data(:,8);
77 Q = d.antenna0.receiver.data(:,6);
78 U = d.antenna0.receiver.data(:,7);
79
1 80 case 10
81 % The data to be acted on is:
0.01 1 82 I1 = d.antenna0.receiver.data(:,1);
1 83 I2 = d.antenna0.receiver.data(:,9);
1 84 Q = d.antenna0.receiver.data(:,7);
1 85 U = d.antenna0.receiver.data(:,8);
1 86 end
87
88 % next we flag the data
89 % diffData( sum(d.flags.fast,2)>0 ) = [];
90 % Don't flag the data: this will mess up the filtering by changing the time
91 % base.
92
93 % What we can do is limit the data to a number of samples which are a
94 % factor of 2:
1 95 Nsel = 2^(floor(log2(size(I1,1))));
96
97 % Create a matrix of data to be passed to the notchFilter routine:
0.02 1 98 Y = [I1(1:Nsel) I2(1:Nsel) Q(1:Nsel) U(1:Nsel)];
99
100 % Apply the standard notches, and some high-pass filters
1.13 1 101 Yn = notchFilter(Y);
1.11 1 102 Yn050 = notchFilter(Y,[0 0.05]);
1.10 1 103 Yn500 = notchFilter(Y,[0 0.5]);
104
105 % The data to integrate down:
0.03 1 106 Yintegrate = [Y Yn Yn050 Yn500];
1 107 if Nsel >= 4000
1 108 intLength = 1:10:2000; % number of samples to integrate down to
109 else
110 intLength = 1:10:floor(Nsel/2); % number of samples to integrate down to
111 end
17.88 1 112 Ystd = integrateDown(Yintegrate,intLength);
113
114 % corresponding times.
1 115 timeVal = intLength*0.01; % in seconds
116
117 % actual plotting
1 118 setwinsize(gcf, 750, 500);
119
1 120 tI = intLength*0.01;
1 121 ylims = [min(min(Ystd)) max(max(Ystd))];
1 122 xlims = [0 max(tI)];
123
1 124 subplot(2,2,1)
1 125 loglog(tI,Ystd(:,1),'k-',tI,Ystd(:,5),'r-',tI,1./sqrt(intLength)*Ystd(1,5),'k--',tI,Ystd(:,9),'b-',tI,Ystd(:,13),'g-')
1 126 ylabel('I1 RMS')
0.01 1 127 ylim(ylims)
1 128 xlim(xlims)
0.14 1 129 legend('Unfiltered','Notch filtered','Ideal','Notch+50mHz HPF','Notch+500mHz HPF','Location','SouthWest')
130
0.01 1 131 subplot(2,2,2)
1 132 loglog(tI,Ystd(:,2),'k-',tI,Ystd(:,6),'r-',tI,1./sqrt(intLength)*Ystd(1,6),'k--',tI,Ystd(:,10),'b-',tI,Ystd(:,14),'g-')
1 133 ylabel('I2 RMS')
1 134 ylim(ylims)
1 135 xlim(xlims)
136
0.01 1 137 subplot(2,2,3)
1 138 loglog(tI,Ystd(:,3),'k-',tI,Ystd(:,7),'r-',tI,1./sqrt(intLength)*Ystd(1,7),'k--',tI,Ystd(:,11),'b-',tI,Ystd(:,15),'g-')
1 139 xlabel('Integration time [s]')
1 140 ylim(ylims)
1 141 ylabel('Q RMS')
0.01 1 142 xlim(xlims)
143
1 144 subplot(2,2,4)
0.01 1 145 loglog(tI,Ystd(:,4),'k-',tI,Ystd(:,8),'r-',tI,1./sqrt(intLength)*Ystd(1,8),'k--',tI,Ystd(:,12),'b-',tI,Ystd(:,16),'g-')
1 146 xlabel('Integration time [s]')
1 147 xlim(xlims)
1 148 ylim(ylims)
1 149 ylabel('U RMS')
150
151
0.01 1 152 gtitle('RMS Plot');
153
154
1 155 pageNum=1;
1 156 if(saveplot)
1 157 dbclear if error
1 158 set(gcf,'paperposition',[0 0 6.0 6.0])
0.40 1 159 eval(sprintf('print -dpng -r200 %s/%s/fig%d.png;', ...
160 maindir,type,pageNum));
1 161 dbstop if error
162 else
163 pause(1);
164 end
165
166
167
1 168 return;