This is a static copy of a profile reportHome
plot_sources (1 call, 1.650 sec)
Generated 05-Aug-2011 13:00:28 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/plotting/plot_sources.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
packd | function | 1 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
31 | testData = framecut(d,test); | 2 | 0.765 s | 46.4% |  |
61 | noise = framecut(d,d.index.noi... | 1 | 0.175 s | 10.6% |  |
93 | linkaxes(ax,'x'); | 1 | 0.164 s | 9.9% |  |
49 | skydip = framecut(d,d.index.sk... | 1 | 0.164 s | 9.9% |  |
75 | legend(h,sources(1:length(sour... | 1 | 0.087 s | 5.3% |  |
All other lines | | | 0.295 s | 17.9% |  |
Totals | | | 1.650 s | 100% | |
Children (called functions)
Code Analyzer results
Line number | Message |
21 | Terminate statement with semicolon to suppress output (in functions). |
33 | The variable 'h' appears to change size on every loop iteration. Consider preallocating for speed. |
46 | Using ISEMPTY is usually faster than comparing LENGTH to 0. |
58 | Using ISEMPTY is usually faster than comparing LENGTH to 0. |
70 | The value assigned to variable 'j' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 93 |
Non-code lines (comments, blank lines) | 53 |
Code lines (lines that can run) | 40 |
Code lines that did run | 38 |
Code lines that did not run | 2 |
Coverage (did run/can run) | 95.00 % |
Function listing
time calls line
1 function [sources] = plot_sources(d,channel)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 % function [sources] = plot_sources(d,channel)
5 %
6 % Function to plot data and identify which sources have been observed
7 % Particularly useful for seeing what calibrator sources were looked at
8 %
9 % act - 16/7/2010
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13
14 % To plot the source data and name it - names of sources are stored in
15 % d.antenna0.tracker.source
16 % The associated times of these frames is in:
17 % d.antenna0.tracker.utc
18
19 %First find sources observed
20
1 21 sources = unique(d.antenna0.tracker.source)
22
0.02 1 23 ax(1) = subplot(4,1,1:2);
24
1 25 for i = 1:length(sources);
26
2 27 test = strcmp(sources(i),d.antenna0.tracker.source);
28
29 % Grab the data for this source and plot it
30
0.77 2 31 testData = framecut(d,test);
32
0.03 2 33 h(i)=plot(ax(1),testData.antenna0.receiver.utc,testData.antenna0.receiver.data(:,channel),'p');
34
0.01 2 35 hold all
2 36 clear test
0.01 2 37 clear testData;
38
2 39 end
40
41 % Now add places where there is skydips and noise cal
42 % First we see if there's any skydip data
43
1 44 j=i+1;
45
0.01 1 46 if(length(find(d.index.skydip.fast))==0)
47 display('no sky dips in your data');
1 48 else
0.16 1 49 skydip = framecut(d,d.index.skydip.fast);
1 50 h(j) = plot(ax(1),skydip.antenna0.receiver.utc,skydip.antenna0.receiver.data(:,channel),'kp');
1 51 clear skydip;
1 52 sources(j) = cellstr('skydip')';
1 53 j = j+1;
1 54 end
55
56 %Next look for noise source data
57
1 58 if(length(find(d.index.noise.fast))==0)
59 display('no noise source events in your data');
1 60 else
0.17 1 61 noise = framecut(d,d.index.noise.fast);
0.01 1 62 h(j) = plot(ax(1),noise.antenna0.receiver.utc,noise.antenna0.receiver.data(:,channel), ...
63 'mo', ...
64 'LineWidth',2,...
65 'MarkerEdgeColor','m',...
66 'MarkerFaceColor',[.49 1 .63],...
67 'MarkerSize',8);
1 68 clear noise;
1 69 sources(j) = cellstr('noise');
1 70 j = j+1;
1 71 end
72
73
74 % Update legend names
0.09 1 75 legend(h,sources(1:length(sources)) );
76 %xlabel('UTC');
0.05 1 77 ylabel('Nominal units');
0.04 1 78 title(['Channel ', num2str(channel) ,' raw data']);
79
80 % Also plot the azimuth and elevation tied to the same x -axis
81
0.02 1 82 ax(2) = subplot(4,1,3);
83
0.04 1 84 plot(ax(2),d.antenna0.receiver.utc, d.antenna0.servo.el);
1 85 ylabel('Elevation, deg');
86
0.01 1 87 ax(3) = subplot(4,1,4);
88
0.02 1 89 plot(ax(3),d.antenna0.receiver.utc, d.antenna0.servo.az);
1 90 ylabel('Azimuth, deg');
1 91 xlabel('UTC')
92
0.16 1 93 linkaxes(ax,'x');