- Timestamp:
- 10/31/14 21:26:51 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r2986 r3010 11 11 // 12 12 13 //#include <math.h> 14 //#include <bits/nan.h> 13 15 #include <sstream> 14 16 #include <iostream> … … 1993 1995 const std::string& which ) 1994 1996 { 1995 1996 1997 Vector<Bool> m(mask); 1997 1998 const Table& tab = in->table(); … … 1999 2000 ROArrayColumn<uChar> flagCol(tab, "FLAGTRA"); 2000 2001 std::vector<float> out; 2001 for (uInt i=0; i < tab.nrow(); ++i ) { 2002 Vector<Float> spec; specCol.get(i, spec); 2003 Vector<uChar> flag; flagCol.get(i, flag); 2004 MaskedArray<Float> ma = maskedArray(spec, flag); 2005 float outstat = 0.0; 2006 if ( spec.nelements() == m.nelements() ) { 2007 outstat = mathutil::statistics(which, ma(m)); 2002 for (uInt i = 0; i < tab.nrow(); ++i) { 2003 if (in->isAllChannelsFlagged(i)) { 2004 out.push_back(NAN); 2008 2005 } else { 2009 outstat = mathutil::statistics(which, ma); 2010 } 2011 out.push_back(outstat); 2006 float outstat = 0.0; 2007 Vector<Float> spec; specCol.get(i, spec); 2008 Vector<uChar> flag; flagCol.get(i, flag); 2009 MaskedArray<Float> ma = maskedArray(spec, flag); 2010 if (spec.nelements() == m.nelements()) { 2011 outstat = mathutil::statistics(which, ma(m)); 2012 } else { 2013 outstat = mathutil::statistics(which, ma); 2014 } 2015 out.push_back(outstat); 2016 } 2012 2017 } 2013 2018 return out; … … 2051 2056 std::vector<int> out; 2052 2057 for (uInt i=0; i < tab.nrow(); ++i ) { 2053 Vector<Float> spec; specCol.get(i, spec); 2054 Vector<uChar> flag; flagCol.get(i, flag); 2055 MaskedArray<Float> ma = maskedArray(spec, flag); 2056 if (ma.ndim() != 1) { 2057 throw (ArrayError( 2058 "std::vector<int> STMath::minMaxChan(" 2059 "ContedPtr<Scantable> &in, std::vector<bool> &mask, " 2060 " std::string &which)" 2061 " - MaskedArray is not 1D")); 2062 } 2063 IPosition outpos(1,0); 2064 if ( spec.nelements() == m.nelements() ) { 2065 outpos = mathutil::minMaxPos(which, ma(m)); 2058 if (in->isAllChannelsFlagged(i)) { 2059 out.push_back(NAN); 2066 2060 } else { 2067 outpos = mathutil::minMaxPos(which, ma); 2068 } 2069 out.push_back(outpos[0]); 2061 Vector<Float> spec; specCol.get(i, spec); 2062 Vector<uChar> flag; flagCol.get(i, flag); 2063 MaskedArray<Float> ma = maskedArray(spec, flag); 2064 if (ma.ndim() != 1) { 2065 throw (ArrayError( 2066 "std::vector<int> STMath::minMaxChan(" 2067 "ContedPtr<Scantable> &in, std::vector<bool> &mask, " 2068 " std::string &which)" 2069 " - MaskedArray is not 1D")); 2070 } 2071 IPosition outpos(1,0); 2072 if ( spec.nelements() == m.nelements() ) { 2073 outpos = mathutil::minMaxPos(which, ma(m)); 2074 } else { 2075 outpos = mathutil::minMaxPos(which, ma); 2076 } 2077 out.push_back(outpos[0]); 2078 } 2070 2079 } 2071 2080 return out; -
trunk/src/Scantable.cpp
r3009 r3010 5004 5004 lineFinder.setData(getSpectrum(whichrow)); 5005 5005 lineFinder.findLines(getCompositeChanMask(whichrow, inMask), currEdge, whichrow); 5006 5007 5006 return lineFinder.getMask(); 5008 5007 }
Note:
See TracChangeset
for help on using the changeset viewer.