Changeset 1145
- Timestamp:
- 08/16/06 11:11:45 (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1143 r1145 1021 1021 return s 1022 1022 1023 def average_beam(self, mask=None, weight='none'): 1024 """ 1025 Average the Beams together. 1026 Parameters: 1027 mask: An optional mask defining the region, where the 1028 averaging will be applied. The output will have all 1029 specified points masked. 1030 weight: Weighting scheme. 'none' (default), 'var' (1/var(spec) 1031 weighted), or 'tsys' (1/Tsys**2 weighted) 1032 """ 1033 varlist = vars() 1034 if mask is None: 1035 mask = () 1036 s = scantable(self._math._averagebeams(self, mask, weight.upper())) 1037 s._add_history("average_beam", varlist) 1038 print_log() 1039 return s 1040 1023 1041 def convert_pol(self, poltype=None): 1024 1042 """ … … 1331 1349 return s 1332 1350 1333 def mx_quotient(self, mask = None, weight='median' ):1351 def mx_quotient(self, mask = None, weight='median', preserve=True): 1334 1352 """ 1335 1353 Form a quotient using "off" beams when observing in "MX" mode. 1336 1354 Parameters: 1355 mask: an optional mask to be used when weight == 'stddev' 1337 1356 weight: How to average the off beams. Default is 'median'. 1357 preserve: you can preserve (default) the continuum or 1358 remove it. The equations used are 1359 preserve: Output = Toff * (on/off) - Toff 1360 remove: Output = Toff * (on/off) - Ton 1338 1361 """ 1339 1362 if mask is None: mask = () … … 1342 1365 preoff = scantable(self._math._mx_extract(self, 'off')) 1343 1366 off = preoff.average_time(mask=mask, weight=weight, scanav=False) 1344 print_log()1345 1367 from asapmath import quotient 1346 q = quotient(on, off )1368 q = quotient(on, off, preserve) 1347 1369 q._add_history("mx_quotient", varlist) 1370 print_log() 1348 1371 return q 1349 1372 -
trunk/src/STMath.cpp
r1143 r1145 96 96 ScalarColumn<Double> intColOut(tout,"INTERVAL"); 97 97 ScalarColumn<uInt> cycColOut(tout,"CYCLENO"); 98 ScalarColumn<uInt> scanColOut(tout,"SCANNO"); 98 99 99 100 // set up the output table rows. These are based on the structure of the … … 120 121 tout.addRow(); 121 122 TableCopy::copyRows(tout, subt, outrowCount, 0, 1); 123 // re-index to 0 124 if ( avmode != "SCAN" && avmode != "SOURCE" ) { 125 scanColOut.put(outrowCount, uInt(0)); 126 } 122 127 ++outrowCount; 123 128 ++iter; … … 419 424 && t.col("IFNO") == Int(rec.asuInt("IFNO")) 420 425 && t.col("POLNO") == Int(rec.asuInt("POLNO")) ); 426 if ( offsel.nrow() == 0 ) 427 throw AipsError("STMath::quotient: no matching off"); 421 428 TableRow offrow(offsel); 422 429 const TableRecord& offrec = offrow.get(0);//should be ncycles - take first … … 1126 1133 Table& tout = pols->table(); 1127 1134 // give all rows the same POLNO 1128 TableVector<uInt> vec(tout, "POLNO");1135 TableVector<uInt> vec(tout, "POLNO"); 1129 1136 vec = 0; 1130 pols->table_.rwKeywordSet().define("nPol", Int(1));1137 pols->table_.rwKeywordSet().define("nPol", Int(1)); 1131 1138 std::vector<CountedPtr<Scantable> > vpols; 1132 1139 vpols.push_back(pols); 1133 1140 CountedPtr< Scantable > out = average(vpols, mask, weight, "NONE"); 1141 return out; 1142 } 1143 1144 CountedPtr< Scantable > 1145 STMath::averageBeams( const CountedPtr< Scantable > & in, 1146 const std::vector<bool>& mask, 1147 const std::string& weight ) 1148 { 1149 bool insitu = insitu_; 1150 setInsitu(false); 1151 CountedPtr< Scantable > beams = getScantable(in, false); 1152 setInsitu(insitu); 1153 Table& tout = beams->table(); 1154 // give all rows the same BEAMNO 1155 TableVector<uInt> vec(tout, "BEAMNO"); 1156 vec = 0; 1157 beams->table_.rwKeywordSet().define("nBeam", Int(1)); 1158 std::vector<CountedPtr<Scantable> > vbeams; 1159 vbeams.push_back(beams); 1160 CountedPtr< Scantable > out = average(vbeams, mask, weight, "NONE"); 1134 1161 return out; 1135 1162 } -
trunk/src/STMath.h
r1143 r1145 91 91 92 92 /** 93 * average polarisations together. really only useful if only linears are94 * 93 * Average polarisations together. really only useful if only linears are 94 * available. 95 95 * @param in the input Scantable 96 96 * @param mask an optional mask if weight allows one … … 102 102 const std::vector<bool>& mask, 103 103 const std::string& weight ); 104 105 /** 106 * Average beams together. 107 * @param in the input Scantable 108 * @param mask an optional mask if weight allows one 109 * @param weight weighting scheme 110 * @return 111 */ 112 casa::CountedPtr< Scantable > 113 averageBeams( const casa::CountedPtr< Scantable > & in, 114 const std::vector<bool>& mask, 115 const std::string& weight ); 104 116 105 117 casa::CountedPtr<Scantable> -
trunk/src/STMathWrapper.h
r1140 r1145 60 60 const std::string& weight) 61 61 { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));} 62 63 ScantableWrapper 64 averageBeams( const ScantableWrapper& in, 65 const std::vector<bool>& mask, 66 const std::string& weight) 67 68 { return ScantableWrapper(STMath::averageBeams(in.getCP(),mask, weight));} 62 69 63 70 ScantableWrapper … … 144 151 const std::string& newtype ) 145 152 { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); } 146 153 147 154 ScantableWrapper mxExtract( const ScantableWrapper& in, 148 155 const std::string& scantype="on" ) -
trunk/src/python_STMath.cpp
r1140 r1145 47 47 .def("_averagechannel", &STMathWrapper::averageChannel) 48 48 .def("_averagepol", &STMathWrapper::averagePolarisations) 49 .def("_averagebeams", &STMathWrapper::averageBeams) 49 50 .def("_unaryop", &STMathWrapper::unaryOperate) 50 51 .def("_auto_quotient", &STMathWrapper::autoQuotient)
Note:
See TracChangeset
for help on using the changeset viewer.