This is a static copy of a profile reportHome
flagMask (1 call, 1.421 sec)
Generated 05-Aug-2011 13:00:47 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/flag/flagMask.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
124 | dist = calcSourceDist(d,... | 1 | 1.006 s | 70.8% |  |
102 | flagRxTemp = bitand(d.antenna0... | 1 | 0.066 s | 4.6% |  |
107 | flagRxTemp = bitand(d.antenna0... | 1 | 0.055 s | 3.8% |  |
93 | flagRxTemp = bitand(d.antenn... | 1 | 0.055 s | 3.8% |  |
89 | d = applyFlag(d, [], flagServT... | 1 | 0.022 s | 1.5% |  |
All other lines | | | 0.219 s | 15.4% |  |
Totals | | | 1.421 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
calcSourceDist | function | 1 | 1.006 s | 70.8% |  |
flagMask>applyFlag | subfunction | 14 | 0.175 s | 12.3% |  |
unique | function | 1 | 0.022 s | 1.5% |  |
rmfield | function | 1 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.219 s | 15.4% |  |
Totals | | | 1.421 s | 100% | |
Code Analyzer results
Line number | Message |
36 | The value assigned to variable 'sunLim' might be unused. |
38 | The value assigned to variable 'controlBldg' might be unused. |
47 | This statement (and possibly following ones) cannot be reached. |
144 | Use TRUE or FALSE instead of LOGICAL(1) or LOGICAL(0). |
145 | Use TRUE or FALSE instead of LOGICAL(1) or LOGICAL(0). |
146 | Use TRUE or FALSE instead of LOGICAL(1) or LOGICAL(0). |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 148 |
Non-code lines (comments, blank lines) | 96 |
Code lines (lines that can run) | 52 |
Code lines that did run | 47 |
Code lines that did not run | 5 |
Coverage (did run/can run) | 90.38 % |
Function listing
time calls line
1 function d = flagMask(d)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 % function flagMask(data)
5 %
6 % looks at the data (from output of read_arc.m)
7 % and sets specific flags for given registers:
8 %
9 % this function should be used in conjunction with flagData.m, where
10 % you choose which one of the following bits will actually make your data
11 % bad. The reason they are not the same functions is that this function
12 % will use more time (it needs to convert flag arrays of different sizes,
13 % while the other one does not)
14 %
15 % bit0 - FRAME not received from antenna
16 % bit1 - RECEIVER hot (above 20K)
17 % bit2 - not TRACKING. (antenna not tracking)
18 % bit3 - TRACKER lacking status
19 % bit4 - ELEVATION below 20 degrees
20 % bit5 - WEATHER station data not received
21 % bit6 - BACKEND wrong mode (not continuous)
22 % bit7 - BACKEND data backlog (fifo backlog greater than 10samples)
23 % bit8 - BACKEND clock not right.
24 % bit9 - BACKEND 1pps out of sync
25 % bit10- TIMING issue on Cryocon or Servo
26 % bit11- TIMING issue on Backend
27 % bit12- BACKEND saturated integration shortfall.
28 % bit13- Sun above 0 degree horizon
29 % bit14- Moon within 45 degrees
30 % bit15- CONTROL BUILDING (az between 214.5 adn 226)
31 %
32 %
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1 34 rxTempLim = 10;
1 35 elevLim = 20;
1 36 sunLim = 0;
1 37 moonLim = 45;
1 38 controlBldg = [214.5 226];
39
40
41 % first we check if the data we're getting from the backend is ok.
0.02 1 42 if(length(unique(d.antenna0.receiver.utc)) ~= ...
43 length(d.antenna0.receiver.utc))
44 display('BACKEND IN BAD STATE DURING TRACK');
45 display('ALL YOUR DATA IS BAD');
46 error('Pick a different time to analyze');
47 return;
48 end
49
50 % we need flags of many different sizes
51 % interpolating each individual flag onto the other size is much faster than
52 % writing a for-loop at the end.
53
54 % first we set up the flags
1 55 d.flags.mask.slow = zeros(size(d.array.frame.utc));
1 56 d.flags.mask.medium = zeros(size(d.antenna0.servo.utc));
1 57 d.flags.mask.fast = zeros(size(d.antenna0.receiver.utc));
58
59 %%%%% flags that are from data taken at 1Hz %%%%%
60 % frame received
1 61 flagRegTemp = double(d.antenna0.frame.received ~=2);
0.02 1 62 d = applyFlag(d, flagRegTemp, [],[],0);
63
64 % rx cold
1 65 flagRegTemp = d.antenna0.thermal.lsTemperatureSensors(:,1:6) > rxTempLim;
1 66 flagRegTemp = sum(flagRegTemp,2)>0;
0.01 1 67 d = applyFlag(d, flagRegTemp, [],[],1);
68
69 % not tracking
1 70 flagRegTemp = double(d.antenna0.tracker.offSource);
0.02 1 71 d = applyFlag(d, flagRegTemp, [],[],2);
72
73 % tracker lacking
1 74 flagRegTemp = (double(d.antenna0.tracker.lacking>0 & ...
75 d.antenna0.tracker.lacking<1025));
0.01 1 76 d = applyFlag(d, flagRegTemp, [],[],3);
77
78 %weather station
1 79 flagRegTemp = double(d.array.weather.status~=0);
0.02 1 80 d = applyFlag(d, flagRegTemp, [],[],5);
81
82 %%%%% flags at data rate of 5Hz %%%%%
83 % elevation below 20 degrees
1 84 flagServTemp = double(d.antenna0.servo.fast_el_pos < elevLim);
1 85 d = applyFlag(d, [], flagServTemp,[],4);
86
87 % cryocon or servo 1pps issue
1 88 flagServTemp = d.flags.interpFlags.medium;
0.02 1 89 d = applyFlag(d, [], flagServTemp, [], 10);
90
91 %%%%% flags at 100Hz %%%%%
92 % if set to high, backend not in continous mode
0.05 1 93 flagRxTemp = bitand(d.antenna0.receiver.flags, 2^4)==0;
0.01 1 94 d = applyFlag(d, [], [],flagRxTemp, 6);
95
96 % backend data backlog (128)
0.01 1 97 flagRxTemp = d.antenna0.receiver.diagnostics(:,1)>10;
1 98 d = applyFlag(d, [], [],flagRxTemp, 7);
99
100 % backend Clock Error (256)
101 % if it's set to high, the clock is ok.
0.07 1 102 flagRxTemp = bitand(d.antenna0.receiver.flags, 2^8)==0;
0.01 1 103 d = applyFlag(d, [], [],flagRxTemp, 8);
104
105 % backend 1PPS (512)
106 % if it's set to high, 1pps is good.
0.05 1 107 flagRxTemp = bitand(d.antenna0.receiver.flags, 2^9)==0;
0.01 1 108 d = applyFlag(d, [], [],flagRxTemp, 9);
109
110 % backend timing issue
1 111 flagRxTemp = d.flags.interpFlags.fast;
0.01 1 112 d = applyFlag(d, [], [], flagRxTemp, 11);
113
114 % backend saturated integration shortfall (4096)
0.01 1 115 flagRxTemp = d.antenna0.receiver.diagnostics(:,4) == 254;
0.01 1 116 d = applyFlag(d, [], [], flagRxTemp, 12);
117
118 % sun above horizon
119 %el = calcSunLoc(d);
120 %flagRxTemp = el > sunLim;
121 %d = applyFlag(d, [], [], flagRxTemp, 13);
122
123 % moon within 45 degrees
1.01 1 124 dist = calcSourceDist(d, 'moon');
0.01 1 125 flagRxTemp = dist > moonLim;
0.01 1 126 d = applyFlag(d, [], [], flagRxTemp, 14);
127
128 % control building within view
129 %flagServTemp = d.antenna0.servo.fast_az_pos > controlBldg(1) & ...
130 % d.antenna0.servo.fast_az_pos < controlBldg(2);
131 %d = applyFlag(d, [], flagServTemp, [], 15);
132
133
1 134 d.flags = rmfield(d.flags, 'interpFlags');
135
136
137 % now we should have a bitMask for these values.
138
139 % initialize all variables to zero
1 140 d.flags.bit.slow = uint32(zeros(size(d.flags.mask.slow)));
1 141 d.flags.bit.medium = uint32(zeros(size(d.flags.mask.medium)));
1 142 d.flags.bit.fast = uint32(zeros(length(d.flags.mask.fast), 3));
143
1 144 d.flags.slow = logical(zeros(size(d.flags.mask.slow)));
1 145 d.flags.medium = logical(zeros(size(d.flags.mask.medium)));
1 146 d.flags.fast = logical(zeros(length(d.flags.mask.fast), 3));
147
1 148 return;
Other subfunctions in this file are not included in this listing.