This is a static copy of a profile reportHome
tsysWrapper (1 call, 3.421 sec)
Generated 05-Aug-2011 13:01:16 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/support/tsysWrapper.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
reduceData | function | 1 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
60 | [times,alpha,gain,r,TsysTND,te... | 1 | 2.667 s | 78.0% |  |
80 | [d tsysflags] = packd(d, tsysf... | 1 | 0.612 s | 17.9% |  |
35 | tsysVals = getCalTemps(d.array... | 1 | 0.055 s | 1.6% |  |
78 | setPlotDisplay(plotparams.plot... | 1 | 0.033 s | 1.0% |  |
28 | tsysVals = calcTsys(d); | 1 | 0.022 s | 0.6% |  |
All other lines | | | 0.033 s | 1.0% |  |
Totals | | | 3.421 s | 100% | |
Children (called functions)
Code Analyzer results
Line number | Message |
1 | Extra semicolon is unnecessary. |
60 | The value assigned here to 'alpha' appears to be unused. Consider replacing it by ~. |
60 | The value assigned here to 'gain' appears to be unused. Consider replacing it by ~. |
60 | The value assigned here to 'r' appears to be unused. Consider replacing it by ~. |
60 | The value assigned here to 'temps' appears to be unused. Consider replacing it by ~. |
60 | The value assigned here to 'horz' appears to be unused. Consider replacing it by ~. |
60 | The value assigned to variable 'equa' might be unused. |
112 | Use && instead of & as the AND operator in (scalar) conditional statements. |
112 | Use && instead of & as the AND operator in (scalar) conditional statements. |
116 | The value assigned to variable 'allTsys' might be unused. |
123 | The value assigned to variable 'allCal' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 131 |
Non-code lines (comments, blank lines) | 56 |
Code lines (lines that can run) | 75 |
Code lines that did run | 50 |
Code lines that did not run | 25 |
Coverage (did run/can run) | 66.67 % |
Function listing
time calls line
1 function d = tsysWrapper(d, plotparams, parm, field);
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function d = tsysWrapper(d, plotparams, parm, field);
6 %
7 % reduceData function that calls functions to calculate tsys
8 %
9 % sjcm
10 %
11 % 3/30/2011 sjcm: saving plots without display
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 % first we calculate the system temperatures.
15
16 % this calculation requires four measurements
17 % Sky obs, no noise
18 % Sky obs, noise
19 % Calibrator source, no noise
20 % Calibrator source, noise
21 % if any are missing, the return value is an empty set, otherwise it's
22
1 23 if(size(d.antenna0.receiver.data,2)==8)
24 display('Tsys calculation not done for Sky-Load yet');
25 return;
26 end
27
0.02 1 28 tsysVals = calcTsys(d);
29
30
1 31 if(isempty(tsysVals))
1 32 d.correction.tsys.val = [];
1 33 display('No System temperature calculated from your data set');
1 34 display('Reading values from the archive.');
0.05 1 35 tsysVals = getCalTemps(d.array.frame.utc(1), last(d.array.frame.utc));
1 36 d.correction.survey = 1;
37 else
38 d.correction.survey = 0;
39 end
40
41 % next we flag
0.01 1 42 parFlag = checkpar(parm, 'tsys');
1 43 if(parFlag)
1 44 flagParams = [parm.tsys.noisehi parm.tsys.noiselo parm.tsys.valuehi parm.tsys.valuelo];
45 else
46 display('Using Default 1st stage RFI flagging parameters');
47 flagParams = [3.5 1 100 10];
48 end
1 49 [noiseflag tsysflag] = flagTsys(tsysVals, flagParams);
50
51 % the noiseflag are the bad values.
1 52 f = find(noiseflag);
1 53 display(sprintf('Tsys Flagging: %i of %i measurements unreliable', length(f), ...
54 length(noiseflag(:))));
55
56 % we're keeping the tsys values, but just showing them to be bad in the plotting.
1 57 tsysflags = noiseflag | tsysflag;
58
59 % next up, we get Oliver's tsys values from the alpha correction
2.67 1 60 [times,alpha,gain,r,TsysTND,temps,horz,equa] = readAlphaDatabase_DD();
1 61 thisInd = times>d.array.frame.utc(1) & times<d.array.frame.utc(end);
0.01 1 62 tsysVals.val2 = TsysTND(thisInd,:).*2;
1 63 tsysVals.time2 = times(thisInd);
64
1 65 d.correction.tsys = tsysVals;
1 66 d.correction.tsys.flag = zeros(size(tsysflags));
67
68 % if all our data is bad, than this data is useless for calibration
1 69 if(all(tsysflags(:)))
70 display('ATTENTION --- ATTENTION --- ATTENTION');
71 display('No good tsys values in your data');
72 display('This data set will not be used for calibration');
73 d.correction.tsys.allbad = 1;
1 74 else
1 75 d.correction.tsys.allbad = 0;
1 76 end
77
0.03 1 78 setPlotDisplay(plotparams.plot);
1 79 display('Plotting data');
0.61 1 80 [d tsysflags] = packd(d, tsysflags, 'none', 'tsys', plotparams, 'System Temperature Plots', field);
0.01 1 81 d.correction.tsys.flag = tsysflags;
82
83 % check again that user flagging hasn't made all the data bad.
1 84 if(all(d.correction.tsys.flag(:)))
85 display('ATTENTION --- ATTENTION --- ATTENTION');
86 display('No good tsys values in your data');
87 display('This data set will not be used for calibration');
88 d.correction.tsys.allbad = 1;
1 89 else
1 90 d.correction.tsys.allbad = 0;
1 91 end
92
93 % next we write things to disk
94
1 95 d.correction.tsys.flag = logical(d.correction.tsys.flag);
96 % last we save the values we calculate
1 97 thisTsys = d.correction.tsys.val;
1 98 thisTsys(d.correction.tsys.flag) = nan;
1 99 thisTsys = [d.correction.tsys.time d.correction.tsys.source thisTsys];
1 100 thisNoise = d.correction.tsys.tnoise;
1 101 thisNoise(d.correction.tsys.flag) = nan;
1 102 thisCal = [thisTsys thisNoise];
1 103 thisRx = d.correction.tsys.trx;
1 104 thisRx(d.correction.tsys.flag) = nan;
1 105 thisCal = [thisCal thisRx];
106
1 107 [home,installeddir]=where_am_i();
108
109 % make sure file is up-to-date
1 110 parFlag = checkpar(parm, 'autosave');
1 111 if(parFlag)
1 112 if(parm.autosave.flag & d.correction.survey == 0 & ...
1 113 d.correction.tsys.allbad == 0)
114 %system('cvs update constants/tsys_values.txt');
115 allTsys = load([home,'/',installeddir,'/constants/tsys_values.txt']);
116 allTsys = [allTsys; thisTsys];
117 save([home,'/',installeddir,'/constants/tsys_values.txt'], 'allTsys', '-ascii', '-single')
118 %system('cvs commit -m "update" constants/tsys_values.txt');
119
120 % we also want to save the stuff we need to calibrate
121 %system('cvs update constants/calibration_values.txt');
122 allCal = load([home,'/',installeddir,'/constants/calibration_values.txt']);
123 allCal = [allCal; thisCal];
124 save([home,'/',installeddir,'/constants/calibration_values.txt'], 'allCal', '-ascii', '-single')
125 %system('cvs commit -m "update" constants/calibration_values.txt');
126
127 end
1 128 end
129
130
1 131 return;
Other subfunctions in this file are not included in this listing.