Changeset 1192 for trunk/src/STMath.cpp
- Timestamp:
- 08/28/06 16:33:58 (18 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.