Changeset 3010
- Timestamp:
- 10/31/14 21:26:51 (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r3008 r3010 959 959 statunit= '' 960 960 if getchan: 961 qx, qy = self.chan2data(rowno=i, chan=chan[i]) 962 if rtnabc: 963 statvals.append(qx['value']) 964 refstr = ('(value: %'+form) % (qy['value'])+' ['+qy['unit']+'])' 965 statunit= '['+qx['unit']+']' 961 if self._is_all_chan_flagged(i): 962 if rtnabc: 963 statvals.append(None) 966 964 else: 967 refstr = ('(@ %'+form) % (qx['value'])+' ['+qx['unit']+'])' 968 969 if skip_flaggedrow and self._getflagrow(i): 970 statvals[i] = None 971 continue 965 qx, qy = self.chan2data(rowno=i, chan=chan[i]) 966 if rtnabc: 967 statvals.append(qx['value']) 968 refstr = ('(value: %'+form) % (qy['value'])+' ['+qy['unit']+'])' 969 statunit= '['+qx['unit']+']' 970 else: 971 refstr = ('(@ %'+form) % (qx['value'])+' ['+qx['unit']+'])' 972 973 if self._is_all_chan_flagged(i): 974 if not rtnabc: 975 statvals[i] = None 976 if skip_flaggedrow: 977 continue 972 978 973 979 tm = self._gettime(i) … … 981 987 if len(rows) > 1: 982 988 # out += ('= %'+form) % (outvec[i]) +' '+refstr+'\n' 983 out += ('= %'+form) % (statvals[i]) +' '+refstr+'\n' 989 if statvals[i] is None: 990 out += ('= None(flagged)') + ' '+refstr+'\n' 991 else: 992 out += ('= %'+form) % (statvals[i]) +' '+refstr+'\n' 984 993 else: 985 994 # out += ('= %'+form) % (outvec[0]) +' '+refstr+'\n' 986 out += ('= %'+form) % (statvals[0]) +' '+refstr+'\n' 995 if statvals[0] is None: 996 out += ('= None(flagged)') + ' '+refstr+'\n' 997 else: 998 out += ('= %'+form) % (statvals[0]) +' '+refstr+'\n' 987 999 out += sep+"\n" 988 1000 … … 1005 1017 asaplog.push(''.join(x), False) 1006 1018 1019 if skip_flaggedrow: 1020 nstatvals = len(statvals) 1021 for i in reversed(xrange(nstatvals)): 1022 if statvals[i] is None: 1023 del statvals[i] 1007 1024 return statvals 1008 1025 -
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.