Changeset 3010 for trunk/src


Ignore:
Timestamp:
10/31/14 21:26:51 (10 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue: Yes CAS-6599

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sd

Description: modified so that sd.scantable.stats() returns None for flagged rows and rows with all channels flagged.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r2986 r3010  
    1111//
    1212
     13//#include <math.h>
     14//#include <bits/nan.h>
    1315#include <sstream>
    1416#include <iostream>
     
    19931995                                        const std::string& which )
    19941996{
    1995 
    19961997  Vector<Bool> m(mask);
    19971998  const Table& tab = in->table();
     
    19992000  ROArrayColumn<uChar> flagCol(tab, "FLAGTRA");
    20002001  std::vector<float> out;
    2001   for (uInt i=0; i < tab.nrow(); ++i ) {
    2002     Vector<Float> spec; specCol.get(i, spec);
    2003     Vector<uChar> flag; flagCol.get(i, flag);
    2004     MaskedArray<Float> ma  = maskedArray(spec, flag);
    2005     float outstat = 0.0;
    2006     if ( spec.nelements() == m.nelements() ) {
    2007       outstat = mathutil::statistics(which, ma(m));
     2002  for (uInt i = 0; i < tab.nrow(); ++i) {
     2003    if (in->isAllChannelsFlagged(i)) {
     2004      out.push_back(NAN);
    20082005    } else {
    2009       outstat = mathutil::statistics(which, ma);
    2010     }
    2011     out.push_back(outstat);
     2006      float outstat = 0.0;
     2007      Vector<Float> spec; specCol.get(i, spec);
     2008      Vector<uChar> flag; flagCol.get(i, flag);
     2009      MaskedArray<Float> ma  = maskedArray(spec, flag);
     2010      if (spec.nelements() == m.nelements()) {
     2011        outstat = mathutil::statistics(which, ma(m));
     2012      } else {
     2013        outstat = mathutil::statistics(which, ma);
     2014      }
     2015      out.push_back(outstat);
     2016    }
    20122017  }
    20132018  return out;
     
    20512056  std::vector<int> out;
    20522057  for (uInt i=0; i < tab.nrow(); ++i ) {
    2053     Vector<Float> spec; specCol.get(i, spec);
    2054     Vector<uChar> flag; flagCol.get(i, flag);
    2055     MaskedArray<Float> ma  = maskedArray(spec, flag);
    2056     if (ma.ndim() != 1) {
    2057       throw (ArrayError(
    2058           "std::vector<int> STMath::minMaxChan("
    2059           "ContedPtr<Scantable> &in, std::vector<bool> &mask, "
    2060           " std::string &which)"
    2061           " - MaskedArray is not 1D"));
    2062     }
    2063     IPosition outpos(1,0);
    2064     if ( spec.nelements() == m.nelements() ) {
    2065       outpos = mathutil::minMaxPos(which, ma(m));
     2058    if (in->isAllChannelsFlagged(i)) {
     2059      out.push_back(NAN);
    20662060    } else {
    2067       outpos = mathutil::minMaxPos(which, ma);
    2068     }
    2069     out.push_back(outpos[0]);
     2061      Vector<Float> spec; specCol.get(i, spec);
     2062      Vector<uChar> flag; flagCol.get(i, flag);
     2063      MaskedArray<Float> ma  = maskedArray(spec, flag);
     2064      if (ma.ndim() != 1) {
     2065        throw (ArrayError(
     2066                          "std::vector<int> STMath::minMaxChan("
     2067                          "ContedPtr<Scantable> &in, std::vector<bool> &mask, "
     2068                          " std::string &which)"
     2069                          " - MaskedArray is not 1D"));
     2070      }
     2071      IPosition outpos(1,0);
     2072      if ( spec.nelements() == m.nelements() ) {
     2073        outpos = mathutil::minMaxPos(which, ma(m));
     2074      } else {
     2075        outpos = mathutil::minMaxPos(which, ma);
     2076      }
     2077      out.push_back(outpos[0]);
     2078    }
    20702079  }
    20712080  return out;
  • trunk/src/Scantable.cpp

    r3009 r3010  
    50045004  lineFinder.setData(getSpectrum(whichrow));
    50055005  lineFinder.findLines(getCompositeChanMask(whichrow, inMask), currEdge, whichrow);
    5006 
    50075006  return lineFinder.getMask();
    50085007}
Note: See TracChangeset for help on using the changeset viewer.