- Timestamp:
- 08/28/06 16:33:58 (18 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r1145 r1192 31 31 #include <tables/Tables/TableIter.h> 32 32 #include <tables/Tables/TableCopy.h> 33 #include <scimath/Mathematics/FFTServer.h> 33 34 34 35 #include <lattices/Lattices/LatticeUtilities.h> … … 1377 1378 return out; 1378 1379 } 1380 1381 CountedPtr< Scantable > 1382 asap::STMath::lagFlag( const CountedPtr< Scantable > & in, 1383 double frequency, int width ) 1384 { 1385 CountedPtr< Scantable > out = getScantable(in, false); 1386 Table& tout = out->table(); 1387 TableIterator iter(tout, "FREQ_ID"); 1388 FFTServer<Float,Complex> ffts; 1389 while ( !iter.pastEnd() ) { 1390 Table tab = iter.table(); 1391 Double rp,rv,inc; 1392 ROTableRow row(tab); 1393 const TableRecord& rec = row.get(0); 1394 uInt freqid = rec.asuInt("FREQ_ID"); 1395 out->frequencies().getEntry(rp, rv, inc, freqid); 1396 ArrayColumn<Float> specCol(tab, "SPECTRA"); 1397 ArrayColumn<uChar> flagCol(tab, "FLAGTRA"); 1398 for (int i=0; i<int(tab.nrow()); ++i) { 1399 Vector<Float> spec = specCol(i); 1400 Vector<uChar> flag = flagCol(i); 1401 Int lag = Int(spec.nelements()*abs(inc)/frequency); 1402 for (int k=0; k < flag.nelements(); ++k ) { 1403 if (flag[k] > 0) { 1404 spec[k] = 0.0; 1405 } 1406 } 1407 Vector<Complex> lags; 1408 ffts.fft(lags, spec); 1409 Int start = max(0, lag-width); 1410 Int end = min(Int(lags.nelements()-1), lag+width); 1411 if (start == end) { 1412 lags[start] = Complex(0.0); 1413 } else { 1414 for (int j=start; j <=end ;++j) { 1415 lags[j] = Complex(0.0); 1416 } 1417 } 1418 ffts.fft(spec, lags); 1419 specCol.put(i, spec); 1420 } 1421 ++iter; 1422 } 1423 return out; 1424 } -
trunk/src/STMath.h
r1145 r1192 184 184 const std::string& srctype = "on"); 185 185 186 /** 187 * "hard" flag the data, this flags everything selected in setSelection() 188 * @param frequency the frequency to remove 189 * @param width the number of lags to flag left to the side of the frequency 190 */ 191 casa::CountedPtr<Scantable> 192 lagFlag( const casa::CountedPtr<Scantable>& in, double frequency, 193 int width); 194 186 195 private: 187 196 casa::CountedPtr<Scantable> applyToPol( const casa::CountedPtr<Scantable>& in, -
trunk/src/STMathWrapper.h
r1145 r1192 156 156 { return ScantableWrapper(STMath::mxExtract(in.getCP(),scantype)); } 157 157 158 ScantableWrapper lagFlag( const ScantableWrapper& in, 159 double frequency, int width ) 160 { return ScantableWrapper(STMath::lagFlag(in.getCP(), frequency, width)); } 161 158 162 }; 159 163 -
trunk/src/python_STMath.cpp
r1145 r1192 67 67 .def("_freq_align", &STMathWrapper::frequencyAlign) 68 68 .def("_mx_extract", &STMathWrapper::mxExtract) 69 .def("_lag_flag", &STMathWrapper::lagFlag) 69 70 ; 70 71 };
Note:
See TracChangeset
for help on using the changeset viewer.