Changeset 2539 for branches/hpc33/src
- Timestamp:
- 05/20/12 17:05:33 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/src/STMath.cpp
r2534 r2539 83 83 const std::string& avmode) 84 84 { 85 // double t0, t1 ; 86 // t0 = mathutil::gettimeofday_sec() ; 87 85 88 LogIO os( LogOrigin( "STMath", "average()", WHERE ) ) ; 86 89 if ( avmode == "SCAN" && in.size() != 1 ) … … 131 134 const Table& baset = in[0]->table(); 132 135 136 RowAccumulator acc(wtype); 137 Vector<Bool> cmask(mask); 138 acc.setUserMask(cmask); 139 ROTableRow row(tout); 140 ROArrayColumn<Float> specCol, tsysCol; 141 ROArrayColumn<uChar> flagCol; 142 ROScalarColumn<Double> mjdCol, intCol; 143 ROScalarColumn<Int> scanIDCol; 144 145 Vector<uInt> rowstodelete; 146 133 147 Block<String> cols(3); 134 148 cols[0] = String("BEAMNO"); … … 158 172 scanColOut.put(outrowCount, uInt(0)); 159 173 } 174 /* 160 175 ++outrowCount; 176 */ 161 177 // 2012/02/17 TN 162 178 // Since STGrid is implemented, average doesn't consider direction … … 198 214 // } 199 215 // outrowCount += rowNum ; 216 /* 200 217 ++iter; 201 218 } … … 210 227 211 228 Vector<uInt> rowstodelete; 212 213 for (uInt i=0; i < tout.nrow(); ++i) { 214 for ( int j=0; j < int(in.size()); ++j ) { 229 */ 230 231 // merge loop 232 uInt i = outrowCount ; 233 // for (uInt i=0; i < tout.nrow(); ++i) { 234 235 // in[0] is already selected by TableItertor 236 specCol.attach(subt,"SPECTRA"); 237 flagCol.attach(subt,"FLAGTRA"); 238 tsysCol.attach(subt,"TSYS"); 239 intCol.attach(subt,"INTERVAL"); 240 mjdCol.attach(subt,"TIME"); 241 Vector<Float> spec,tsys; 242 Vector<uChar> flag; 243 Double inter,time; 244 for (uInt k = 0; k < subt.nrow(); ++k ) { 245 flagCol.get(k, flag); 246 Vector<Bool> bflag(flag.shape()); 247 convertArray(bflag, flag); 248 /* 249 if ( allEQ(bflag, True) ) { 250 continue;//don't accumulate 251 } 252 */ 253 specCol.get(k, spec); 254 tsysCol.get(k, tsys); 255 intCol.get(k, inter); 256 mjdCol.get(k, time); 257 // spectrum has to be added last to enable weighting by the other values 258 acc.add(spec, !bflag, tsys, inter, time); 259 } 260 261 // If there exists a channel at which all the input spectra are masked, 262 // spec has 'nan' values for that channel and it may affect the following 263 // processes. To avoid this, replacing 'nan' values in spec with 264 // weighted-mean of all spectra in the following line. 265 // (done for CAS-2776, 2011/04/07 by Wataru Kawasaki) 266 acc.replaceNaN(); 267 268 // in[0] is already selected by TableIterator so that it is not necessary to process 269 // in[0] here 270 //for ( int j=0; j < int(in.size()); ++j ) { 271 for ( int j=1; j < int(in.size()); ++j ) { 215 272 const Table& tin = in[j]->table(); 216 273 const TableRecord& rec = row.get(i); … … 231 288 && tin.col("POLNO") == Int(rec.asuInt("POLNO")) ); 232 289 #endif 233 Table subt;290 // Table subt; 234 291 if ( avmode == "SOURCE") { 235 292 subt = basesubt( basesubt.col("SRCNAME") == rec.asString("SRCNAME")); … … 329 386 } 330 387 acc.reset(); 388 389 // merge with while loop for preparing out table 390 ++outrowCount; 391 ++iter ; 331 392 } 332 393 … … 338 399 } 339 400 } 401 402 // t1 = mathutil::gettimeofday_sec() ; 403 // cout << "elapsed time for average(): " << t1-t0 << " sec" << endl ; 404 340 405 return out; 341 406 } … … 3861 3926 } 3862 3927 else { 3863 //double t0, t1 ;3864 //t0 = mathutil::gettimeofday_sec() ;3928 // double t0, t1 ; 3929 // t0 = mathutil::gettimeofday_sec() ; 3865 3930 vector<bool> masks = s->getMask( 0 ) ; 3866 3931 … … 3919 3984 soff->scanCol_.putColumn( newscanno ) ; 3920 3985 // cout << "new scancol = " << soff->scanCol_.getColumn() << endl ; 3921 // 3986 // double t2 = mathutil::gettimeofday_sec() ; 3922 3987 vector< CountedPtr<Scantable> > tmp( 1, soff ) ; 3923 3988 CountedPtr<Scantable> aoff = average( tmp, masks, "TINT", "SCAN" ) ; 3924 //double t3 = mathutil::gettimeofday_sec() ;3989 // double t3 = mathutil::gettimeofday_sec() ; 3925 3990 //cout << "aoff.nrow = " << aoff->nrow() << endl ; 3926 3991 s->unsetSelection() ; 3927 3992 sel.reset() ; 3928 //t1 = mathutil::gettimeofday_sec() ;3929 //cout << "elapsed time for off averaging: " << t1-t0 << " sec" << endl ;3930 //cout << " elapsed time for average(): " << t3-t2 << " sec" << endl ;3993 // t1 = mathutil::gettimeofday_sec() ; 3994 // cout << "elapsed time for off averaging: " << t1-t0 << " sec" << endl ; 3995 // cout << " elapsed time for average(): " << t3-t2 << " sec" << endl ; 3931 3996 3932 3997 // on scan 3933 //t0 = mathutil::gettimeofday_sec() ;3998 // t0 = mathutil::gettimeofday_sec() ; 3934 3999 bool insitu = insitu_ ; 3935 4000 insitu_ = false ; … … 3942 4007 s->unsetSelection() ; 3943 4008 sel.reset() ; 3944 //t1 = mathutil::gettimeofday_sec() ;3945 //cout << "elapsed time for preparing output table: " << t1-t0 << " sec" << endl ;4009 // t1 = mathutil::gettimeofday_sec() ; 4010 // cout << "elapsed time for preparing output table: " << t1-t0 << " sec" << endl ; 3946 4011 3947 4012 // process each on scan 3948 //t0 = mathutil::gettimeofday_sec() ;4013 // t0 = mathutil::gettimeofday_sec() ; 3949 4014 // for ( int i = 0 ; i < out->nrow() ; i++ ) { 3950 4015 // vector<float> sp = getCalibratedSpectra( out, aoff, i ) ; … … 3975 4040 delete iter ; 3976 4041 3977 //t1 = mathutil::gettimeofday_sec() ;3978 //cout << "elapsed time for calibration: " << t1-t0 << " sec" << endl ;4042 // t1 = mathutil::gettimeofday_sec() ; 4043 // cout << "elapsed time for calibration: " << t1-t0 << " sec" << endl ; 3979 4044 3980 4045 // flux unit
Note:
See TracChangeset
for help on using the changeset viewer.