Changeset 1514 for branches/alma/src/STMath.cpp
- Timestamp:
- 02/23/09 20:55:35 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/src/STMath.cpp
r1459 r1514 1093 1093 } 1094 1094 out.push_back(outstat); 1095 } 1096 return out; 1097 } 1098 1099 std::vector< int > STMath::minMaxPos( const CountedPtr< Scantable > & in, 1100 const std::vector< bool > & mask, 1101 const std::string& which ) 1102 { 1103 1104 Vector<Bool> m(mask); 1105 const Table& tab = in->table(); 1106 ROArrayColumn<Float> specCol(tab, "SPECTRA"); 1107 ROArrayColumn<uChar> flagCol(tab, "FLAGTRA"); 1108 std::vector<int> out; 1109 for (uInt i=0; i < tab.nrow(); ++i ) { 1110 Vector<Float> spec; specCol.get(i, spec); 1111 Vector<uChar> flag; flagCol.get(i, flag); 1112 MaskedArray<Float> ma = maskedArray(spec, flag); 1113 if (ma.ndim() != 1) { 1114 throw (ArrayError( 1115 "std::vector<int> STMath::minMaxPos(" 1116 "ContedPtr<Scantable> &in, std::vector<bool> &mask, " 1117 " std::string &which)" 1118 " - MaskedArray is not 1D")); 1119 } 1120 IPosition outpos(1,0); 1121 if ( spec.nelements() == m.nelements() ) { 1122 outpos = mathutil::minMaxPos(which, ma(m)); 1123 } else { 1124 outpos = mathutil::minMaxPos(which, ma); 1125 } 1126 out.push_back(outpos[0]); 1095 1127 } 1096 1128 return out;
Note: See TracChangeset
for help on using the changeset viewer.