Changeset 2974 for trunk/src


Ignore:
Timestamp:
07/09/14 20:22:49 (10 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue: Yes CAS-6594

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: test_sdmath

Put in Release Notes: No

Module(s): sd

Description: modified STMath::binaryOperate() so that:

(1) If one of or both spectra are row-flagged,

operation will be skipped so the 'left'
spectrum values are not modified, while
the FLAGROW of the output spectrum will
be set flagged.

(2) Otherwise, operation is executed for all

channels even if there are masked ones.
If a channel is flagged in one of or both
spectra, operation is done for that channel
but the channel is flagged.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r2959 r2974  
    927927  ArrayColumn<uChar> lflagCol(tmpl,"FLAGTRA");
    928928  ROArrayColumn<uChar> rflagCol(tmpr,"FLAGTRA");
     929  ScalarColumn<uInt> lflagrowCol(tmpl,"FLAGROW");
     930  ROScalarColumn<uInt> rflagrowCol(tmpr,"FLAGROW");
    929931
    930932  for (uInt i=0; i<tout.nrow(); ++i) {
     933    uInt lflagrow, rflagrow;
     934    lflagrow = lflagrowCol(i); rflagrow = rflagrowCol(i);
     935    //-------
     936    if ((lflagrow > 0)||(rflagrow > 0)) {
     937      lflagrowCol.put(i, uInt(1));
     938      continue;
     939    }
    931940    Vector<Float> lspecvec, rspecvec;
    932941    Vector<uChar> lflagvec, rflagvec;
    933942    lspecvec = lspecCol(i);    rspecvec = rspecCol(i);
    934943    lflagvec = lflagCol(i);    rflagvec = rflagCol(i);
     944    Vector<uChar> outflagvec = lflagCol(i);
     945    //-------
     946    for (uInt j = 0; j < outflagvec.nelements(); ++j) {
     947      uChar outflag = 0 << 7;
     948      if ((lflagvec(j) == 1 << 7) || (rflagvec(j) == 1 << 7)) {
     949        outflag = 1 << 7;
     950      }
     951      outflagvec(j) = outflag;
     952    }
     953    lflagvec = 0 << 7;
     954    rflagvec = 0 << 7;
     955    //-------
    935956    MaskedArray<Float> mleft = maskedArray(lspecvec, lflagvec);
    936957    MaskedArray<Float> mright = maskedArray(rspecvec, rflagvec);
     
    947968    }
    948969    lspecCol.put(i, mleft.getArray());
     970    //-----
     971    lflagCol.put(i, outflagvec);
     972    //-----
    949973  }
    950974  return out;
Note: See TracChangeset for help on using the changeset viewer.