Line data Source code
1 : //# EVLASwPow.cc: Implementation of EVLA Switched Power Calibration
2 : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //#
5 : //# This library is free software; you can redistribute it and/or modify it
6 : //# under the terms of the GNU Library General Public License as published by
7 : //# the Free Software Foundation; either version 2 of the License, or (at your
8 : //# option) any later version.
9 : //#
10 : //# This library is distributed in the hope that it will be useful, but WITHOUT
11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 : //# License for more details.
14 : //#
15 : //# You should have received a copy of the GNU Library General Public License
16 : //# along with this library; if not, write to the Free Software Foundation,
17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 : //#
19 : //# Correspondence concerning AIPS++ should be addressed as follows:
20 : //# Internet email: casa-feedback@nrao.edu.
21 : //# Postal address: AIPS++ Project Office
22 : //# National Radio Astronomy Observatory
23 : //# 520 Edgemont Road
24 : //# Charlottesville, VA 22903-2475 USA
25 : //#
26 :
27 : #include <synthesis/MeasurementComponents/EVLASwPow.h>
28 :
29 : #include <synthesis/MeasurementComponents/MSMetaInfoForCal.h>
30 :
31 : #include <casacore/ms/MeasurementSets/MSColumns.h>
32 : #include <casacore/casa/BasicMath/Math.h>
33 : #include <casacore/tables/Tables/Table.h>
34 : #include <casacore/tables/Tables/TableIter.h>
35 : #include <synthesis/CalTables/CTGlobals.h>
36 :
37 : #include <casacore/casa/BasicSL/String.h>
38 : #include <casacore/casa/Utilities/Assert.h>
39 : #include <casacore/casa/Utilities/GenSort.h>
40 : #include <casacore/casa/Exceptions/Error.h>
41 : #include <casacore/casa/System/Aipsrc.h>
42 : #include <casacore/casa/System/ProgressMeter.h>
43 :
44 : #include <sstream>
45 :
46 : #include <casacore/casa/Logging/LogMessage.h>
47 : #include <casacore/casa/Logging/LogSink.h>
48 :
49 :
50 :
51 : using namespace casacore;
52 : namespace casa { //# NAMESPACE CASA - BEGIN
53 :
54 :
55 : // **********************************************************
56 : // EVLASwPow Implementations
57 : //
58 :
59 0 : EVLASwPow::SPType EVLASwPow::sptype(const String name) {
60 0 : String utype=upcase(name);
61 0 : if (utype.contains("SWP/RQ"))
62 0 : return EVLASwPow::SWPOVERRQ;
63 0 : if (utype.contains("SWPOW"))
64 0 : return EVLASwPow::SWPOW;
65 0 : if (utype.contains("EVLAGAIN"))
66 0 : return EVLASwPow::SWPOW;
67 0 : if (utype.contains("RQ"))
68 0 : return EVLASwPow::RQ;
69 :
70 : // Only get here if name unrecognized
71 0 : throw(AipsError(name+" is not among recognized EVLA Switched Power types ('swpow','evlagain','rq','swp/rq')"));
72 :
73 : // Should never reach here, but this is accurate (and avoids compiler warning)
74 : return EVLASwPow::NONE;
75 :
76 0 : }
77 :
78 0 : String EVLASwPow::sptype(EVLASwPow::SPType sptype) {
79 0 : switch (sptype) {
80 0 : case EVLASwPow::SWPOW: {
81 0 : return String("swpow");
82 : break;
83 : }
84 0 : case EVLASwPow::RQ: {
85 0 : return String("rq");
86 : break;
87 : }
88 0 : case EVLASwPow::SWPOVERRQ: {
89 0 : return String("swpow/rq");
90 : break;
91 : }
92 0 : case EVLASwPow::NONE:
93 : default: {
94 0 : throw(AipsError("Unrecognized EVLA Switched Power type"));
95 : }
96 : }
97 : // Should never reach here, but this is accurate (and avoids compiler warning)
98 : return String("None");
99 : }
100 :
101 0 : EVLASwPow::EVLASwPow(VisSet& vs) :
102 : VisCal(vs), // virtual base
103 : VisMueller(vs), // virtual base
104 : GJones(vs), // immediate parent
105 0 : sysPowTabName_(vs.syspowerTableName()),
106 0 : calDevTabName_(vs.caldeviceTableName()),
107 0 : correff_(Float(0.932)), // EVLA-specific net corr efficiency (4bit)
108 0 : frgrotscale_(Float(1.176)), // EVLA-specific fringe rotation mean _scale_
109 : //nyquist_(1.0),
110 0 : effChBW_()
111 :
112 : {
113 0 : if (prtlev()>2) cout << "EVLASwPow::EVLASwPow(vs)" << endl;
114 :
115 0 : nChanParList().set(1);
116 0 : startChanList().set(0);
117 :
118 : // Get spw total bandwidths
119 0 : const MSSpWindowColumns& spwcols = vs.iter().msColumns().spectralWindow();
120 0 : effChBW_.resize(nSpw());
121 0 : for (Int ispw=0;ispw<nSpw();++ispw)
122 0 : effChBW_(ispw)=Vector<Double>(spwcols.effectiveBW()(0))(0);
123 :
124 0 : }
125 :
126 0 : EVLASwPow::EVLASwPow(String msname,Int MSnAnt,Int MSnSpw) :
127 : VisCal(msname,MSnAnt,MSnSpw), // virtual base
128 : VisMueller(msname,MSnAnt,MSnSpw), // virtual base
129 : GJones(msname,MSnAnt,MSnSpw), // immediate parent
130 0 : sysPowTabName_(""),
131 0 : calDevTabName_(""),
132 0 : correff_(Float(0.932)), // EVLA-specific net corr efficiency (4bit)
133 0 : frgrotscale_(Float(1.176)), // EVLA-specific fringe rotation mean _scale_
134 : //nyquist_(1.0),
135 0 : effChBW_()
136 :
137 : {
138 0 : if (prtlev()>2) cout << "EVLASwPow::EVLASwPow(msname,MSnAnt,MSnSpw)" << endl;
139 :
140 0 : nChanParList().set(1);
141 0 : startChanList().set(0);
142 :
143 : // Temporary MS to get some info
144 0 : MeasurementSet ms(msname);
145 :
146 : // The relevant subtable names (there must be a better way...)
147 0 : sysPowTabName_ = ms.rwKeywordSet().asTable("SYSPOWER").tableName();
148 0 : calDevTabName_ = ms.rwKeywordSet().asTable("CALDEVICE").tableName();
149 :
150 : // Get spw total bandwidths
151 0 : MSColumns mscol(ms);
152 0 : const MSSpWindowColumns& spwcols = mscol.spectralWindow();
153 0 : effChBW_.resize(nSpw());
154 0 : for (Int ispw=0;ispw<nSpw();++ispw)
155 0 : effChBW_(ispw)=Vector<Double>(spwcols.effectiveBW()(0))(0);
156 :
157 0 : }
158 :
159 0 : EVLASwPow::EVLASwPow(const MSMetaInfoForCal& msmc) :
160 : VisCal(msmc), // virtual base
161 : VisMueller(msmc), // virtual base
162 : GJones(msmc), // immediate parent
163 0 : sysPowTabName_(""),
164 0 : calDevTabName_(""),
165 0 : correff_(Float(0.932)), // EVLA-specific net corr efficiency (4bit)
166 0 : frgrotscale_(Float(1.176)), // EVLA-specific fringe rotation mean _scale_
167 : //nyquist_(1.0),
168 0 : effChBW_()
169 :
170 : {
171 0 : if (prtlev()>2) cout << "EVLASwPow::EVLASwPow(msmc)" << endl;
172 :
173 0 : nChanParList().set(1);
174 0 : startChanList().set(0);
175 :
176 : // Temporary MS to get some info
177 0 : MeasurementSet ms(this->msmc().msname());
178 :
179 : // The relevant subtable names (there must be a better way...)
180 0 : sysPowTabName_ = ms.rwKeywordSet().asTable("SYSPOWER").tableName();
181 0 : calDevTabName_ = ms.rwKeywordSet().asTable("CALDEVICE").tableName();
182 :
183 : // Get spw total bandwidths
184 0 : MSColumns mscol(ms);
185 0 : const MSSpWindowColumns& spwcols = mscol.spectralWindow();
186 0 : effChBW_.resize(nSpw());
187 0 : for (Int ispw=0;ispw<nSpw();++ispw)
188 0 : effChBW_(ispw)=Vector<Double>(spwcols.effectiveBW()(0))(0);
189 :
190 0 : }
191 :
192 0 : EVLASwPow::EVLASwPow(const Int& nAnt) :
193 : VisCal(nAnt),
194 : VisMueller(nAnt),
195 0 : GJones(nAnt)
196 : {
197 0 : if (prtlev()>2) cout << "EVLASwPow::EVLASwPow(nAnt)" << endl;
198 :
199 0 : throw(AipsError("Cannot use EVLASwPow with generic ctor."));
200 :
201 0 : }
202 :
203 0 : EVLASwPow::~EVLASwPow() {
204 0 : if (prtlev()>2) cout << "EVLASwPow::~EVLASwPow()" << endl;
205 0 : }
206 :
207 0 : void EVLASwPow::setSpecify(const Record& specify) {
208 :
209 0 : LogMessage message(LogOrigin("EVLASwPow","setSpecify"));
210 :
211 : // Escape if SYSPOWER or CALDEVICE tables absent
212 0 : if (!Table::isReadable(sysPowTabName_))
213 0 : throw(AipsError("The SYSPOWER subtable is not present in the specified MS."));
214 0 : if (!Table::isReadable(calDevTabName_))
215 0 : throw(AipsError("The CALDEVICE subtable is not present in the specified MS."));
216 :
217 : // Not actually applying or solving
218 0 : setSolved(false);
219 0 : setApplied(false);
220 :
221 : // Collect Cal table parameters
222 0 : if (specify.isDefined("caltable")) {
223 0 : calTableName()=specify.asString("caltable");
224 :
225 0 : if (Table::isReadable(calTableName()))
226 : logSink() << "FYI: We are going to overwrite an existing CalTable: "
227 0 : << calTableName()
228 0 : << LogIO::POST;
229 : }
230 :
231 : // we are creating a table from scratch
232 0 : logSink() << "Creating " << typeName()
233 : // << " table from CANNED VALUES."
234 : << " table from MS SYSPOWER/CALDEVICE subtables."
235 0 : << LogIO::POST;
236 :
237 : // Create a caltable to fill up
238 0 : createMemCalTable();
239 :
240 : // Init the shapes of solveAllRPar, etc.
241 0 : initSolvePar();
242 :
243 0 : }
244 :
245 0 : void EVLASwPow::specify(const Record& specify) {
246 :
247 : // Escape if SYSPOWER or CALDEVICE tables absent
248 0 : if (!Table::isReadable(sysPowTabName_))
249 0 : throw(AipsError("The SYSPOWER subtable is not present in the specified MS."));
250 0 : if (!Table::isReadable(calDevTabName_))
251 0 : throw(AipsError("The CALDEVICE subtable is not present in the specified MS."));
252 :
253 : // Fill the Tcals first
254 0 : fillTcals();
255 :
256 : // Discern which kind of calibration to calculate
257 0 : SPType swptype(EVLASwPow::SWPOW);
258 0 : if (specify.isDefined("caltype")) {
259 0 : String ctype=specify.asString("caltype");
260 0 : swptype=sptype(ctype);
261 : //cout << "caltype=" << ctype << " " << swptype << " " << sptype(swptype) << endl;
262 0 : }
263 :
264 0 : logSink() << "Filling switched-power (" << sptype(swptype) << ") data from the SYSPOWER table." << LogIO::POST;
265 :
266 : // The net digital factor for antenna-based (voltage) gain
267 0 : Float dig=sqrt(correff_*frgrotscale_);
268 :
269 : // Keep a count of the number of Tsys found per spw/ant
270 0 : Matrix<Int> goodcount(nSpw(),nElem(),0), badcount(nSpw(),nElem(),0);
271 :
272 0 : Block<String> columns(2);
273 0 : columns[0] = "TIME";
274 0 : columns[1] = "SPECTRAL_WINDOW_ID";
275 0 : Table sysPowTab(sysPowTabName_,Table::Old);
276 0 : TableIterator sysPowIter(sysPowTab,columns);
277 :
278 : // Count iterations
279 0 : Int niter(0);
280 0 : while (!sysPowIter.pastEnd()) {
281 0 : ++niter;
282 0 : sysPowIter.next();
283 : }
284 0 : sysPowIter.reset();
285 :
286 0 : logSink() << "Found " << niter << " TIME/SPW switched-power samples in SYSPOWER table" << LogIO::POST;
287 :
288 : // Iterate
289 : // Vectors for referencing slices of working info
290 0 : Vector<Float> currpsum,currpdif,currrq,currtcal,gain,tsys;
291 :
292 : // Emit progress meter reports (at least until we improve performance)
293 0 : cerr << "Switched-Power ("+sptype(swptype)+") calculation: 0";
294 0 : ProgressMeter pm(0.,niter , "", "", "", "", true, niter/100);
295 :
296 0 : Int iter(0);
297 0 : while (!sysPowIter.pastEnd()) {
298 :
299 : // Update the progress meter
300 0 : pm.update(iter);
301 :
302 0 : Table itab(sysPowIter.table());
303 :
304 0 : ScalarColumn<Int> spwCol(itab,"SPECTRAL_WINDOW_ID");
305 0 : ScalarColumn<Double> timeCol(itab,"TIME");
306 0 : ScalarColumn<Double> intervalCol(itab,"INTERVAL");
307 0 : ScalarColumn<Int> antCol(itab,"ANTENNA_ID");
308 0 : ArrayColumn<Float> swsumCol(itab,"SWITCHED_SUM");
309 0 : ArrayColumn<Float> swdiffCol(itab,"SWITCHED_DIFF");
310 0 : ArrayColumn<Float> rqCol(itab,"REQUANTIZER_GAIN");
311 :
312 0 : Int ispw=spwCol(0);
313 :
314 0 : Double timestamp=timeCol(0);
315 : // Double interval=intervalCol(0);
316 :
317 0 : Vector<Int> ants;
318 0 : antCol.getColumn(ants);
319 :
320 0 : Matrix<Float> psum,pdif,rq;
321 0 : swsumCol.getColumn(psum);
322 0 : swdiffCol.getColumn(pdif);
323 0 : rqCol.getColumn(rq);
324 0 : IPosition psumshape(psum.shape());
325 0 : IPosition pdifshape(pdif.shape());
326 :
327 0 : AlwaysAssert(psumshape.isEqual(pdifshape),AipsError);
328 :
329 : // the number of receptors
330 0 : Int nrec=psumshape(0);
331 :
332 : // Now prepare to record pars in the caltable
333 0 : currSpw()=ispw;
334 0 : refTime()=timestamp;
335 0 : currField()=msmc().fieldIdAtTime(timestamp);
336 0 : currScan()=msmc().scanNumberAtTime(timestamp);
337 :
338 : // Initialize solveAllRPar, etc.
339 0 : solveAllRPar()=1.0;
340 0 : solveAllParOK()=false;
341 0 : solveAllParErr()=0.0; // what should we use here? ~1/bandwidth?
342 0 : solveAllParSNR()=1.0;
343 :
344 0 : IPosition blc(3,0,0,0),trc(3,2*nrec-1,0,0),stp(3,nrec,1,1);
345 0 : for (uInt iant=0;iant<ants.nelements();++iant) {
346 0 : Int thisant=ants(iant);
347 :
348 : // Reference this ant's info
349 0 : currpsum.reference(psum.column(iant));
350 0 : currpdif.reference(pdif.column(iant));
351 0 : currrq.reference(rq.column(iant));
352 0 : currtcal.reference(tcals_.xyPlane(ispw).column(thisant));
353 :
354 : // If any of the required values are goofy, we'll skip this antenna
355 : Bool good;
356 0 : switch (swptype) {
357 0 : case EVLASwPow::SWPOW: {
358 0 : good=(allGT(currtcal,FLT_EPSILON) &&
359 0 : allGT(currpdif,FLT_EPSILON) &&
360 0 : allGT(currpsum,FLT_EPSILON));
361 : }
362 0 : case EVLASwPow::SWPOVERRQ:{
363 0 : good=(allGT(currtcal,FLT_EPSILON) &&
364 0 : allGT(currpdif,FLT_EPSILON) &&
365 0 : allGT(currpsum,FLT_EPSILON) &&
366 0 : allGT(currrq,FLT_EPSILON));
367 0 : break;
368 : }
369 0 : case EVLASwPow::RQ: {
370 0 : good=allGT(currrq,FLT_EPSILON);
371 0 : break;
372 : }
373 0 : default: {
374 0 : throw(AipsError("Unrecognized EVLA Switched Power type"));
375 : break;
376 : }
377 : }
378 0 : blc(2)=trc(2)=thisant; // the MS ant index (not loop index)
379 :
380 0 : blc(0)=0;
381 0 : gain.reference(solveAllRPar()(blc,trc,stp).nonDegenerate(1)); // 'gain'
382 0 : blc(0)=1;
383 0 : tsys.reference(solveAllRPar()(blc,trc,stp).nonDegenerate(1)); // 'tsys'
384 :
385 0 : if (!good) {
386 :
387 : // ensure transparent values
388 0 : gain=1.0;
389 0 : tsys=1.0;
390 0 : solveAllParOK().xyPlane(thisant)=false;
391 :
392 : // Increment bad counter
393 0 : ++badcount(ispw,thisant);
394 : }
395 : else {
396 :
397 0 : switch (swptype) {
398 0 : case EVLASwPow::SWPOW: {
399 0 : gain=sqrt(currpdif/currtcal);
400 0 : gain*=dig; // scale by net digital factor
401 0 : tsys=(currtcal*currpsum/currpdif/2.0); // 'tsys'
402 0 : break;
403 : }
404 0 : case EVLASwPow::RQ: {
405 0 : gain=currrq; // RQ gain only!
406 0 : tsys=1.0; // ignore Tsys
407 0 : break;
408 : }
409 0 : case EVLASwPow::SWPOVERRQ: {
410 0 : gain=sqrt(currpdif/currtcal); // ordinary sw power gain
411 0 : gain/=currrq; // remove rq effect
412 0 : gain*=dig; // scale by net digital factor
413 0 : tsys=(currtcal*currpsum/currpdif/2.0); // 'tsys'
414 0 : break;
415 : }
416 0 : default: {
417 0 : throw(AipsError("Unrecognized EVLA Switched Power type"));
418 : break;
419 : }
420 : }
421 0 : solveAllParOK().xyPlane(thisant)=true;
422 :
423 : // Increment good counter
424 0 : ++goodcount(ispw,thisant);
425 :
426 : }
427 :
428 : }
429 :
430 : // Record in the memory caltable
431 0 : keepNCT();
432 :
433 0 : sysPowIter.next();
434 0 : ++iter;
435 :
436 0 : }
437 :
438 : // Set scan and fieldid info
439 : // assignCTScanField(*ct_,msName());
440 :
441 0 : logSink() << "GOOD gain counts per spw for antenna Ids 0-"<<nElem()-1<<":" << LogIO::POST;
442 0 : for (Int ispw=0;ispw<nSpw();++ispw) {
443 0 : Vector<Int> goodcountspw(goodcount.row(ispw));
444 0 : if (sum(goodcountspw)>0)
445 : logSink() << " Spw " << ispw << ": " << goodcountspw
446 : << " (" << sum(goodcountspw) << ")"
447 0 : << LogIO::POST;
448 : else
449 0 : logSink() << "Spw " << ispw << ": NONE." << LogIO::POST;
450 0 : }
451 :
452 0 : logSink() << "BAD gain counts per spw for antenna Ids 0-"<<nElem()-1<<":" << LogIO::POST;
453 0 : for (Int ispw=0;ispw<nSpw();++ispw) {
454 0 : Vector<Int> badcountspw(badcount.row(ispw));
455 0 : if (sum(badcountspw)>0)
456 : logSink() << " Spw " << ispw << ": " << badcountspw
457 : << " (" << sum(badcountspw) << ")"
458 0 : << LogIO::POST;
459 0 : }
460 :
461 0 : logSink() << "BAD gain count FRACTION per spw for antenna Ids 0-"<<nElem()-1<<":" << LogIO::POST;
462 0 : for (Int ispw=0;ispw<nSpw();++ispw) {
463 0 : Vector<Float> badcountspw(badcount.row(ispw).shape());
464 0 : Vector<Float> goodcountspw(goodcount.row(ispw).shape());
465 0 : convertArray(badcountspw,badcount.row(ispw));
466 0 : convertArray(goodcountspw,goodcount.row(ispw));
467 0 : if (sum(badcountspw)>0.0f) {
468 0 : Vector<Float> fracbad=badcountspw/(badcountspw+goodcountspw);
469 0 : fracbad=floor(1000.0f*fracbad)/1000.0f;
470 0 : Float fracbadsum=sum(badcountspw)/(sum(badcountspw)+sum(goodcountspw));
471 0 : fracbadsum=floor(1000.0f*fracbadsum)/1000.0f;
472 : logSink() << " Spw " << ispw << ": " << fracbad
473 : << " (" << fracbadsum << ")"
474 0 : << LogIO::POST;
475 0 : }
476 0 : }
477 :
478 :
479 0 : }
480 :
481 0 : void EVLASwPow::fillTcals() {
482 :
483 0 : logSink() << "Filling Tcals from the CALDEVICE table." << LogIO::POST;
484 :
485 0 : Block<String> columns(2);
486 0 : columns[0] = "SPECTRAL_WINDOW_ID";
487 0 : columns[1] = "ANTENNA_ID";
488 0 : Table calDevTab(calDevTabName_,Table::Old);
489 0 : TableIterator calDevIter(calDevTab,columns);
490 :
491 0 : tcals_.resize(2,nElem(),nSpw());
492 0 : tcals_.set(-1.0f);
493 :
494 : // Iterate over CALDEVICE table
495 0 : Int iter(0);
496 0 : Vector<Int> islot(nSpw(),0);
497 :
498 0 : Bool ignoreSolar(false);
499 0 : while (!calDevIter.pastEnd()) {
500 :
501 0 : Table itab(calDevIter.table());
502 :
503 0 : ScalarColumn<Int> spwCol(itab,"SPECTRAL_WINDOW_ID");
504 0 : ScalarColumn<Double> timeCol(itab,"TIME");
505 0 : ScalarColumn<Double> intervalCol(itab,"INTERVAL");
506 0 : ScalarColumn<Int> antCol(itab,"ANTENNA_ID");
507 0 : ScalarColumn<Int> numLoadCol(itab,"NUM_CAL_LOAD");
508 :
509 0 : ArrayColumn<Float> noiseCalCol(itab,"NOISE_CAL");
510 :
511 0 : Int ispw=spwCol(0);
512 0 : Int iant=antCol(0);
513 0 : Int nTcal=noiseCalCol(0).nelements();
514 :
515 0 : if (nTcal==1) {
516 : // One value (not clear this was ever the case)
517 0 : Vector<Float> thisTcal=noiseCalCol(0);
518 0 : AlwaysAssert(thisTcal.nelements()==1,AipsError);
519 0 : tcals_.xyPlane(ispw).column(iant)=thisTcal(0);
520 0 : }
521 0 : else if (nTcal==2) {
522 : // Pre-solar Tcal support: two values
523 0 : Vector<Float> thisTcal=noiseCalCol(0);
524 0 : AlwaysAssert(thisTcal.nelements()==2,AipsError);
525 0 : tcals_.xyPlane(ispw).column(iant)=thisTcal;
526 0 : }
527 0 : else if (nTcal==4) {
528 0 : ignoreSolar=true; // we will ignore solar Tcals
529 0 : Matrix<Float> thisTcalMat=noiseCalCol(0);
530 0 : AlwaysAssert(thisTcalMat.shape()==IPosition(2,2,2),AipsError);
531 0 : Int tcalset(0); // first pair, for now, which is ordinary non-solar Tcals
532 0 : tcals_.xyPlane(ispw).column(iant)=thisTcalMat(Slice(tcalset,1,1),Slice());
533 0 : }
534 :
535 : // Increment the iterator
536 0 : ++iter;
537 0 : calDevIter.next();
538 0 : }
539 :
540 : // Report if we ignored solar Tcals
541 0 : if (ignoreSolar)
542 0 : logSink() << "Ignoring the SOLAR Tcals, which seem to be present in CALDEVICE." << LogIO::POST;
543 :
544 :
545 0 : }
546 :
547 0 : void EVLASwPow::calcAllJones() {
548 :
549 : // 0th and 2nd pars are the gains
550 : // currJElem()=currRPar()(Slice(0,2,2),Slice(),Slice()); // NEWCALTABLE
551 0 : convertArray(currJElem(),currRPar()(Slice(0,2,2),Slice(),Slice()));
552 0 : currJElemOK()=currParOK()(Slice(0,2,2),Slice(),Slice());
553 :
554 0 : }
555 :
556 0 : void EVLASwPow::syncWtScale() {
557 :
558 0 : Int nPolWt=currRPar().shape()(0)/2;
559 0 : currWtScale().resize(nPolWt,1,nAnt());
560 :
561 0 : Cube<Float> Tsys(currRPar()(Slice(1,2,2),Slice(),Slice()));
562 0 : Tsys(Tsys<FLT_MIN)=1.0; // OK?
563 :
564 0 : currWtScale() = 1.0f/Tsys;
565 0 : currWtScale()*=correff_; // reduce by correlator efficiency (per ant)
566 :
567 : // cout << "Tsys = " << Tsys << endl;
568 : // cout << "currWtScale() = " << currWtScale() << endl;
569 :
570 0 : }
571 :
572 : /*
573 : void EVLASwPow::updateWt(Vector<Float>& wt,const Int& a1,const Int& a2) {
574 :
575 : Vector<Float> ws1(currWtScale().column(a1));
576 : Vector<Float> ws2(currWtScale().column(a2));
577 :
578 : if (a1==0 && a2==1) {
579 : cout << "wt = " << wt << endl;
580 : cout << "ws1 = " << ws1 << endl;
581 : cout << "ws2 = " << ws2 << endl;
582 : }
583 :
584 : VisJones::updateWt(wt,a1,a2);
585 :
586 : if (a1==0 && a2==1) {
587 : cout << "wt = " << wt << endl;
588 : }
589 : }
590 : */
591 :
592 : } //# NAMESPACE CASA - END
|