0001 function genfigLoad(d, xc, txt, ax, prop, d0, type, field, isMains, saveplot)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 if(nargin<10)
0030 saveplot = 1;
0031 end
0032
0033
0034
0035 if (~exist('ax','var'))
0036 ax=[];
0037 end
0038
0039 if(saveplot)
0040
0041 maindir=getMainDir(d, field);
0042 end
0043
0044
0045
0046 switch(size(d0.antenna0.receiver.data,2))
0047 case 6
0048 vectorsToPlot = 1:6;
0049 plotlabel = {'T1', 'Q1', 'U1', 'Q2', 'U2', 'T2'};
0050
0051 case 8
0052 vectorsToPlot = [1 2 3 4 5 8];
0053 plotlabel = {'T1', 'Q1', 'U1', 'Q2', 'U2', 'T2'};
0054
0055 case 10
0056 vectorsToPlot = [1 2 7 8 9 10];
0057 plotlabel = {'Tsky1', 'Tload1', 'Q3', 'U3', 'Tsky2', 'Tload2'};
0058 end
0059
0060
0061
0062 num = 1;
0063 if(isMains)
0064 setwinsize(gcf, 1200, 900);
0065 plotsPerPage = 24;
0066 matrix = [6 4];
0067 if(isfield(d0.antenna0.receiver, 'switchDataT'))
0068 data0 = d0.antenna0.receiver.switchDataT;
0069 data1 = d.antenna0.receiver.switchDataT;
0070 else
0071 data0 = d0.antenna0.receiver.switchData;
0072 data1 = d.antenna0.receiver.switchData;
0073 end
0074 else
0075 setwinsize(gcf, 1000, 750);
0076 plotsPerPage = 6;
0077 matrix = [3 2];
0078 if(isfield(d0.antenna0.receiver, 'dataT'))
0079 data0 = d0.antenna0.receiver.dataT;
0080 data1 = d.antenna0.receiver.dataT;
0081 else
0082 data0 = d0.antenna0.receiver.data(:,vectorsToPlot);
0083 data1 = d.antenna0.receiver.data(:,vectorsToPlot);
0084 end
0085 end
0086
0087 plotoptions = {'b', 'g', 'r', 'c', 'm', 'y', 'k', ...
0088 'b.', 'g.', 'r.', 'c.', 'm.', 'y.', 'k.', ...
0089 'bo', 'go', 'ro', 'co', 'mo', 'yo', 'ko', ...
0090 'bx', 'gx', 'rx', 'cx', 'mx', 'yx', 'kx'};
0091
0092 timeVal = d.antenna0.receiver.utc*24*60*60;
0093 timeVal = timeVal - timeVal(1);
0094
0095 pageNum=1;
0096 fmode=logical(0);
0097
0098 clear leg;
0099
0100 for plotNum=1:plotsPerPage
0101 subplot(matrix(1),matrix(2),plotNum)
0102
0103 optionIndex = 1;
0104
0105 [boo, coo, h(pageNum, plotNum,optionIndex) NFFT] = plot_powerspec(d, ...
0106 data0(:,plotNum), 1, [], [], plotoptions{1},~isMains);
0107
0108 hold on
0109
0110 [boo1, coo1, h(pageNum, plotNum,optionIndex) NFFT] = plot_powerspec(d, ...
0111 data1(:,plotNum), 1, [],[], plotoptions{2},~isMains);
0112
0113
0114 if(~isMains)
0115
0116 ff = find( (abs(boo-1.2)==min(abs(boo-1.2))) );
0117 lowerBy = (abs(coo1(ff))./abs(coo(ff)))^2;
0118
0119 leg{1} = 'Before';
0120 leg{2} = sprintf(' ''After (ratio of %2.2f)'' ', lowerBy);
0121
0122 thisY1 = 2*abs(coo1(1:NFFT/2+1,:));
0123 thisY = 2*abs(coo(1:NFFT/2+1,:));
0124 ff = find(boo>1.15 & boo<1.25);
0125 minY = median([thisY(ff); thisY1(ff)]);
0126
0127 maxY = max([thisY(ff); thisY1(ff)]);
0128
0129 axis([1.15 1.25 0.9*(minY) 1.1*maxY]);
0130
0131 thisTitle = plotlabel{plotNum};
0132 else
0133 leg{1} = 'Before';
0134 leg{2} = 'After';
0135 thisTitle = sprintf('%s %u', txt{1}{1}, plotNum);
0136 end
0137
0138
0139
0140
0141
0142
0143 xlabel(txt{2});
0144 ylabel(txt{3});
0145 title(thisTitle);
0146 end
0147
0148 gtitle(txt{4});
0149
0150 if(saveplot)
0151 dbclear if error
0152 set(gcf,'paperposition',[0 0 6.0 6.0])
0153 eval(sprintf('print -dpng -r200 %s/%s/fig%u.png;', ...
0154 maindir,type,pageNum));
0155 dbstop if error
0156 else
0157 pause(1);
0158 end
0159
0160 return;
0161
0162
0163
0164
0165
0166 function p=setProperties(p)
0167
0168 if (isempty(p))
0169 p.style='flag';
0170 p.swap=0;
0171 p.featflag=0;
0172 return
0173 end
0174
0175 if (isfield(p,'style'))
0176
0177 else
0178 p.style='flag';
0179 p.featflag=0;
0180 end
0181
0182 if (~isfield(p,'swap'))
0183 p.swap=0;
0184 end
0185
0186 return;
0187
0188
0189
0190 function manaxis(ax,y)
0191
0192 if (~isempty(ax))
0193 ax4orig = ax(4);
0194 ymax=max(y)*1.1;
0195 if (max(y)>ax(4))
0196
0197 ax(4)=ymax;
0198 elseif (8*nanmean(y)<ax(4) & ax(3)>=0)
0199
0200
0201
0202
0203 ax(4)=ymax;
0204 elseif (isnan(ax(4)) | isnan(ax(3)))
0205 if (isnan(ax(4)))
0206 ax(4)=1;
0207 end
0208 if (isnan(ax(3)))
0209 ax(3)=0;
0210 end
0211 end
0212
0213
0214
0215
0216 if(ax(3) >= ax(4))
0217 if(ax4orig>ax(3))
0218 ax(4) = ax4orig;
0219 else
0220 ax(4) = ax(3)+1;
0221 end
0222 end
0223 axis(ax);
0224 end
0225
0226 return;
0227
0228
0229
0230 function [clr,leg]=getcolor(type)
0231
0232 clr=[ 0.2 0 0;
0233 1 0.66 0;
0234 1 0 1;
0235 0.5 0.2 1;
0236 0.2 0.2 0.8;
0237 1 0.5 0.12;
0238 0.1 0.5 0.9;
0239 0.75 1 1;
0240 0.2 0.5 0.66;
0241 0.9 0.8 0.7;
0242 0.6 0 0.1;
0243 0 0 1
0244 0.5869 0.1909 0.3461
0245 0.0576 0.8439 0.1660
0246 0.3676 0.1739 0.1556
0247 0.6315 0.1708 0.1911
0248 0.7176 0.9943 0.4225
0249 0.6927 0.4398 0.8560
0250 0.0841 0.3400 0.4902
0251 0.4544 0.3142 0.8159
0252 0.4418 0.3651 0.4608
0253 0.3533 0.3932 0.4574
0254 0.1536 0.5915 0.4507
0255 0.6756 0.1197 0.4122
0256 0.6992 0.0381 0.9016
0257 0.7275 0.4586 0.0056
0258 0.4784 0.8699 0.2974
0259 0.5548 0.9342 0.0492
0260 0.1210 0.2644 0.6932
0261 0.4508 0.1603 0.6501
0262 0.7159 0.8729 0.9830
0263 0 0 0];
0264
0265
0266 switch type
0267 case 'feature'
0268 leg = {'source', 'calibrator', 'abscal', 'blank', 'skydip', ...
0269 'noise_event', 'noise'};
0270
0271 case 'bitmask'
0272 leg={'frame','receiver', 'tracking', 'tracker', 'elevation', ...
0273 'continuous', 'fifo', 'clock', '1pps', 'cryo/servo', 'backend time', 'shortfall', 'sun', 'moon'};
0274 end
0275
0276 return;
0277
0278