This is a static copy of a profile report

Home

flagRFI_pos (1 call, 24.778 sec)
Generated 05-Aug-2011 13:00:39 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/flagRFI_pos.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
rfiWrapperfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
102
refracCorr = (ARep.*cosd(satEl...
113.542 s54.7%
143
satFlag = max(acosd( ...
15.848 s23.6%
112
[junk, moonAz, moonEl] = calcS...
10.951 s3.8%
116
moonRefracCorr = (A.*cosd(moon...
10.940 s3.8%
113
[junk, sunAz, sunEl] = calcSou...
10.929 s3.7%
All other lines  2.569 s10.4%
Totals  24.778 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
calcSourceDistfunction21.880 s7.6%
repmatfunction110.612 s2.5%
spaceanglefunction20.557 s2.2%
interp1function20.306 s1.2%
Self time (built-ins, overhead, etc.)  21.423 s86.5%
Totals  24.778 s100% 
Code Analyzer results
Line numberMessage
112The value assigned here to 'junk' appears to be unused. Consider replacing it by ~.
113The value assigned here to 'junk' appears to be unused. Consider replacing it by ~.
Coverage results
[ Show coverage for parent directory ]
Total lines in function155
Non-code lines (comments, blank lines)100
Code lines (lines that can run)55
Code lines that did run46
Code lines that did not run9
Coverage (did run/can run)83.64 %
Function listing
   time   calls  line
1 function [horzFlag satFlag sunFlag moonFlag] = flagRFI_pos(d, Antenna)
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % function [flagShort flagLong sunFlag moonFlag] = flagRFI_pos(d, Antenna)
4 %
5 % March 17, 2011 (MAS) - Flags data based upon positional proximity to
6 % known sources of RFI.
7 %
8 % March 31, 2011 (MAS) - Also, the Sun and Moon because they mess with my
9 % RFI tests.
10 %
11 % April 15, 2011 (MAS) - Committed.
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15
16 %%%%%%%%%%%%%%
17 % Parameters:
18 %%%%%%%%%%%%%%
19
20 % Horizon positions:
1 21 horzAzN = [168.5 318];
1 22 horzAzS = [];
23
24 % Horizon radii:
1 25 horzRadN = [40 40];
1 26 horzRadS = [];
27
28 % Satellite positions:
1 29 satAzN = [110.5 119 138.5 146 157.5 170 176.5 183 186.5 190 199.5 202.5 205.5 208];
1 30 satAzS = [];
31
32 % Satellite radii:
1 33 satRadN = 6;
1 34 satRadS = 6;
35
36 % Sun and moon radii:
1 37 moonRad = 7;
1 38 sunRad = 9;
39
40
41 % Observatory latitudes:
1 42 obsLatN = 37.2333;
1 43 obsLatS = -30.83;
44
45
46 %%%%%%%%%%%%%%%%%%%%%%%%%%
47 % Begin the calculations!
48 %%%%%%%%%%%%%%%%%%%%%%%%%%
49
50
51 % Get azimuth and elevation:
1 52 az = d.antenna0.servo.apparent(:,1);
0.01 1 53 el = d.antenna0.servo.apparent(:,2);
54
55 % Get its length.
1 56 dLength = length(az);
57
58
59 % North
1 60 if Antenna == 1
1 61 horzAz = horzAzN;
1 62 horzRad = horzRadN;
1 63 satAz = satAzN;
1 64 satRad = satRadN;
1 65 obsLat = obsLatN;
66
67 % South
68 elseif Antenna == 2
69 horzAz = horzAzS;
70 horzRad = horzRadS;
71 satAz = satAzS;
72 satRad = satRadS;
73 obsLat = obsLatS;
74
75 % Invalid choice
76 else
77 return;
78 end
79
80 % How many horizon positions?
1 81 nHorz = length(horzAz);
82 % How many satellites?
1 83 nSat = length(satAz);
84
85
86
87 % Calculate the geosynchronous elevations.
1 88 satPhi = asind(sqrt(sind(obsLat)^2./(1-sind(satAz).^2*cosd(obsLat)^2)));
1 89 satEl = acosd(sind(satPhi) ./ sqrt(1 + 0.178^2 - 2 * 0.178 * cosd(satPhi)));
90
91
92 % Correct for refraction the satellite elevations.
1 93 Avals = d.antenna0.tracker.refraction(:,1)*pi/180;
1 94 Bvals = d.antenna0.tracker.refraction(:,2)*pi/180;
0.15 1 95 A = interp1(d.array.frame.utc, Avals, d.antenna0.receiver.utc);
0.15 1 96 B = interp1(d.array.frame.utc, Bvals, d.antenna0.receiver.utc);
97
98
0.08 1 99 satElRep = repmat(satEl,dLength,1);
0.07 1 100 ARep = repmat(A,1,nSat);
0.07 1 101 BRep = repmat(B,1,nSat);
13.54 1 102 refracCorr = (ARep.*cosd(satElRep).*(sind(satElRep)).^3 + ...
103 BRep.*sind(satElRep).*(cosd(satElRep)).^3 ) ./ ...
104 ((sind(satElRep)).^4 + ARep.*(sind(satElRep)).^2 + ...
105 3*BRep.*(cosd(satElRep)).^2) * 180 / pi;
106
0.07 1 107 satElCorr = satElRep + refracCorr;
108
109
110 % Calculate the positions of the Sun and Moon. Should take into account
111 % parallax, but haven't, yet.
0.95 1 112 [junk, moonAz, moonEl] = calcSourceDist(d, 'moon');
0.93 1 113 [junk, sunAz, sunEl] = calcSourceDist(d, 'sun');
1 114 clear junk;
115
0.94 1 116 moonRefracCorr = (A.*cosd(moonEl).*(sind(moonEl)).^3 + ...
117 B.*sind(moonEl).*(cosd(moonEl)).^3 ) ./ ...
118 ((sind(moonEl)).^4 + A.*(sind(moonEl)).^2 + ...
119 3*B.*(cosd(moonEl)).^2) * 180 / pi;
120
0.01 1 121 moonElCorr = moonEl + moonRefracCorr;
122
123
0.90 1 124 sunRefracCorr = (A.*cosd(sunEl).*(sind(sunEl)).^3 + ...
125 B.*sind(sunEl).*(cosd(sunEl)).^3 ) ./ ...
126 ((sind(sunEl)).^4 + A.*(sind(sunEl)).^2 + ...
127 3*B.*(cosd(sunEl)).^2) * 180 / pi;
128
1 129 sunElCorr = sunEl + sunRefracCorr;
130
131
132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
133 % OK, now do the calc:
134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
135
136 % First the horizon flagging. This isn't quite correct...
0.47 1 137 horzFlag = max(acosd( ...
138 cosd(repmat(el,1,nHorz)) .* ...
139 cosd(repmat(horzAz,dLength,1) - repmat(az,1,nHorz))) < ...
140 repmat(horzRad,dLength,1),[],2);
141
142 % Next the satellite flagging.
5.85 1 143 satFlag = max(acosd( ...
144 sind(repmat(el,1,nSat)) .* sind(satElCorr) + ...
145 cosd(repmat(el,1,nSat)) .* cosd(satElCorr) .* ...
146 cosd(repmat(satAz,dLength,1) - repmat(az,1,nSat))) ...
147 < satRad,[],2);
148
149 % Now the Sun and Moon!
0.27 1 150 moonFlag = (spaceangle(moonAz, moonElCorr, az, el, 'deg') < moonRad);
0.28 1 151 sunFlag = (spaceangle(sunAz, sunElCorr, az, el, 'deg') < sunRad);
152
153
154
1 155 end