Changeset 3023
- Timestamp:
- 02/09/15 15:48:01 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r3018 r3023 2552 2552 if (rflag > 0) 2553 2553 return true; 2554 uCharflag;2554 bool flag; 2555 2555 Vector<uChar> flags; 2556 2556 flagsCol_.get(whichrow, flags); 2557 flag = flags[0];2557 flag = (flags[0]>0); 2558 2558 for (uInt i = 1; i < flags.size(); ++i) { 2559 flag &= flags[i];2559 flag &= (flags[i]>0); 2560 2560 } 2561 2561 // return ((flag >> 7) == 1); 2562 2562 return (flag > 0); 2563 2563 } 2564 2565 std::size_t Scantable::nValidMask(const std::vector<bool>& mask) 2566 { 2567 std::size_t nvalid=0; 2568 assert(static_cast<std::size_t>(true)==1); 2569 assert(static_cast<std::size_t>(false)==0); 2570 for (uInt i = 1; i < mask.size(); ++i) { 2571 nvalid += static_cast<std::size_t>(mask[i]); 2572 } 2573 return nvalid; 2574 } 2575 2564 2576 2565 2577 std::vector<std::string> Scantable::applyBaselineTable(const std::string& bltable, const bool returnfitresult, const std::string& outbltable, const bool outbltableexists, const bool overwrite) … … 3051 3063 std::vector<float> params; 3052 3064 3053 if (flagrowCol_(whichrow) == 0) { 3065 //if (flagrowCol_(whichrow) == 0) { 3066 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 3054 3067 int nClipped = 0; 3055 3068 std::vector<float> res; … … 3144 3157 std::vector<float> params; 3145 3158 3146 if (flagrowCol_(whichrow) == 0) { 3159 //if (flagrowCol_(whichrow) == 0) { 3160 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 3147 3161 int nClipped = 0; 3148 3162 std::vector<float> res; … … 3229 3243 std::vector<float> params; 3230 3244 3231 if (flagrowCol_(whichrow) == 0) { 3245 // if (flagrowCol_(whichrow) == 0) { 3246 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 3232 3247 int nClipped = 0; 3233 3248 std::vector<float> res; … … 3322 3337 std::vector<float> params; 3323 3338 3324 if (flagrowCol_(whichrow) == 0) { 3339 // if (flagrowCol_(whichrow) == 0) { 3340 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 3325 3341 int nClipped = 0; 3326 3342 std::vector<float> res; … … 3911 3927 std::vector<float> params; 3912 3928 3913 if (flagrowCol_(whichrow) == 0) { 3929 //if (flagrowCol_(whichrow) == 0) { 3930 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 3914 3931 int nClipped = 0; 3915 3932 std::vector<float> res; … … 4009 4026 std::vector<float> params; 4010 4027 4011 if (flagrowCol_(whichrow) == 0) { 4028 //if (flagrowCol_(whichrow) == 0) { 4029 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 4012 4030 int nClipped = 0; 4013 4031 std::vector<float> res; … … 4690 4708 std::vector<float> params; 4691 4709 4692 if (flagrowCol_(whichrow) == 0) { 4710 //if (flagrowCol_(whichrow) == 0) { 4711 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 4693 4712 int nClipped = 0; 4694 4713 std::vector<float> res; … … 4799 4818 std::vector<float> params; 4800 4819 4801 if (flagrowCol_(whichrow) == 0) { 4820 //if (flagrowCol_(whichrow) == 0) { 4821 if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) { 4802 4822 int nClipped = 0; 4803 4823 std::vector<float> res; … … 4976 4996 STLineFinder& lineFinder) 4977 4997 { 4998 if (isAllChannelsFlagged(whichrow)) {//all channels flagged 4999 std::vector<bool> res_mask(inMask.size(),false); 5000 return res_mask; 5001 } else if (nValidMask(inMask)==0){ //no valid mask channels 5002 std::vector<bool> res_mask(inMask); 5003 return res_mask; 5004 } 5005 4978 5006 std::vector<uint> ifNos = getIFNos(); 4979 5007 if ((edge.size() > 2) && (edge.size() < ifNos.size()*2)) { -
trunk/src/Scantable.h
r2969 r3023 724 724 725 725 std::vector<uint> getNumbers(const casa::ScalarColumn<casa::uInt>& col) const; 726 727 /** 728 * Returns a number of elements with "true" in a bool vector. 729 * @param[in] mask (boolean vector) 730 * @return the numerb of elements in true 731 */ 732 std::size_t nValidMask(const std::vector<bool>& mask); 726 733 727 734 static const casa::uInt version_ = 4;
Note:
See TracChangeset
for help on using the changeset viewer.