- Timestamp:
- 02/10/10 11:59:23 (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r1645 r1689 389 389 from simplelinefinder import simplelinefinder 390 390 from linecatalog import linecatalog 391 from opacity import skydip 391 392 392 393 if rcParams['useplotter']: -
trunk/python/asapfitter.py
r1589 r1689 485 485 486 486 @print_log_dec 487 def plot(self, residual=False, components=None, plotparms=False, filename=None): 487 def plot(self, residual=False, components=None, plotparms=False, 488 filename=None): 488 489 """ 489 490 Plot the last fit. -
trunk/python/scantable.py
r1617 r1689 1 import functools 1 2 from asap._asap import Scantable 2 3 from asap import rcParams … … 7 8 from asap.coordinate import coordinate 8 9 from asap import _n_bools, mask_not, mask_and, mask_or 10 11 12 def preserve_selection(func): 13 @functools.wraps(func) 14 def wrap(obj, *args, **kw): 15 basesel = obj.get_selection() 16 val = func(obj, *args, **kw) 17 obj.set_selection(basesel) 18 return val 19 return wrap 20 9 21 10 22 class scantable(Scantable): … … 1104 1116 and Tsys are multiplied by the correction factor. 1105 1117 Parameters: 1106 tau: Opacity from which the correction factor is1118 tau: (list of) opacity from which the correction factor is 1107 1119 exp(tau*ZD) 1108 where ZD is the zenith-distance 1120 where ZD is the zenith-distance. 1121 If a list is provided, it has to be of length nIF, 1122 nIF*nPol or 1 and in order of IF/POL, e.g. 1123 [opif0pol0, opif0pol1, opif1pol0 ...] 1109 1124 insitu: if False a new scantable is returned. 1110 1125 Otherwise, the scaling is done in-situ … … 1114 1129 self._math._setinsitu(insitu) 1115 1130 varlist = vars() 1131 if not hasattr(tau, "__len__"): 1132 tau = [tau] 1116 1133 s = scantable(self._math._opacity(self, tau)) 1117 1134 s._add_history("opacity", varlist) -
trunk/src/STMath.cpp
r1618 r1689 1431 1431 1432 1432 CountedPtr< Scantable > STMath::opacity( const CountedPtr< Scantable > & in, 1433 floattau )1433 const std::vector<float>& tau ) 1434 1434 { 1435 1435 CountedPtr< Scantable > out = getScantable(in, false); 1436 1436 1437 Table tab = out->table(); 1438 ROScalarColumn<Float> elev(tab, "ELEVATION"); 1439 ArrayColumn<Float> specCol(tab, "SPECTRA"); 1440 ArrayColumn<uChar> flagCol(tab, "FLAGTRA"); 1441 ArrayColumn<Float> tsysCol(tab, "TSYS"); 1442 for ( uInt i=0; i<tab.nrow(); ++i) { 1443 Float zdist = Float(C::pi_2) - elev(i); 1444 Float factor = exp(tau/cos(zdist)); 1445 MaskedArray<Float> ma = maskedArray(specCol(i), flagCol(i)); 1446 ma *= factor; 1447 specCol.put(i, ma.getArray()); 1448 flagCol.put(i, flagsFromMA(ma)); 1449 Vector<Float> tsys; 1450 tsysCol.get(i, tsys); 1451 tsys *= factor; 1452 tsysCol.put(i, tsys); 1437 Table outtab = out->table(); 1438 1439 const uInt ntau = uInt(tau.size()); 1440 std::vector<float>::const_iterator tauit = tau.begin(); 1441 AlwaysAssert((ntau == 1 || ntau == in->nif() || ntau == in->nif() * in->npol()), 1442 AipsError); 1443 TableIterator iiter(outtab, "IFNO"); 1444 while ( !iiter.pastEnd() ) { 1445 Table itab = iiter.table(); 1446 TableIterator piter(outtab, "POLNO"); 1447 while ( !piter.pastEnd() ) { 1448 Table tab = piter.table(); 1449 ROScalarColumn<Float> elev(tab, "ELEVATION"); 1450 ArrayColumn<Float> specCol(tab, "SPECTRA"); 1451 ArrayColumn<uChar> flagCol(tab, "FLAGTRA"); 1452 ArrayColumn<Float> tsysCol(tab, "TSYS"); 1453 for ( uInt i=0; i<tab.nrow(); ++i) { 1454 Float zdist = Float(C::pi_2) - elev(i); 1455 Float factor = exp(*tauit/cos(zdist)); 1456 MaskedArray<Float> ma = maskedArray(specCol(i), flagCol(i)); 1457 ma *= factor; 1458 specCol.put(i, ma.getArray()); 1459 flagCol.put(i, flagsFromMA(ma)); 1460 Vector<Float> tsys; 1461 tsysCol.get(i, tsys); 1462 tsys *= factor; 1463 tsysCol.put(i, tsys); 1464 } 1465 if (ntau == in->nif()*in->npol() ) { 1466 tauit++; 1467 } 1468 piter++; 1469 } 1470 if (ntau >= in->nif() ) { 1471 tauit++; 1472 } 1473 iiter++; 1453 1474 } 1454 1475 return out; -
trunk/src/STMath.h
r1570 r1689 227 227 228 228 casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in, 229 floattau);229 const std::vector<float>& tau); 230 230 231 231 casa::CountedPtr<Scantable> -
trunk/src/STMathWrapper.h
r1570 r1689 149 149 150 150 ScantableWrapper opacity(const ScantableWrapper& in, 151 floattau)151 const std::vector<float>& tau) 152 152 { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); } 153 153
Note:
See TracChangeset
for help on using the changeset viewer.