Changeset 1069
- Timestamp:
- 07/04/06 14:44:44 (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r1059 r1069 306 306 del gui 307 307 308 308 309 __date__ = '$Date$'.split()[1] 309 __version__ = '2. 0.1'310 __version__ = '2.1a' 310 311 311 312 if rcParams['verbose']: … … 367 368 average_time - return the (weighted) time average of a scan 368 369 or a list of scans 370 average_channel - return the (median) average of a scantable 369 371 average_pol - average the polarisations together. 370 372 The dimension won't be reduced and … … 373 375 convert_pol - convert to a different polarisation type 374 376 auto_quotient - return the on/off quotient with 375 automatic detection of the on/off scans 376 (matched pairs and 1 off - n on)377 automatic detection of the on/off scans (closest 378 in time off is selected) 377 379 scale, *, / - return a scan scaled by a given factor 378 380 add, +, - - return a scan with given value added … … 419 421 simple_math - simple mathematical operations on two scantables, 420 422 'add', 'sub', 'mul', 'div' 423 quotient - build quotient of the given on and off scans 424 (matched pairs and 1 off/n on are valid) 425 421 426 [Fitting] 422 427 fitter -
trunk/src/STMath.cpp
r1066 r1069 189 189 } 190 190 191 CountedPtr< Scantable > 192 STMath::averageChannel( const CountedPtr < Scantable > & in, 193 const std::string & mode ) 194 { 195 // clone as this is non insitu 196 bool insitu = insitu_; 197 setInsitu(false); 198 CountedPtr< Scantable > out = getScantable(in, true); 199 setInsitu(insitu); 200 Table& tout = out->table(); 201 ArrayColumn<Float> specColOut(tout,"SPECTRA"); 202 ArrayColumn<uChar> flagColOut(tout,"FLAGTRA"); 203 ArrayColumn<Float> tsysColOut(tout,"TSYS"); 204 205 Block<String> cols(3); 206 cols[0] = String("BEAMNO"); 207 cols[1] = String("IFNO"); 208 cols[2] = String("POLNO"); 209 uInt outrowCount = 0; 210 uChar userflag = 1 << 7; 211 TableIterator iter(in->table(), cols); 212 while (!iter.pastEnd()) { 213 Table subt = iter.table(); 214 ROArrayColumn<Float> specCol, tsysCol; 215 ROArrayColumn<uChar> flagCol; 216 specCol.attach(subt,"SPECTRA"); 217 flagCol.attach(subt,"FLAGTRA"); 218 tsysCol.attach(subt,"TSYS"); 219 tout.addRow(); 220 TableCopy::copyRows(tout, subt, outrowCount, 0, 1); 221 Vector<Float> tmp; 222 specCol.get(0, tmp); 223 uInt nchan = tmp.nelements(); 224 Vector<uChar> flags = flagCol.getColumn(Slicer(Slice(0))); 225 Vector<Float> outspec(nchan); 226 Vector<uChar> outflag(nchan,0); 227 Vector<Float> outtsys(1);/// @fixme when tsys is channel based 228 for (uInt i=0; i<nchan; ++i) { 229 Vector<Float> specs = specCol.getColumn(Slicer(Slice(i))); 230 MaskedArray<Float> ma = maskedArray(specs,flags); 231 outspec[i] = median(ma); 232 if ( allEQ(ma.getMask(), False) ) 233 outflag[i] = userflag;// flag data 234 } 235 outtsys[0] = median(tsysCol.getColumn()); 236 specColOut.put(outrowCount, outspec); 237 flagColOut.put(outrowCount, outflag); 238 tsysColOut.put(outrowCount, outtsys); 239 240 ++outrowCount; 241 ++iter; 242 } 243 return out; 244 } 191 245 192 246 CountedPtr< Scantable > STMath::getScantable(const CountedPtr< Scantable >& in, … … 331 385 { 332 386 bool insitu = insitu_; 387 if ( ! on->conformant(*off) ) { 388 throw(AipsError("'on' and 'off' scantables are not conformant.")); 389 } 333 390 setInsitu(false); 334 391 CountedPtr< Scantable > out = getScantable(on, false); -
trunk/src/STMath.h
r1066 r1069 58 58 const std::string& weight = "NONE", 59 59 const std::string& avmode = "SCAN"); 60 61 casa::CountedPtr<Scantable> 62 averageChannel( const casa::CountedPtr<Scantable> & in, 63 const std::string& mode = "MEDIAN"); 60 64 61 65 casa::CountedPtr< Scantable > -
trunk/src/STMathWrapper.h
r1066 r1069 46 46 return ScantableWrapper(STMath::average(sts, mask, weight, avmode)); 47 47 } 48 49 ScantableWrapper 50 averageChannel( const ScantableWrapper& in, 51 const std::string& mode = "MEDIAN") 52 { 53 return ScantableWrapper(STMath::averageChannel(in.getCP(), mode)); 54 } 55 48 56 ScantableWrapper 49 57 averagePolarisations( const ScantableWrapper& in, -
trunk/src/python_STMath.cpp
r1066 r1069 45 45 .def("_setinsitu", &STMathWrapper::setInsitu) 46 46 .def("_average", &STMathWrapper::average) 47 .def("_averagechannel", &STMathWrapper::averageChannel) 47 48 .def("_averagepol", &STMathWrapper::averagePolarisations) 48 49 .def("_unaryop", &STMathWrapper::unaryOperate)
Note:
See TracChangeset
for help on using the changeset viewer.