This is a static copy of a profile reportHome
packd (20 calls, 82.074 sec)
Generated 05-Aug-2011 13:00:30 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/plotting/packd.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 |
1117 | genfigRms(dcal, [], [], txt, [... | 1 | 22.483 s | 27.4% |  |
1015 | genfigLoad(dcal, [], txt, [], ... | 1 | 8.351 s | 10.2% |  |
577 | genfig(dcal, fflag, x, txt, []... | 1 | 6.154 s | 7.5% |  |
640 | genfig(dcal, fflag, x, txt, []... | 1 | 5.727 s | 7.0% |  |
452 | genfig(dcal, fflag, x, txt, []... | 1 | 4.656 s | 5.7% |  |
All other lines | | | 34.703 s | 42.3% |  |
Totals | | | 82.074 s | 100% | |
Children (called functions)
Code Analyzer results
Line number | Message |
53 | Use && instead of & as the AND operator in (scalar) conditional statements. |
55 | Use && instead of & as the AND operator in (scalar) conditional statements. |
67 | EXIST with two input arguments is generally faster and clearer than with one input argument. |
91 | The value assigned to variable 'ind' might be unused. |
94 | The value assigned to variable 'ind' might be unused. |
97 | The value assigned to variable 'ind' might be unused. |
100 | The value assigned to variable 'ind' might be unused. |
100 | Use TRUE or FALSE instead of LOGICAL(1) or LOGICAL(0). |
123 | Use && instead of & as the AND operator in (scalar) conditional statements. |
123 | Use && instead of & as the AND operator in (scalar) conditional statements. |
124 | Use && instead of & as the AND operator in (scalar) conditional statements. |
124 | Use && instead of & as the AND operator in (scalar) conditional statements. |
125 | Use && instead of & as the AND operator in (scalar) conditional statements. |
125 | Use && instead of & as the AND operator in (scalar) conditional statements. |
144 | The value assigned to variable 'h' might be unused. |
200 | The value assigned to variable 'h' might be unused. |
230 | The value assigned to variable 'h' might be unused. |
375 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
376 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
377 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
378 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
385 | The value assigned to variable 'newflag' might be unused. |
389 | The value assigned to variable 'newflag' might be unused. |
391 | The value assigned to variable 'newflag' might be unused. |
398 | The variable 'flags' appears to change size on every loop iteration. Consider preallocating for speed. |
431 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
433 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
435 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
445 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
446 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
447 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
458 | The value assigned to variable 'newflag' might be unused. |
465 | The variable 'flags' appears to change size on every loop iteration. Consider preallocating for speed. |
496 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
498 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
500 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
510 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
511 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
512 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
523 | The value assigned to variable 'newflag' might be unused. |
530 | The variable 'flags' appears to change size on every loop iteration. Consider preallocating for speed. |
556 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
558 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
560 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
570 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
571 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
572 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
578 | The value assigned to variable 'theseFlags' might be unused. |
581 | The value assigned to variable 'theseFlags' might be unused. |
612 | The value assigned here to 'aa' appears to be unused. Consider replacing it by ~. |
612 | The value assigned here to 'bb' appears to be unused. Consider replacing it by ~. |
620 | The value assigned to variable 'thisSetAll' might be unused. |
631 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
632 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
633 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
634 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
635 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
641 | The value assigned to variable 'theseFlags' might be unused. |
644 | The value assigned to variable 'theseFlags' might be unused. |
667 | The value assigned to variable 'dataLength' might be unused. |
676 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
677 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
678 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
678 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
679 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
679 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
680 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
680 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
681 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
681 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
682 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
682 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
683 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
683 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
693 | The value assigned here to 'theseFlags' appears to be unused. Consider replacing it by ~. |
721 | The variable 'aa' appears to change size on every loop iteration. Consider preallocating for speed. |
737 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
738 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
747 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
748 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
749 | The variable 'fflag' appears to change size on every loop iteration. Consider preallocating for speed. |
752 | The variable 'x' appears to change size on every loop iteration. Consider preallocating for speed. |
763 | The value assigned to variable 'newflag' might be unused. |
770 | The variable 'flags' appears to change size on every loop iteration. Consider preallocating for speed. |
811 | The value assigned to variable 'newflags' might be unused. |
855 | The value assigned to variable 'newFlag' might be unused. |
894 | The value assigned to variable 'newFlags' might be unused. |
931 | The value assigned to variable 'newflag' might be unused. |
1027 | Assignment to 'dcal' might be unnecessary. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 1129 |
Non-code lines (comments, blank lines) | 386 |
Code lines (lines that can run) | 743 |
Code lines that did run | 531 |
Code lines that did not run | 212 |
Coverage (did run/can run) | 71.47 % |
Function listing
time calls line
1 function [dcal, flag]=packd(dcal,flag,caltype,type,plotparams, str, field, dcal0)
2 % packd(dcal,dopt,caltype,type,plotparams,str, field, dcal0, stageNum)
3 %
4 % dcal - modified data structure
5 % flag - the flag structure to be set witha different color
6 % caltype - type of calibrator data to plot [NOT USED YET]
7 % 'int' - intensity calibrator
8 % 'pol' - polarization calibrator
9 % 'both' - both
10 % 'none' - plot does not rely on a specific calibrator
11 % type - type of application used
12 % 'az_el' - az and el of antenna
13 % 'cold_load'- cold load
14 % 'rx_temp' - receiver temps
15 % 'wx' - weather data
16 % 'cone_temp'- cone temperature
17 % 'plot_sources' - plot sources
18 % 'intent' - plots what was done in the track (features)
19 % 'deglitch' - deglitching flagging
20 % 'positional' - positional flagging
21 % 'rfi' - rfi flagging
22 % 'alpha' - alpha correction flagging
23 % 'tsys' - system temperature flagging
24 % 'gain' - gain of the system
25 % 'tau' - opacity plotting
26 % 'rfactor' - r_factor calibration
27 % 'astro' - astronomical conversion to Jy
28 % 'mainsSwitch' - mains hum removal off switched data
29 % 'mainsReg' - mains hum removal off regular data
30 % 'load_cal' - cold load calibration
31 % 'power_spec' - power spectrum plots
32 % 'rms' - rms plots
33 % str - optional gtitle string (give title to matrix plot)
34 % only available for use in:
35 %
36 % field - field looked at. needed for getmaindir.m
37 % plotparams - parameters for plottign/saving
38 % dcal0 - priordata set with no correction (for load_cal)
39 %
40
41 % the plot will be dependant on the type you choose.
42 %
43 % Stephen Muchovej
44 % 28/10/2010 - ACT added gen=3 flag so removal of spurious data
45 % can be done without having to see the plots
46 %
47 % 07/01/2011 - MAS removed the stageNum parameter for purposes of two-stage
48 % RFI flagging.
49 % 29/03/2011 - SJCM: removed gen==3, modified things so you can save plots
50 % without plotting them up.
51
52 % if not interactive, we need to call a separate function
20 53 if(plotparams.interactive==0 & plotparams.save==0)
54 gen = 2;
20 55 elseif(plotparams.interactive==0 & plotparams.save==1)
20 56 gen = 1;
57 else
58 gen = 0;
59 end
60
0.01 20 61 if(plotparams.plot==1)
62 printhelp;
63 end
64
65
66
20 67 if(~exist('field'))
68 field = [];
69 end
70
71 % SJCM: FIRST THING WE DO IS PUT FLAG IN THE PROPER DIMENSIONS SO WE DON'T
72 % HAVE TO CHANGE ANYTHING ELSE.
0.01 20 73 if(~isempty(flag))
74 % if flags are empty, we're replotting things
8 75 if(isstruct(flag))
76 % if it's not a structure, we're doing tsys/tau/noise/gains flagging
4 77 if(size(flag.old.bit.fast,2) == 3)
1.11 4 78 flag.old = convertFlagToDataSize(flag.old, size(dcal.antenna0.receiver.data,2));
1.13 4 79 flag.new = convertFlagToDataSize(flag.new, size(dcal.antenna0.receiver.data,2));
4 80 end
4 81 end
8 82 end
83
84
85
86
0.03 20 87 mon = getmonth;
88
20 89 switch caltype
20 90 case 'int'
91 ind = dcal.index.calibrator.fast;
92
20 93 case 'pol'
94 ind = dcal.index.calibrator.fast;
95
20 96 case 'both'
97 ind = dcal.index.calibrator.fast;
98
20 99 case 'none'
0.19 20 100 ind = logical(ones(size(dcal.index.calibrator.fast)));
101
102 otherwise
103 error('Invalid ''caltype'' argument')
104 end
105
106
107 % convert time to hour
20 108 start = mjd2date_v2(dcal.array.frame.utc(1));
0.01 20 109 start.month = mon{start.month};
20 110 j2hour = 24;
20 111 dcalt = dcal.array.frame.utc*j2hour;
20 112 dcaltslow = dcalt-dcalt(1);
113
0.07 20 114 dcaltfast = dcal.antenna0.receiver.utc*j2hour;
0.03 20 115 dcaltfast = dcaltfast - dcaltfast(1);
116
117 % split it up into half hour chunks
0.13 20 118 numChunks = ceil(max(dcaltfast)/0.5);
119
120 % no swapping
20 121 p.swap = 0;
122 % check for flag field
20 123 if (~isfield(dcal, 'flags') & ~strcmp(type,'az_el') & ...
124 ~strcmp(type,'cold_load') & ~strcmp(type,'rx_temp') & ~strcmp(type, ...
20 125 'plot_sources') & ~strcmp(type, 'wx') & ~strcmp(type, 'cone_temp') )
126 disp('flags not found');
127 disp('Please use flagData')
128 return;
129 end
130
20 131 switch type
132 %---------------------------------------------%
20 133 case 'az_el'
0.04 1 134 clf
1 135 disp(' ')
1 136 disp('Plotting Az and El of calibrator')
1 137 disp(' ')
0.05 1 138 pause(1)
1 139 az = dcal.antenna0.servo.az;
1 140 el = dcal.antenna0.servo.el;
141
0.04 1 142 subplot(2,1,1)
0.01 1 143 hold on
0.07 1 144 h = plot(dcaltfast,az);
0.01 1 145 xlabel('Time [hr]')
0.01 1 146 ylabel('Az [deg]')
1 147 subplot(2,1,2)
0.01 1 148 hold on
0.03 1 149 plot(dcaltfast,el)
1 150 xlabel('Time [hr]')
1 151 ylabel('El [deg]')
152
1 153 str=sprintf('Az/El of Antenna \n%02u-%s-%u:%02u:%02u:%4.2f', ...
154 start.day, start.month, start.year, start.hour, ...
155 start.minute, start.second);
1 156 gtitle(str);
1 157 if (gen==1)
1 158 maindir=getmaindir(dcal, field);
1 159 dbclear if error
1 160 set(gcf,'paperposition',[0 0 6.0 6.0])
1.13 1 161 eval(sprintf('print -dpng -r200 %s/intro/fig1.png;', ...
162 maindir));
1 163 dbstop if error
1 164 end
1 165 hold off
0.02 1 166 pause(1)
167
168 %---------------------------------------------%
0.01 19 169 case 'plot_sources'
1 170 clf
1 171 disp(' ')
1 172 disp('Plotting Sources');
1 173 disp(' ')
174
1.66 1 175 plot_sources(dcal, 1);
176
1 177 str=sprintf('Sources observed \n%02u-%s-%u:%02u:%02u:%4.2f', ...
178 start.day, start.month, start.year, start.hour, ...
179 start.minute, start.second);
1 180 gtitle(str);
1 181 if (gen==1)
1 182 maindir=getmaindir(dcal, field);
1 183 dbclear if error
1 184 set(gcf,'paperposition',[0 0 6.0 6.0])
2.31 1 185 eval(sprintf('print -dpng -r200 %s/intro/fig6.png;', ...
186 maindir));
1 187 dbstop if error
1 188 end
1 189 hold off
190
191 %---------------------------------------------%
18 192 case 'cold_load'
1 193 clf
1 194 disp(' ')
1 195 disp('Plotting Temperature of Cold Load');
1 196 disp(' ')
0.01 1 197 pause(1)
1 198 temp = dcal.antenna0.thermal.coldLoad;
199
0.03 1 200 h = plot(dcaltfast,temp);
1 201 xlabel('Time [hr]')
0.01 1 202 ylabel('Load Temperature [K]')
1 203 str=sprintf('Temperature Cold Load \n%02u-%s-%u:%02u:%02u:%4.2f', ...
204 start.day, start.month, start.year, start.hour, ...
205 start.minute, start.second);
1 206 gtitle(str);
1 207 if (gen==1)
1 208 maindir=getmaindir(dcal, field);
1 209 dbclear if error
1 210 set(gcf,'paperposition',[0 0 6.0 6.0])
0.34 1 211 eval(sprintf('print -dpng -r200 %s/intro/fig2.png;', ...
212 maindir));
1 213 dbstop if error
1 214 end
1 215 hold off
1 216 pause(1)
217
218 %---------------------------------------------%
17 219 case 'rx_temp'
0.01 1 220 clf
1 221 disp(' ')
1 222 disp('Plotting Temperature inside Cryostat');
1 223 disp(' ')
0.01 1 224 pause(1)
1 225 tempStage1 = dcal.antenna0.thermal.lsTemperatureSensors(:,1:6);
1 226 tempStage2 = dcal.antenna0.thermal.lsTemperatureSensors(:,7);
227
1 228 hold on
1 229 subplot(2,1,1);
0.05 1 230 h = plot(dcaltslow,tempStage1);
1 231 xlabel('Time [hr]')
1 232 ylabel('Receiver Temperature [K]')
0.01 1 233 title('Stage 1');
234
1 235 subplot(2,1,2)
1 236 hold on
1 237 plot(dcaltslow, tempStage2)
1 238 xlabel('Time [hr]')
0.01 1 239 ylabel('Receiver Temperature [K]')
1 240 title('Stage 2');
1 241 str=sprintf('RX Temperature \n%02u-%s-%u:%02u:%02u:%4.2f', ...
242 start.day, start.month, start.year, start.hour, ...
243 start.minute, start.second);
1 244 gtitle(str);
1 245 if (gen==1)
1 246 maindir=getmaindir(dcal, field);
1 247 dbclear if error
1 248 set(gcf,'paperposition',[0 0 6.0 6.0])
0.30 1 249 eval(sprintf('print -dpng -r200 %s/intro/fig3.png;', ...
250 maindir));
1 251 dbstop if error
1 252 end
1 253 hold off
0.02 1 254 pause(1)
255
256
257 %---------------------------------------------%
16 258 case 'cone_temp'
0.01 1 259 clf
1 260 disp(' ')
1 261 disp('Plotting Electronics box and Cone temperatures');
1 262 disp(' ')
0.03 1 263 pause(1)
1 264 tempPol = dcal.antenna0.thermal.dlpTemperatureSensors(:,1:2);
1 265 tempCone = dcal.antenna0.thermal.dlpTemperatureSensors(:,3:4);
1 266 tempEbox = dcal.antenna0.thermal.dlpTemperatureSensors(:,5:7);
267
1 268 hold on
1 269 subplot(3,1,1);
0.01 1 270 plot(dcaltslow,tempPol);
1 271 xlabel('Time [hr]')
1 272 ylabel('Temperature [C]')
0.49 1 273 legend('Polarimeter Amplifier Plate', 'Noise Diode');
0.05 1 274 title('Polarimeter Temps');
275
0.01 1 276 subplot(3,1,2)
1 277 hold on
1 278 plot(dcaltslow, tempCone);
1 279 xlabel('Time [hr]')
0.01 1 280 ylabel('Temperature [C]')
0.07 1 281 legend('Top of Cryo', 'LNA PSU');
0.05 1 282 title('Cone Temperatures');
283
0.01 1 284 subplot(3,1,3)
1 285 hold on
1 286 plot(dcaltslow, tempEbox);
1 287 xlabel('Time [hr]')
1 288 ylabel('Temperature [C]')
0.09 1 289 legend('CBASSDAQ', 'Metal Casing', 'Air');
0.05 1 290 title('E-box Temperatures');
291
1 292 str=sprintf('Cone and Ebox Temperature \n%02u-%s-%u:%02u:%02u:%4.2f', ...
293 start.day, start.month, start.year, start.hour, ...
294 start.minute, start.second);
0.01 1 295 gtitle(str);
1 296 if (gen==1)
1 297 maindir=getmaindir(dcal, field);
1 298 dbclear if error
1 299 set(gcf,'paperposition',[0 0 6.0 6.0])
0.71 1 300 eval(sprintf('print -dpng -r200 %s/intro/fig4.png;', ...
301 maindir));
1 302 dbstop if error
1 303 end
1 304 hold off
0.01 1 305 pause(1)
306
307 %---------------------------------------------%
15 308 case 'wx'
0.02 1 309 clf
1 310 disp(' ')
1 311 disp('Plotting Weather Station Data');
1 312 disp(' ')
0.02 1 313 pause(1)
314
1 315 hold on
0.01 1 316 subplot(3,1,1);
0.01 1 317 plot(dcaltslow, dcal.array.weather.airTemperature);
1 318 xlabel('Time [hr]')
1 319 ylabel('Temperature [C]')
1 320 title('Ambient Temperature');
321
0.01 1 322 subplot(3,1,2)
1 323 hold on
1 324 plot(dcaltslow, dcal.array.weather.relativeHumidity);
1 325 xlabel('Time [hr]')
1 326 ylabel('PerCent')
1 327 title('Relative Humidity');
328
0.01 1 329 subplot(3,1,3)
1 330 hold on
1 331 plot(dcaltslow, dcal.array.weather.windSpeed);
1 332 xlabel('Time [hr]')
1 333 ylabel('speed [m/s]');
0.01 1 334 title('Wind Speed');
335
1 336 str=sprintf('Weather Data \n%02u-%s-%u:%02u:%02u:%4.2f', ...
337 start.day, start.month, start.year, start.hour, ...
338 start.minute, start.second);
0.01 1 339 gtitle(str);
1 340 if (gen==1)
1 341 maindir=getmaindir(dcal, field);
1 342 dbclear if error
1 343 set(gcf,'paperposition',[0 0 6.0 6.0])
0.26 1 344 eval(sprintf('print -dpng -r200 %s/intro/fig5.png;', ...
345 maindir));
1 346 dbstop if error
1 347 end
1 348 hold off
0.04 1 349 pause(1)
350
351 %---------------------------------------------%
14 352 case 'deglitch'
353
354 % initialize plot axis names
1 355 txt{1}={'Channel'};
1 356 txt{2}={'time [hr]'};
1 357 txt{3}={'Backend Unit'};
1 358 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
359 start.month, start.year, start.hour, start.minute, start.second);
1 360 txt{4}={str};
361 % antenna display
1 362 p.style='flag';
1 363 p.featflag=0;
364
365 % we need to break up the data into half hour sections.
1 366 if(isempty(flag))
367 flag = convertFlagToDataSize(dcal.flags, size(dcal.antenna0.receiver.data,2));
368 end
1 369 for m=1:numChunks
4 370 if(m==numChunks)
0.01 1 371 ind = dcaltfast>=((m-1)*0.5);
3 372 else
0.01 3 373 ind = dcaltfast>=((m-1)*0.5) & dcaltfast<( (m)*0.5);
3 374 end
0.01 4 375 x{1,m} = dcaltfast(ind);
0.05 4 376 x{2,m} = dcal.antenna0.receiver.data(ind,:);
0.01 4 377 fflag{1,m} = flag.new.bit.fast(ind,:);
0.03 4 378 fflag{2,m} = flag.old.bit.fast(ind,:);
4 379 end
380
381 % plot the data
1 382 if(gen==1)
4.08 1 383 genfig(dcal, fflag, x, txt, [], 'deglitch', p, field, 1);
1 384 theseFlags = fflag;
1 385 newflag = [];
386 elseif(gen==2)
387 genfig(dcal, fflag, x, txt, [], 'deglitch', p, field, 0);
388 theseFlags = fflag;
389 newflag = [];
390 else
391 [theseFlags newflag] = plotd(dcal, fflag, x, txt, [],p);
392 % update the flags
393 end
394
395 % next we set the flags
1 396 flags = [];
1 397 for m=1:size(theseFlags,2)
0.07 4 398 flags = [flags; theseFlags{1,m}];
4 399 end
400 % if we do it this way, we also have to put in the old flags too.
0.04 1 401 outFlags = convertDataFlagsToFlagSize(flags);
1 402 flag.new.out = outFlags;
403 %dcal.flags.bit.fast = bitor(dcal.flags.bit.fast, resizedFlags);
404 %dcal.flags.fast = dcal.flags.bit.fast>0;
405
406 %---------------------------------------------%
13 407 case 'positional'
408
409 % initialize plot axis names
1 410 txt{1}={'Channel'};
1 411 txt{2}={'time [hr]'};
1 412 txt{3}={'Backend Unit'};
1 413 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
414 start.month, start.year, start.hour, start.minute, start.second);
1 415 txt{4}={str};
416 % antenna display
1 417 p.style='flag';
1 418 p.featflag=0;
419
420 % we need to break up the data into half hour sections.
1 421 if(isempty(flag))
422 flag = convertFlagToDataSize(dcal.flags, ...
423 size(dcal.antenna0.receiver.data,2));
424 end
1 425 for m=1:numChunks
4 426 if(m==numChunks)
1 427 ind = dcaltfast>=((m-1)*0.5);
3 428 else
0.02 3 429 ind = dcaltfast>=((m-1)*0.5) & dcaltfast<( (m)*0.5);
3 430 end
0.02 4 431 x{1,m} = dcaltfast(ind);
4 432 if(isfield(dcal.antenna0.receiver, 'dataT'))
433 x{2,m} = dcal.antenna0.receiver.dataT(ind,:);
4 434 else
0.03 4 435 x{2,m} = dcal.antenna0.receiver.data(ind,:);
4 436 end
437
438
439 % we need the corresponding indices.
4 440 fa = fieldnames(dcal.index);
4 441 for mm=1:length(fa)
0.17 48 442 eval(sprintf('indices.%s = dcal.index.%s.fast(ind);', fa{mm}, ...
443 fa{mm}));
48 444 end
4 445 x{3,m} = indices;
0.01 4 446 fflag{1,m} = flag.new.bit.fast(ind,:);
0.04 4 447 fflag{2,m} = flag.old.bit.fast(ind,:);
4 448 end
449
450 % plot the data
1 451 if(gen==1)
4.66 1 452 genfig(dcal, fflag, x, txt, [], 'positional', p, field, 1);
1 453 theseFlags = fflag;
454 elseif(gen==2)
455 genfig(dcal, fflag, x, txt, [], 'positional', p, field, 0);
456 theseFlags = fflag;
457 else
458 [theseFlags newflag] = plotd(dcal, fflag, x, txt, [],p);
459 % update the flags
460 end
461
462 % next we set the flags
1 463 flags = [];
1 464 for m=1:size(theseFlags,2)
0.11 4 465 flags = [flags; theseFlags{1,m}];
4 466 end
467 % if we do it this way, we also have to put in the old flags too.
0.23 1 468 outFlags = convertDataFlagsToFlagSize(flags);
1 469 flag.new.out = outFlags;
470
471 %---------------------------------------------%
12 472 case 'rfi'
473
474 % initialize plot axis names
1 475 txt{1}={'Channel'};
1 476 txt{2}={'time [hr]'};
1 477 txt{3}={'Backend Unit'};
1 478 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
479 start.month, start.year, start.hour, start.minute, start.second);
1 480 txt{4}={str};
481 % antenna display
1 482 p.style='flag';
1 483 p.featflag=0;
484
485 % we need to break up the data into half hour sections.
1 486 if(isempty(flag))
487 flag = convertFlagToDataSize(dcal.flags, ...
488 size(dcal.antenna0.receiver.data,2));
489 end
1 490 for m=1:numChunks
4 491 if(m==numChunks)
0.01 1 492 ind = dcaltfast>=((m-1)*0.5);
3 493 else
0.02 3 494 ind = dcaltfast>=((m-1)*0.5) & dcaltfast<( (m)*0.5);
3 495 end
4 496 x{1,m} = dcaltfast(ind);
4 497 if(isfield(dcal.antenna0.receiver, 'dataT'))
498 x{2,m} = dcal.antenna0.receiver.dataT(ind,:);
4 499 else
0.07 4 500 x{2,m} = dcal.antenna0.receiver.data(ind,:);
4 501 end
502
503
504 % we need the corresponding indices.
4 505 fa = fieldnames(dcal.index);
4 506 for mm=1:length(fa)
0.13 48 507 eval(sprintf('indices.%s = dcal.index.%s.fast(ind);', fa{mm}, ...
508 fa{mm}));
48 509 end
0.01 4 510 x{3,m} = indices;
0.02 4 511 fflag{1,m} = flag.new.bit.fast(ind,:);
0.01 4 512 fflag{2,m} = flag.old.bit.fast(ind,:);
4 513 end
514
515 % plot the data
1 516 if(gen==1)
4.63 1 517 genfig(dcal, fflag, x, txt, [], 'rfi', p, field, 1);
1 518 theseFlags = fflag;
519 elseif(gen==2)
520 genfig(dcal, fflag, x, txt, [], 'rfi', p, field, 0);
521 theseFlags = fflag;
522 else
523 [theseFlags newflag] = plotd(dcal, fflag, x, txt, [],p);
524 % update the flags
525 end
526
527 % next we set the flags
1 528 flags = [];
1 529 for m=1:size(theseFlags,2)
0.11 4 530 flags = [flags; theseFlags{1,m}];
4 531 end
532 % if we do it this way, we also have to put in the old flags too.
0.23 1 533 outFlags = convertDataFlagsToFlagSize(flags);
1 534 flag.new.out = outFlags;
535
536 %---------------------------------------------%
11 537 case 'intent'
538 % initialize plot axis names
1 539 txt{1}={'Channel'};
1 540 txt{2}={'time [hr]'};
1 541 txt{3}={'Backend Unit'};
1 542 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
543 start.month, start.year, start.hour, start.minute, start.second);
1 544 txt{4}={str};
545 % antenna display
1 546 p.style='feature';
1 547 p.featflag=0;
1 548 p.type = 'feature';
549
1 550 for m=1:numChunks
4 551 if(m==numChunks)
0.01 1 552 ind = dcaltfast>=((m-1)*0.5);
3 553 else
0.01 3 554 ind = dcaltfast>=((m-1)*0.5) & dcaltfast<( (m)*0.5);
3 555 end
0.01 4 556 x{1,m} = dcaltfast(ind);
4 557 if(isfield(dcal.antenna0.receiver, 'dataT'))
558 x{2,m} = dcal.antenna0.receiver.dataT(ind,:);
0.01 4 559 else
0.05 4 560 x{2,m} = dcal.antenna0.receiver.data(ind,:);
4 561 end
562
563
564 % we need the corresponding indices.
4 565 fa = fieldnames(dcal.index);
4 566 for mm=1:length(fa)
0.13 48 567 eval(sprintf('indices.%s = dcal.index.%s.fast(ind);', fa{mm}, ...
568 fa{mm}));
48 569 end
4 570 x{3,m} = indices;
4 571 fflag{1,m} = zeros(size(x{2,m}));
4 572 fflag{2,m} = zeros(size(x{2,m}));
4 573 end
574
575 % plot the data
1 576 if(gen==1)
6.15 1 577 genfig(dcal, fflag, x, txt, [], 'intent', p, field, 1);
1 578 theseFlags = fflag;
579 elseif(gen==2)
580 genfig(dcal, fflag, x, txt, [], 'intent', p, field, 0);
581 theseFlags = fflag;
582 else
583 plotdnoflag(dcal, fflag, x, txt, [],p);
584 end
585
586 %---------------------------------------------%
10 587 case 'summary'
588 % initialize plot axis names
1 589 txt{1}={'Channel'};
1 590 txt{2}={'time [hr]'};
1 591 txt{3}={'Jy-ish'};
1 592 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
593 start.month, start.year, start.hour, start.minute, start.second);
1 594 txt{4}={str};
595 % antenna display
1 596 p.style='feature';
1 597 p.featflag=0;
1 598 p.type = 'allflags';
599
600 % ignore the mean Q,U channels
1 601 if(size(dcal.antenna0.receiver.data,2)==10)
1 602 plotIndices = [1 3 4 5 6 9];
603 elseif(size(dcal.antenna0.receiver.data,2)==8)
604 plotIndices = [1 2 3 4 5 8];
605 end
606
607 % get our flag indices in a parseable form
1 608 fa = getFlagNames();
1 609 prevSet = zeros(size(dcal.flags.fast));
1 610 for mm=1:length(fa)
0.47 17 611 thisIndex = uint32(zeros(size(dcal.flags.fast)));
17 612 [aa bb bitNum] = setNewFlag([],[],fa{mm});
0.05 17 613 thisIndex = bitset(thisIndex, bitNum);
0.33 17 614 isSet = bitand(thisIndex, dcal.flags.bit.fast) >0;
615
0.47 17 616 thisSet = isSet - prevSet > 0;
617
618 % make them the right size:
17 619 numDims = size(dcal.antenna0.receiver.data,2);
0.69 17 620 thisSetAll = convertFlagToDataSize(thisSet, numDims);
621
0.12 17 622 eval(sprintf('bitflags.%s = thisSetAll(:,plotIndices);', fa{mm}));
17 623 end
624
1 625 for m=1:numChunks
4 626 if(m==numChunks)
1 627 ind = dcaltfast>=((m-1)*0.5);
3 628 else
0.03 3 629 ind = dcaltfast>=((m-1)*0.5) & dcaltfast<( (m)*0.5);
3 630 end
0.01 4 631 x{1,m} = dcaltfast(ind);
0.05 4 632 x{2,m} = dcal.antenna0.receiver.data(ind,plotIndices);
0.34 4 633 x{3,m} = structcut(bitflags, ind);
4 634 fflag{1,m} = zeros(size(x{2,m}));
4 635 fflag{2,m} = zeros(size(x{2,m}));
4 636 end
637
638 % plot the data
1 639 if(gen==1)
5.73 1 640 genfig(dcal, fflag, x, txt, [], 'summary', p, field, 1);
1 641 theseFlags = fflag;
642 elseif(gen==2)
643 genfig(dcal, fflag, x, txt, [], 'summary', p, field, 0);
644 theseFlags = fflag;
645 else
646 plotdnoflag(dcal, fflag, x, txt, [],p);
647 end
648
649 %---------------------------------------------%
9 650 case 'alpha'
651 % ONLY PLOT FOR OLD SCHEME.
652
653 % initialize plot axis names
1 654 txt{1}={'Noise Event'};
1 655 txt{2}={'time [hr]'};
1 656 txt{3}={'Backend Unit'};
1 657 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
658 start.month, start.year, start.hour, start.minute, start.second);
1 659 txt{4}={str};
660 % antenna display
1 661 p.style='flag';
1 662 p.featflag=0;
663
664 % in this case we only care about the noise diode events
665 % Noise diode off and on:
1 666 ind_noise_event = dcal.index.noise_event.fast;
1 667 dataLength = length(ind_noise_event);
668
669 % noise diode event start/stop
1 670 si = dcal.correction.alpha.indices(:,1);
1 671 ei = dcal.correction.alpha.indices(:,3);
1 672 numEvents = length(si);
673
0.01 1 674 for m=1:numEvents
675 % we know the indices of the noise diode events
24 676 x{1,m} = dcaltfast(si(m):ei(m));
0.01 24 677 x{1,numEvents+m} = dcaltfast(si(m):ei(m));
24 678 x{2,m} = dcal.antenna0.receiver.data(si(m):ei(m),[1:2]);
24 679 x{2,numEvents+m} = dcal.antenna0.receiver.data(si(m):ei(m),[9:10]);
24 680 fflag{1,m} = flag.new.bit.fast(si(m):ei(m),[1:2]);
24 681 fflag{1,numEvents+m} = flag.new.bit.fast(si(m):ei(m),[9:10]);
24 682 fflag{2,m} = flag.old.bit.fast(si(m):ei(m),[1:2]);
24 683 fflag{2,numEvents+m} = flag.old.bit.fast(si(m):ei(m),[9:10]);
24 684 end
685 % plot the data
1 686 if(gen==1)
2.59 1 687 genfigAlpha(dcal, fflag, x, txt, [], 'alpha', p, field,1);
1 688 finalFlags = zeros(size(fflag));
689 elseif(gen==2)
690 genfigAlpha(dcal, fflag, x, txt, [], 'alpha', p, field,0);
691 finalFlags = zeros(size(fflag));
692 else
693 [theseFlags, finalFlags] = plot_alpha(dcal, fflag, x, txt, [],p);
694 % update the flags
695 end
696
697 % next we set the flags
1 698 ff = find(finalFlags);
1 699 for m=1:length(ff)
700 flag.new.bit.fast(si(ff(m)):ei(ff(m)),:) = 1;
701 end
0.48 1 702 outFlags = convertDataFlagsToFlagSize(flag.new.bit.fast);
1 703 flag.new.out = outFlags;
704
705 %---------------------------------------------%
0.01 8 706 case 'rfactor'
707
708 % initialize plot axis names
709 txt{1}={'Channel'};
710 txt{2}={'time [hr]'};
711 txt{3}={'Backend Unit (?) '};
712 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
713 start.month, start.year, start.hour, start.minute, start.second);
714 txt{4}={str};
715 % antenna display
716 p.style='flag';
717 p.featflag=0;
718
719 % calculate the second thing to plot
720 for m=1:6
721 aa(:,m) = 0.5*sum(dcal.antenna0.receiver.switchData(:,[(m-1)*4+2 (m-1)*4+3]) - dcal.antenna0.receiver.switchData(:,[(m-1)*4+1 (m)*4]), 2);
722 end
723
724 % ignore the mean Q,U channels
725 if(size(dcal.antenna0.receiver.data,2)==10)
726 plotIndices = [1 3 4 5 6 9];
727 elseif(size(dcal.antenna0.receiver.data,2)==8)
728 plotIndices = [1 2 3 4 5 8];
729 end
730
731 for m=1:numChunks
732 if(m==numChunks)
733 ind = dcaltfast>=((m-1)*0.5);
734 else
735 ind = dcaltfast>=((m-1)*0.5) & dcaltfast<( (m)*0.5);
736 end
737 x{1,m} = dcaltfast(ind);
738 x{2,m} = dcal.antenna0.receiver.data(ind,plotIndices );
739
740
741 % we need the corresponding indices.
742 fa = fieldnames(dcal.index);
743 for mm=1:length(fa)
744 eval(sprintf('indices.%s = dcal.index.%s.fast(ind);', fa{mm}, ...
745 fa{mm}));
746 end
747 x{3,m} = indices;
748 fflag{1,m} = flag.new.bit.fast(ind,plotIndices);
749 fflag{2,m} = flag.old.bit.fast(ind,plotIndices);
750
751 % next thing to overplot
752 x{4,m} = aa(ind,:);
753 end
754
755 % plot the data
756 if(gen==1)
757 genfig(dcal, fflag, x, txt, [], 'rfactor', p, field,1);
758 theseFlags = fflag;
759 elseif(gen==2)
760 genfig(dcal, fflag, x, txt, [], 'rfactor', p, field,0);
761 theseFlags = fflag;
762 else
763 [theseFlags newflag] = plotd(dcal, fflag, x, txt, [],p);
764 % update the flags
765 end
766
767 % next we set the flags
768 flags = [];
769 for m=1:size(theseFlags,2)
770 flags = [flags; theseFlags{1,m}];
771 end
772 % if we do it this way, we also have to put in the old flags too.
773 outFlags = convertDataFlagsToFlagSize(flags);
774 flag.new.out = outFlags;
775
776 %---------------------------------------------%
8 777 case 'tau'
778
779 % initialize plot axis names
1 780 txt{1}={'Intensity Channel'};
0.01 1 781 txt{2}={'time [hr]'};
1 782 txt{3}={'Tau '};
1 783 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
784 start.month, start.year, start.hour, start.minute, start.second);
1 785 txt{4}={str};
786 % antenna display
1 787 p.style='flag';
1 788 p.featflag=0;
789
1 790 if(isempty(flag))
791 flag = zeros(size(dcal.correction.tau.values,1),2);
792 end
793
794 % this should be a super simple plot -- we should just have each plot be
795 % of the tau values for each intensity channel, and we can flag as
796 % normal
1 797 time = (dcal.correction.tau.values(:,1) - dcal.antenna0.receiver.utc(1))*j2hour;
1 798 x{1,1} = time;
1 799 x{2,1} = dcal.correction.tau.values(:,4:5);
1 800 fflag{1,1} = flag(:,1:2);
1 801 fflag{2,1} = zeros(size(flag));
802
803 % plot the data
1 804 if(gen==1)
0.28 1 805 genfig(dcal, fflag, x, txt, [], 'tau', p, field,1);
1 806 theseFlags = fflag;
807 elseif(gen==2)
808 genfig(dcal, fflag, x, txt, [], 'tau', p, field,0);
809 theseFlags = fflag;
810 else
811 [theseFlags newflags] = plotd(dcal, fflag, x, txt, [],p);
812 % update the flags
813 end
1 814 flag = theseFlags{1};
815
816 %---------------------------------------------%
0.01 7 817 case 'tsys'
818
819 % initialize plot axis names
1 820 txt{1}={'Intensity Channel'};
0.01 1 821 txt{2}={'time [hr]'};
1 822 txt{3}={'System Temperature '};
1 823 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
824 start.month, start.year, start.hour, start.minute, start.second);
1 825 txt{4}={str};
1 826 txt{5}= {'From Alpha Corrections', 'From Observations'};
827 % antenna display
1 828 p.style='flag';
1 829 p.featflag=0;
830
1 831 if(isempty(flag))
832 flag = zeros(size(dcal.correction.tsys.flag));
833 end
834
835 % this should be a super simple plot -- we should just have each plot be
836 % of the tau values for each intensity channel, and we can flag as
837 % normal
1 838 time1 = (dcal.correction.tsys.time(:) - dcal.correction.tsys.time(1))*j2hour;
1 839 x{1,1} = time1;
1 840 x{2,1} = dcal.correction.tsys.val;
1 841 fflag{1,1} = flag(:,1:2);
1 842 fflag{2,1} = zeros(size(flag));
1 843 time2 = (dcal.correction.tsys.time2 - dcal.correction.tsys.time(1))*j2hour;
1 844 x{3,1} = time2;
1 845 x{4,1} = dcal.correction.tsys.val2;
846
847 % plot the data
1 848 if(gen==1)
0.56 1 849 genfig(dcal, fflag, x, txt, [], 'tsys', p, field,1);
1 850 theseFlags = fflag;
851 elseif(gen==2)
852 genfig(dcal, fflag, x, txt, [], 'tsys', p, field,0);
853 theseFlags = fflag;
854 else
855 [theseFlags newFlag] = plotd(dcal, fflag, x, txt, [],p);
856 end
1 857 flag = theseFlags{1};
858
859 %---------------------------------------------%
0.01 6 860 case 'noise'
861
862 % initialize plot axis names
1 863 txt{1}={'Intensity Channel'};
1 864 txt{2}={'time [hr]'};
1 865 txt{3}={'Noise Diode Temperature '};
1 866 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
867 start.month, start.year, start.hour, start.minute, start.second);
1 868 txt{4}={str};
869 % antenna display
1 870 p.style='flag';
1 871 p.featflag=0;
872
1 873 if(isempty(flag))
874 flag = zeros(size(dcal.correction.tsys.flag));
875 end
876
877 % this should be a super simple plot -- we should just have each plot be
878 % of the tau values for each intensity channel, and we can flag as
879 % normal
1 880 time1 = (dcal.correction.tsys.time(:) - dcal.correction.tsys.time(1))*j2hour;
1 881 x{1,1} = time1;
1 882 x{2,1} = dcal.correction.tsys.tnoise;
1 883 fflag{1,1} = flag(:,1:2);
1 884 fflag{2,1} = zeros(size(flag));
885
886 % plot the data
1 887 if(gen==1)
0.33 1 888 genfig(dcal, fflag, x, txt, [], 'noise', p, field,1);
1 889 theseFlags = fflag;
890 elseif(gen==2)
891 genfig(dcal, fflag, x, txt, [], 'noise', p, field,0);
892 theseFlags = fflag;
893 else
894 [theseFlags newFlags] = plotd(dcal, fflag, x, txt, [],p);
895 end
896
897 % update the flags
1 898 flag(theseFlags{1}>0) = 1;
899
900 %---------------------------------------------%
5 901 case 'gain'
902
903 % initialize plot axis names
0.01 1 904 txt{1}={'Intensity Channel'};
1 905 txt{2}={'time [hr]'};
1 906 txt{3}={'System Gain [dB]'};
1 907 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
908 start.month, start.year, start.hour, start.minute, start.second);
1 909 txt{4}={str};
910 % antenna display
1 911 p.style='flag';
1 912 p.featflag=0;
913
914 % this should be a super simple plot -- we should just have each plot be
915 % of the tau values for each intensity channel, and we can flag as
916 % normal
1 917 time1 = (dcal.correction.gain.time(:) - dcal.correction.gain.time(1))*j2hour;
1 918 x{1,1} = time1;
1 919 x{2,1} = dcal.correction.gain.val;
1 920 fflag{1,1} = flag(:,1:2);
0.01 1 921 fflag{2,1} = zeros(size(flag));
922
923 % plot the data
1 924 if(gen==1)
0.33 1 925 genfig(dcal, fflag, x, txt, [], 'gain', p, field, 1);
1 926 theseFlags = fflag;
927 elseif(gen==2)
928 genfig(dcal, fflag, x, txt, [], 'gain', p, field, 0);
929 theseFlags = fflag;
930 else
931 [theseFlags newflag] = plotd(dcal, fflag, x, txt, [],p);
932 end
933
934 % update the flags
1 935 flag(theseFlags{1}>0) = 1;
936
937 %---------------------------------------------%
4 938 case {'mainsSwitch'}
939
940 % initialize plot axis names
0.01 1 941 txt{1}={'Phase Switch State'};
1 942 txt{2}={'Frequency (Hz)'};
1 943 txt{3}={'Amplitude'};
1 944 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
945 start.month, start.year, start.hour, start.minute, start.second);
1 946 txt{4}={str};
947 % antenna display
1 948 p.style='flag';
1 949 p.featflag=0;
950
951 % there should be 6 pages of 4 plots
952 % each page should have the 4 phase switch states for that channel
953 % there should just be stuff plotted on top of each other in each plot
954 % plot the data
955 % let's only plot the blanking data
0.22 1 956 dcalcut = cutObs(dcal, 'blank', 'only');
0.20 1 957 dcal0cut = cutObs(dcal0, 'blank', 'only');
1 958 if(gen==1)
1.44 1 959 genfigLoad(dcalcut, [], txt, [], p, dcal0cut, 'mains', field, 1, 1);
960 elseif(gen==2)
961 genfigLoad(dcalcut, [], txt, [], p, dcal0cut, 'mains', field, 1, 0);
962 else
963 plotLoad(dcalcut, [], [], txt, [], p, dcal0cut, 1);
964 end
965
966
967
968 %---------------------------------------------%
3 969 case {'mainsReg'}
970
971 % initialize plot axis names
972 txt{1}={'Channel Number'};
973 txt{2}={'Frequency (Hz)'};
974 txt{3}={'Amplitude'};
975 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
976 start.month, start.year, start.hour, start.minute, start.second);
977 txt{4}={str};
978 % antenna display
979 p.style='flag';
980 p.featflag=0;
981
982 % there should be 1 page with 6 plots
983 % one for reach channel
984 % plot the data
985 if(gen==1)
986 genfigMainsReg(dcal, txt, [], 'mains', field,1);
987 elseif(gen==2)
988 genfigMainsReg(dcal, txt, [], 'mains', field,0);
989 else
990 thisData = plotMainsReg(dcal, [], [], txt, [], p);
991 end
992
993
994 % replace the current data
995 dcal.antenna0.receiver.data = thisData;
996
997 %---------------------------------------------%
3 998 case 'load_cal'
999
1000 % initialize plot axis names
1 1001 txt{1}={'Channel Number'};
0.01 1 1002 txt{2}={'Frequency (Hz)'};
1 1003 txt{3}={'Amplitude'};
1 1004 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
1005 start.month, start.year, start.hour, start.minute, start.second);
1 1006 txt{4}={str};
1007 % antenna display
1 1008 p.style='flag';
1 1009 p.featflag=0;
1010
1011 % there should be 1 page with 6 plots
1012 % one for reach channel
1013 % plot the data
1 1014 if(gen==1)
8.35 1 1015 genfigLoad(dcal, [], txt, [], p, dcal0, 'load', field, 0, 1);
1016 elseif(gen==2)
1017 genfigLoad(dcal, [], txt, [], p, dcal0, 'load', field, 0, 0);
1018 else
1019 plotLoad(dcal, [], [], txt, [], p, dcal0, 0);
1020 end
1021
1022 % check the result from the flagging if it worked.
1 1023 query = 1;
1024 %
1025 %display('Did it work?');
1 1026 if(query)
1 1027 dcal = dcal;
1028 else
1029 dcal = dcal0;
1030 end
1031
1032 %---------------------------------------------%
2 1033 case 'power_spec'
1034
1035 % initialize plot axis names
1 1036 txt{1}={'Channel Number'};
1 1037 txt{2}={'Frequency (Hz)'};
1 1038 txt{3}={'Amplitude'};
1 1039 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
1040 start.month, start.year, start.hour, start.minute, start.second);
1 1041 txt{4}={str};
1042 % antenna display
1 1043 p.style='flag';
1 1044 p.featflag=0;
1045
1046 % there should be 1 page with 6 plots
1047 % one for reach channel
1048 % plot the data
1 1049 if(gen==1)
4.06 1 1050 genfigPowerSpec(dcal, [], txt, [], p, 'power', field,1);
1051 elseif(gen==2)
1052 genfigPowerSpec(dcal, [], txt, [], p, 'power', field,0);
1053 else
1054 plotPowerSpec(dcal, [], [], txt, [], p);
1055 end
1056
1057 %---------------------------------------------%
1 1058 case 'astro'
1059
1060 % initialize plot axis names
1061 txt{1}={'Channel Number'};
1062 txt{2}={'Frequency (Hz)'};
1063 txt{3}={'Flux (Jy)'};
1064 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
1065 start.month, start.year, start.hour, start.minute, start.second);
1066 txt{4}={str};
1067 % antenna display
1068 p.style='flag';
1069 p.featflag=0;
1070
1071 % this should be a super simple plot -- we should just have each plot be
1072 % of the tau values for each intensity channel, and we can flag as
1073 % normal
1074 time = (dcal.antenna0.receiver.utc - dcal.antenna0.receiver.utc(1))*j2hour;
1075 x{1,1} = time;
1076 x{2,1} = dcal.antenna0.receiver.jy;
1077 fflag{1,1} = flag.bit.fast(:,[1 8]);
1078
1079 % plot the data
1080 if(gen==1)
1081 genfig(dcal, fflag, x, txt, [], 'astro', p, field, 1);
1082 theseFlags = fflag;
1083 elseif(gen==2)
1084 genfig(dcal, fflag, x, txt, [], 'astro', p, field, 0);
1085 theseFlags = fflag;
1086 else
1087 theseFlags = plotd(dcal, fflag, x, txt, [],p);
1088 % update the flags
1089 end
1090
1091 % next we set the flags
1092 % reshape it for convert
1093 resizedFlags(:,1) = theseFlags{1}(:,1);
1094 resizedFlags(:,2) = bitor(theseFlags{1}(:,1), theseFlags{1}(:,2));
1095 resizedFlags(:,3) = theseFlags{1}(:,2);
1096 dcal.flags.bit.fast = bitor(dcal.flags.bit.fast, resizedFlags);
1097 dcal.flags.fast = dcal.flags.bit.fast>0;
1098
1099 %---------------------------------------------%
1 1100 case 'rms'
1101
1102 % initialize plot axis names
1 1103 txt{1}={'Channel Number'};
0.01 1 1104 txt{2}={'Integration time (s)'};
1 1105 txt{3}={'RMS'};
1 1106 str=sprintf('%s\n%02u-%s-%u:%02u:%02u:%4.2f', str, start.day, ...
1107 start.month, start.year, start.hour, start.minute, start.second);
1 1108 txt{4}={str};
1109 % antenna display
1 1110 p.style='flag';
1 1111 p.featflag=0;
1112
1113 % there should be 1 page with 6-8 plots
1114 % one for reach channel
1115 % plot the data
1 1116 if(gen==1)
22.48 1 1117 genfigRms(dcal, [], [], txt, [], p, 'rms', field,1);
1118 elseif(gen==2)
1119 genfigRms(dcal, [], [], txt, [], p, 'rms', field,0);
1120 else
1121 plotRms(dcal, [], [], txt, [], p);
1122 end
1123
1124
1125
1126 otherwise
1127 error('Invalid ''type'' argument')
1128
1129 end
Other subfunctions in this file are not included in this listing.