- Timestamp:
- 07/04/06 14:44:44 (18 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.