Changeset 1333 for trunk/src/STMath.cpp


Ignore:
Timestamp:
04/18/07 16:18:40 (17 years ago)
Author:
mar637
Message:

Fix for Ticket #104; protect the user from flagging the whole scantable. This has performance penalties.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r1321 r1333  
    137137  ROScalarColumn<Double> mjdCol, intCol;
    138138  ROScalarColumn<Int> scanIDCol;
     139
     140  Vector<uInt> rowstodelete;
    139141
    140142  for (uInt i=0; i < tout.nrow(); ++i) {
     
    180182      }
    181183    }
     184    const Vector<Bool>& msk = acc.getMask();
     185    if ( allEQ(msk, False) ) {
     186      uint n = rowstodelete.nelements();
     187      rowstodelete.resize(n+1, True);
     188      rowstodelete[n] = i;
     189      continue;
     190    }
     191    cout << "write "<<  i << endl;
    182192    //write out
    183     specColOut.put(i, acc.getSpectrum());
    184     const Vector<Bool>& msk = acc.getMask();
    185193    Vector<uChar> flg(msk.shape());
    186194    convertArray(flg, !msk);
    187195    flagColOut.put(i, flg);
     196    specColOut.put(i, acc.getSpectrum());
    188197    tsysColOut.put(i, acc.getTsys());
    189198    intColOut.put(i, acc.getInterval());
     
    194203    cycColOut.put(i, uInt(0));
    195204    acc.reset();
     205  }
     206  if (rowstodelete.nelements() > 0) {
     207    cout << rowstodelete << endl;
     208    tout.removeRow(rowstodelete);
     209    if (tout.nrow() == 0) {
     210      throw(AipsError("Can't average fully flagged data."));
     211    }
    196212  }
    197213  return out;
Note: See TracChangeset for help on using the changeset viewer.