Commits
2338 2338 | Cube<Float> wtc; |
2339 2339 | if (doWtSp) |
2340 2340 | // WS available [nCorr,nChan,nRow] |
2341 2341 | wtc.reference(vb->weightSpectrum()); |
2342 2342 | else { |
2343 2343 | // WS UNavailable weight()[nCorr,nRow] --> [nCorr,nChan,nRow] |
2344 2344 | wtc.reference(vb->weight().reform(IPosition(3,nCorr,1,nRow))); // unchan'd weight as single-chan |
2345 2345 | } |
2346 2346 | Int nChanWt=wtc.shape()(1); // Might be 1 (no WtSp) |
2347 2347 | |
2348 - | Array<Bool> flagCube(vb->flagCube()); |
2349 - | VectorIterator<Bool> flagiter(flagCube); |
2348 + | Cube<Bool> flagCube(vb->flagCube()); |
2350 2349 | for (Int row=0; row<nRow; row++) { |
2351 2350 | if (!rowFlags(row) && a1(row)!=a2(row)) { // exclude ACs |
2352 2351 | |
2353 2352 | for (Int ich=0;ich<vb->nChannels();++ich) { |
2354 - | Vector<Bool> thisflag(flagiter.vector()); |
2355 - | //if(!flag(ich,row)&&(iNatWt>0.0)) { |
2356 - | if(ntrue(thisflag)==0) { // all correlations UNflagged, this row, ich |
2353 + | if( !flagCube(0,ich,row) && !flagCube(nCorr-1,ich,row)) { // p-hands unflagged |
2357 2354 | |
2358 2355 | // Accumulate relevant info |
2359 2356 | |
2360 2357 | // Simple sum of p-hand for now |
2361 2358 | iNatWt=wtc(0,ich%nChanWt,row)+wtc(nCorr-1,ich%nChanWt,row); |
2362 2359 | |
2363 2360 | iGridWt=2.0f*vb->imagingWeight()(ich,row); |
2364 - | sumNatWt+=(iNatWt); |
2365 - | sumGridWt+=(iGridWt); |
2366 - | sumGridWt2OverNatWt+=(iGridWt*iGridWt/iNatWt); |
2361 + | |
2362 + | if (iGridWt>0.0 && iNatWt>0.0) { |
2363 + | sumNatWt+=(iNatWt); |
2364 + | sumGridWt+=(iGridWt); |
2365 + | sumGridWt2OverNatWt+=(iGridWt*iGridWt/iNatWt); |
2366 + | } |
2367 2367 | } |
2368 - | flagiter.next(); // Add trap for pastEnd? |
2369 2368 | } |
2370 2369 | } |
2371 2370 | } // row |
2372 - | |
2373 2371 | } // vb |
2374 2372 | } // chunks |
2375 2373 | |
2376 2374 | if (sumNatWt==0.0) { |
2377 2375 | os << "Cannot calculate sensitivity: sum of selected natural weights is zero" << LogIO::EXCEPTION; |
2378 2376 | } |
2379 2377 | if (sumGridWt==0.0) { |
2380 2378 | os << "Cannot calculate sensitivity: sum of gridded weights is zero" << LogIO::EXCEPTION; |
2381 2379 | } |
2382 2380 | |