Changeset 745


Ignore:
Timestamp:
11/28/05 15:25:18 (18 years ago)
Author:
mar637
Message:

removed setmask functionality

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r717 r745  
    7575  IFSel_(0),
    7676  beamSel_(0),
    77   polSel_(0) 
     77  polSel_(0)
    7878{
    7979  setup();
     
    105105    beamSel_= 0;
    106106    polSel_= 0;
    107     chanMask_.resize(0);
    108107  } else {
    109108    IFSel_= other.IFSel_;
    110109    beamSel_= other.beamSel_;
    111110    polSel_= other.polSel_;
    112     chanMask_.resize(0);
    113     chanMask_ = other.chanMask_;
    114111  }
    115112
     
    148145     beamSel_= other.beamSel_;
    149146     polSel_= other.polSel_;
    150      chanMask_.resize(0);
    151      chanMask_ = other.chanMask_;
    152147     table_ = other.table_.copyToMemoryTable(String("dummy"));
    153148     attach();
     
    199194  SDStokesEngine stokesEngine(String("STOKES"), String("SPECTRA"));
    200195  aNewTab.bindColumn("STOKES", stokesEngine);
    201  
     196
    202197  // Create Table
    203   table_ = Table(aNewTab, Table::Memory, 0); 
    204   // add subtable 
     198  table_ = Table(aNewTab, Table::Memory, 0);
     199  // add subtable
    205200  TableDesc tdf("", "1", TableDesc::Scratch);
    206201  tdf.addColumn(ArrayColumnDesc<String>("FUNCTIONS"));
     
    262257  if (showDate)
    263258    mvt.setFormat(MVTime::YMD);
    264   else 
     259  else
    265260    mvt.setFormat(MVTime::TIME);
    266261  ostringstream oss;
     
    303298}
    304299
    305 void SDMemTable::resetCursor() 
     300void SDMemTable::resetCursor()
    306301{
    307302   polSel_ = 0;
     
    310305}
    311306
    312 bool SDMemTable::setMask(std::vector<int> whichChans)
    313 {
    314   std::vector<int>::iterator it;
    315   uInt n = flagsCol_.shape(0)(3);
    316   if (whichChans.empty()) {
    317     chanMask_ = std::vector<bool>(n,true);
    318     return true;     
    319   }
    320   chanMask_.resize(n,true);
    321   for (it = whichChans.begin(); it != whichChans.end(); ++it) {
    322     if (*it < n) {
    323       chanMask_[*it] = false;
    324     }
    325   }
    326   return true;
    327 }
    328 
    329 std::vector<bool> SDMemTable::getMask(Int whichRow) const
     307std::vector<bool> SDMemTable::getMask(Int whichRow) const
    330308{
    331309
     
    342320  aa2.reset(aa2.begin(uInt(polSel_)));// go to pol
    343321
    344   Bool useUserMask = ( chanMask_.size() == arr.shape()(3) );
    345 
    346   std::vector<bool> tmp;
    347   tmp = chanMask_; // WHY the fxxx do I have to make a copy here
    348   std::vector<bool>::iterator miter;
    349   miter = tmp.begin();
    350 
    351322  for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) {
    352323    bool out =!static_cast<bool>(*i);
    353     if (useUserMask) {
    354       out = out && (*miter);
    355       miter++;
    356     }
    357324    mask.push_back(out);
    358325  }
     
    362329
    363330
    364 std::vector<float> SDMemTable::getSpectrum(Int whichRow) const 
     331std::vector<float> SDMemTable::getSpectrum(Int whichRow) const
    365332{
    366333  Array<Float> arr;
     
    376343
    377344
    378 std::vector<float> SDMemTable::getStokesSpectrum(Int whichRow, 
    379                                                 Bool doPol) const
     345std::vector<float> SDMemTable::getStokesSpectrum(Int whichRow,
     346                                                Bool doPol) const
    380347  //
    381348  // Gets one STokes parameter depending on cursor polSel location
     
    388355    throw (AipsError("You must have 1,2 or 4 polarizations to get the Stokes parameters"));
    389356  }
    390  
     357
    391358  // For full conversion we are only supporting linears at the moment
    392  
     359
    393360  if (nPol() > 2) {
    394361    String antName;
     
    403370  Array<Float> arr;
    404371  stokesCol_.get(whichRow, arr);
    405  
     372
    406373  if (doPol && (polSel_==1 || polSel_==2)) {       //   Q,U --> P, P.A.
    407    
     374
    408375    // Set current cursor location
    409    
     376
    410377    const IPosition& shape = arr.shape();
    411378    IPosition start, end;
    412379    getCursorSlice(start, end, shape);
    413    
     380
    414381    // Get Q and U slices
    415    
     382
    416383    Array<Float> Q = SDPolUtil::getStokesSlice(arr,start,end,"Q");
    417384    Array<Float> U = SDPolUtil::getStokesSlice(arr,start,end,"U");
    418    
    419     // Compute output 
    420    
     385
     386    // Compute output
     387
    421388    Array<Float> out;
    422389    if (polSel_==1) {                                        // P
     
    425392      out = SDPolUtil::positionAngle(Q,U);
    426393    }
    427    
     394
    428395    // Copy to output
    429    
     396
    430397    IPosition vecShape(1,shape(asap::ChanAxis));
    431398    Vector<Float> outV = out.reform(vecShape);
     
    433400    outV.tovector(stlout);
    434401    return stlout;
    435    
    436   } else {   
     402
     403  } else {
    437404    // Selects at the cursor location
    438405    return getFloatSpectrum(arr);
     
    440407}
    441408
    442 std::string SDMemTable::getPolarizationLabel(Bool linear, Bool stokes, 
    443                                               Bool linPol, Int polIdx) const
    444 {
    445    uInt idx = polSel_;   
     409std::string SDMemTable::getPolarizationLabel(Bool linear, Bool stokes,
     410                                              Bool linPol, Int polIdx) const
     411{
     412   uInt idx = polSel_;
    446413   if (polIdx >=0) idx = polIdx;
    447414   return SDPolUtil::polarizationLabel(idx, linear, stokes, linPol);
     
    450417
    451418
    452 std::vector<float> SDMemTable::stokesToPolSpectrum(Int whichRow, 
    453                                                    Bool toLinear,
    454                                                    Int polIdx) const
     419std::vector<float> SDMemTable::stokesToPolSpectrum(Int whichRow,
     420                                                   Bool toLinear,
     421                                                   Int polIdx) const
    455422//
    456423// polIdx
     
    489456      throw(AipsError("Only conversion to RR & LL is currently supported"));
    490457    }
    491    
    492     // Get I and V slices   
     458
     459    // Get I and V slices
    493460    Array<Float> I = SDPolUtil::getStokesSlice(arr,start,end,"I");
    494461    Array<Float> V = SDPolUtil::getStokesSlice(arr,start,end,"V");
    495    
    496     // Compute output     
     462
     463    // Compute output
    497464    out = SDPolUtil::circularPolarizationFromStokes(I, V, doRR);
    498465  }
    499  
     466
    500467  // Copy to output
    501468   IPosition vecShape(1,shape(asap::ChanAxis));
     
    521488
    522489  const IPosition& shape = arr.shape();
    523   IPosition start(shape.nelements(),0); 
     490  IPosition start(shape.nelements(),0);
    524491  IPosition end(shape-1);
    525492  if (iBeam!=-1) {
     
    587554  MFrequency::Types mdr;
    588555  if (!MFrequency::getType(mdr, rfrm)) {
    589    
     556
    590557    Int a,b;const uInt* c;
    591558    const String* valid = MFrequency::allMyTypes(a, b, c);
     
    662629  } else if (u == Unit("Hz")) {
    663630
    664     // Set world axis units   
     631    // Set world axis units
    665632    Vector<String> wau(1); wau = u.getName();
    666633    spc.setWorldAxisUnits(wau);
     
    689656  Vector<uInt> freqIDs;
    690657  freqidCol_.get(whichRow, freqIDs);
    691   uInt freqID = freqIDs(IFSel_); 
     658  uInt freqID = freqIDs(IFSel_);
    692659  restfreqidCol_.get(whichRow, freqIDs);
    693660  uInt restFreqID = freqIDs(IFSel_);
     
    697664
    698665  String s = "Channel";
    699   if (u == Unit("km/s")) { 
     666  if (u == Unit("km/s")) {
    700667    s = CoordinateUtil::axisLabel(spc,0,True,True,True);
    701668  } else if (u == Unit("Hz")) {
     
    789756*/
    790757
    791 MaskedArray<Float> SDMemTable::rowAsMaskedArray(uInt whichRow, 
    792                                                 Bool toStokes) const
     758MaskedArray<Float> SDMemTable::rowAsMaskedArray(uInt whichRow,
     759                                                Bool toStokes) const
    793760{
    794761  // Get flags
     
    871838SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt freqID) const
    872839{
    873  
     840
    874841  Table t = table_.keywordSet().asTable("FREQUENCIES");
    875842  if (freqID> t.nrow() ) {
     
    900867
    901868
    902 SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt freqID, 
    903                                                      uInt restFreqID,
     869SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt freqID,
     870                                                     uInt restFreqID,
    904871                                                     uInt whichRow) const
    905872{
    906  
     873
    907874  // Create basic SC
    908875  SpectralCoordinate spec = getSpectralCoordinate (freqID);
     
    989956  std::vector<double> stlout;
    990957  tvec.tovector(stlout);
    991   return stlout; 
     958  return stlout;
    992959}
    993960
     
    10651032  Vector<String> funcs;
    10661033  Vector<String> finfo;
    1067   Vector<Int> comps; 
     1034  Vector<Int> comps;
    10681035  ROArrayColumn<Double> parmsCol(t, "PARAMETERS");
    10691036  ROArrayColumn<Bool> parmaskCol(t, "PARMASK");
     
    11021069  Vector<String> funcs;
    11031070  Vector<String> finfo;
    1104   Vector<Int> comps;   
     1071  Vector<Int> comps;
    11051072  ROArrayColumn<Double> parmsCol(t, "PARAMETERS");
    11061073  ROArrayColumn<Bool> parmaskCol(t, "PARMASK");
     
    11301097
    11311098void SDMemTable::addFit(uInt whichRow,
    1132                         const Vector<Double>& p, const Vector<Bool>& m,
    1133                         const Vector<String>& f, const Vector<Int>& c)
     1099                        const Vector<Double>& p, const Vector<Bool>& m,
     1100                        const Vector<String>& f, const Vector<Int>& c)
    11341101{
    11351102  if (whichRow >= nRow()) {
     
    11371104  }
    11381105  Table t = table_.keywordSet().asTable("FITS");
    1139   uInt nrow = t.nrow(); 
     1106  uInt nrow = t.nrow();
    11401107  t.addRow();
    11411108  ArrayColumn<Double> parmsCol(t, "PARAMETERS");
     
    11541121  fitCol_.get(whichRow, fitarr);
    11551122
    1156   Array<Int> newarr;               // The new Array containing the fitid 
    1157   Int pos =-1;                     // The fitid position in the array 
     1123  Array<Int> newarr;               // The new Array containing the fitid
     1124  Int pos =-1;                     // The fitid position in the array
    11581125  if ( fitarr.nelements() == 0 ) { // no fits at all in this row
    11591126    Array<Int> arr(IPosition(4,nBeam(),nIF(),nPol(),1));
    11601127    arr = -1;
    11611128    newarr.reference(arr);
    1162     pos = 0;     
     1129    pos = 0;
    11631130  } else {
    11641131    IPosition shp = fitarr.shape();
     
    11721139    while (it != fits.end()) {
    11731140      if (*it == -1) {
    1174         pos = i;
    1175         break;
     1141        pos = i;
     1142        break;
    11761143      }
    11771144      ++i;
     
    11861153      newarr = fitarr;
    11871154  }
    1188   newarr(IPosition(4, beamSel_, IFSel_, polSel_, pos)) = Int(nrow); 
     1155  newarr(IPosition(4, beamSel_, IFSel_, polSel_, pos)) = Int(nrow);
    11891156  fitCol_.put(whichRow, newarr);
    11901157
     
    12181185  sdft.setRefFrame(baseFrame);
    12191186
    1220   // Equinox 
     1187  // Equinox
    12211188  Float equinox;
    12221189  t.keywordSet().get("EQUINOX", equinox);
     
    12831250  Array<Double> direction;
    12841251  Array<Int> fits;
    1285  
     1252
    12861253  specCol_.get(whichRow, spectrum);
    12871254  sdc.putSpectrum(spectrum);
     
    13441311}
    13451312void SDMemTable::makePersistent(const std::string& filename)
    1346 { 
     1313{
    13471314  table_.deepCopy(filename,Table::New);
    13481315
     
    13691336  if (x < 59.95)
    13701337    return  String("      ") + mvt.string(MVTime::TIME_CLEAN_NO_HM, 7)+"s";
    1371   else if (x < 3599.95) 
     1338  else if (x < 3599.95)
    13721339    return String("   ") + mvt.string(MVTime::TIME_CLEAN_NO_H,7)+" ";
    13731340  else {
     
    13761343    oss << ":" << mvt.string(MVTime::TIME_CLEAN_NO_H,7) << " ";
    13771344    return String(oss);
    1378   }   
     1345  }
    13791346};
    13801347
     
    14651432      << setw(24) << dirtype
    14661433      << setw(10) << "Time"
    1467       << setw(18) << "Integration" 
     1434      << setw(18) << "Integration"
    14681435      << setw(7) << "FreqIDs" << endl;
    14691436  oss << "--------------------------------------------------------------------------------" << endl;
    1470  
     1437
    14711438  // Generate list of scan start and end integrations
    14721439  Vector<Int> scanIDs = scanCol_.getColumn();
     
    14881455
    14891456    // Find all the FreqIDs in this scan
    1490     listFQ.resize(0);     
    1491     listRestFQ.resize(0);     
     1457    listFQ.resize(0);
     1458    listRestFQ.resize(0);
    14921459    for (uInt j=startInt(i); j<endInt(i)+1; j++) {
    14931460      freqidCol_.get(j, freqIDs);
    14941461      for (uInt k=0; k<freqIDs.nelements(); k++) {
    1495         mathutil::addEntry(listFQ, freqIDs(k));
     1462        mathutil::addEntry(listFQ, freqIDs(k));
    14961463      }
    14971464//
    14981465      restfreqidCol_.get(j, restFreqIDs);
    14991466      for (uInt k=0; k<restFreqIDs.nelements(); k++) {
    1500         mathutil::addEntry(listRestFQ, restFreqIDs(k));
     1467        mathutil::addEntry(listRestFQ, restFreqIDs(k));
    15011468      }
    15021469    }
     
    15041471    nInt = endInt(i) - startInt(i) + 1;
    15051472    oss << setw(3) << std::right << i << std::left << setw(2) << "  "
    1506         << setw(15) << name
    1507         << setw(24) << posit
    1508         << setw(10) << time
    1509         << setw(3) << std::right << nInt  << setw(3) << " x " << std::left
    1510         << setw(6) <<  tInt
    1511         << " " << listFQ << " " << listRestFQ << endl;
     1473        << setw(15) << name
     1474        << setw(24) << posit
     1475        << setw(10) << time
     1476        << setw(3) << std::right << nInt  << setw(3) << " x " << std::left
     1477        << setw(6) <<  tInt
     1478        << " " << listFQ << " " << listRestFQ << endl;
    15121479  }
    15131480  oss << endl;
    1514   oss << "Table contains " << table_.nrow() << " integration(s) in " 
     1481  oss << "Table contains " << table_.nrow() << " integration(s) in "
    15151482      << nScans << " scan(s)." << endl;
    15161483
     
    15241491    for (uInt i=0; i<sdft.length(); i++) {
    15251492      oss << setw(8) << i << setw(8)
    1526           << info[3] << setw(16) << setprecision(8)
    1527           << sdft.referenceValue(i) << setw(10)
    1528           << sdft.referencePixel(i) << setw(12)
    1529           << sdft.increment(i) << endl;
     1493          << info[3] << setw(16) << setprecision(8)
     1494          << sdft.referenceValue(i) << setw(10)
     1495          << sdft.referencePixel(i) << setw(12)
     1496          << sdft.increment(i) << endl;
    15301497    }
    15311498    oss << "--------------------------------------------------------------------------------" << endl;
     
    15861553{
    15871554  Table t = table_.rwKeywordSet().asTable("HISTORY");
    1588   uInt nrow = t.nrow(); 
     1555  uInt nrow = t.nrow();
    15891556  t.addRow();
    15901557  ScalarColumn<String> itemCol(t, "ITEM");
     
    15961563  Vector<String> history;
    15971564  const Table& t = table_.keywordSet().asTable("HISTORY");
    1598   uInt nrow = t.nrow(); 
     1565  uInt nrow = t.nrow();
    15991566  ROScalarColumn<String> itemCol(t, "ITEM");
    16001567  std::vector<std::string> stlout;
     
    16471614
    16481615MDirection::Types SDMemTable::getDirectionReference() const
    1649 { 
     1616{
    16501617  Float eq;
    16511618  table_.keywordSet().get("Equinox",eq);
     
    16541621  mp[1950.0] = "B1950";
    16551622  MDirection::Types mdr;
    1656   if (!MDirection::getType(mdr, mp[eq])) {   
     1623  if (!MDirection::getType(mdr, mp[eq])) {
    16571624    mdr = MDirection::J2000;
    16581625    pushLog("WARNING: Unknown equinox using J2000");
    1659    
     1626
    16601627  }
    16611628
     
    16771644
    16781645
    1679 Bool SDMemTable::setRestFreqs(const Vector<Double>& restFreqsIn, 
    1680                               const String& sUnit,
    1681                               const vector<string>& lines,
    1682                               const String& source,
    1683                               Int whichIF)
     1646Bool SDMemTable::setRestFreqs(const Vector<Double>& restFreqsIn,
     1647                              const String& sUnit,
     1648                              const vector<string>& lines,
     1649                              const String& source,
     1650                              Int whichIF)
    16841651{
    16851652   const Int nIFs = nIF();
     
    17071674            restFreqs[i] = lineFreq.getValue().getValue();          // Hz
    17081675         } else {
    1709             String s = String(lines[i]) + 
    1710               String(" is an unrecognized spectral line");
     1676            String s = String(lines[i]) +
     1677              String(" is an unrecognized spectral line");
    17111678            throw(AipsError(s));
    17121679         }
     
    17571724      for (uInt i=0; i<nRow; i++) {
    17581725         srcnCol_.get(i, srcName);
    1759          restfreqidCol_.get(i,restFreqIDs);       
     1726         restfreqidCol_.get(i,restFreqIDs);
    17601727         if (idx==-1) {
    1761            // Replace vector of restFreqs; one per IF.
    1762            // No selection possible
     1728           // Replace vector of restFreqs; one per IF.
     1729           // No selection possible
    17631730            for (uInt i=0; i<nIFs; i++) restFreqIDs[i] = i;
    17641731         } else {
    1765            // Set RestFreqID for selected data
     1732           // Set RestFreqID for selected data
    17661733            if (empty || source==srcName) {
    17671734               if (whichIF<0) {
    17681735                  restFreqIDs = idx;
    1769                } else {             
     1736               } else {
    17701737                  restFreqIDs[whichIF] = idx;
    17711738               }
    17721739            }
    17731740         }
    1774          restfreqidCol_.put(i,restFreqIDs);       
     1741         restfreqidCol_.put(i,restFreqIDs);
    17751742      }
    17761743      ok = True;
     
    18131780      // renumber
    18141781      scanCol_.put(i,newscanid);
    1815     } else { 
     1782    } else {
    18161783      ++newscanid;
    18171784      pIdx = cIdx;   // store scanid
     
    18231790
    18241791void SDMemTable::getCursorSlice(IPosition& start, IPosition& end,
    1825                                 const IPosition& shape) const
     1792                                const IPosition& shape) const
    18261793{
    18271794  const uInt nDim = shape.nelements();
    18281795  start.resize(nDim);
    18291796  end.resize(nDim);
    1830  
     1797
    18311798  start(asap::BeamAxis) = beamSel_;
    18321799  end(asap::BeamAxis) = beamSel_;
     
    18551822  ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1);
    18561823  aa2.reset(aa2.begin(uInt(polSel_)));                     // Pol selection
    1857  
     1824
    18581825  std::vector<float> spectrum;
    18591826  for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) {
  • trunk/src/SDMemTable.h

    r717 r745  
    4949
    5050namespace asap {
    51  
     51
    5252class SDContainer;
    5353class SDHeader;
     
    7171  SDMemTable(const casa::Table& tab, const std::string& expr);
    7272
    73   // Assignment operator (copy semantics) 
     73  // Assignment operator (copy semantics)
    7474  SDMemTable &operator=(const SDMemTable& other);
    75  
     75
    7676  virtual ~SDMemTable();
    7777
     
    8686  SDHeader getSDHeader() const;
    8787
    88   // Get SD Frequency table. 
     88  // Get SD Frequency table.
    8989  SDFrequencyTable getSDFreqTable() const;
    9090
     
    101101  // I,P,PA,V (doPol=True) (determined by the polSel cursor location
    102102  // 0->3) If the latter, you can add a PA offset (degrees)
    103   virtual std::vector<float> getStokesSpectrum(casa::Int whichRow=0, 
     103  virtual std::vector<float> getStokesSpectrum(casa::Int whichRow=0,
    104104                                               casa::Bool doPol=casa::False) const;
    105105
     
    108108  // label for raw correlations (linear or circular). If True returns
    109109  // label for Stokes.  If doPol=False, I,Q,U,V else I,P,PA,V
    110   std::string getPolarizationLabel(casa::Bool linear, casa::Bool stokes, 
    111                                    casa::Bool linPol, 
    112                                    casa::Int polIdx=-1) const;
     110  std::string getPolarizationLabel(casa::Bool linear, casa::Bool stokes,
     111                                   casa::Bool linPol,
     112                                   casa::Int polIdx=-1) const;
    113113
    114114  // Convert Stokes to linear or circular polarizations (specified by
     
    116116  // supported.
    117117  virtual std::vector<float> stokesToPolSpectrum(casa::Int whichRow,
    118                                                 casa::Bool toLinear,
    119                                                 casa::Int polIdx) const;
     118                                                casa::Bool toLinear,
     119                                                casa::Int polIdx) const;
    120120
    121121  // Get all Stokes at the specified Beam/IF cursor location (ignoring
     
    125125  // is not the same as nPol(), I have put it here for direct access as needed
    126126  virtual casa::Array<casa::Float> getStokesSpectrum(casa::Int whichRow=0,
    127                                                      casa::Int iBeam=-1, 
     127                                                     casa::Int iBeam=-1,
    128128                                                     casa::Int iIF=-1) const;
    129129
     
    132132
    133133  // get all as aips++ Vectors
    134   virtual void getSpectrum(casa::Vector<casa::Float>& spectrum,
    135                            casa::Int whichRow=0) const;
    136   //virtual void getMask(Vector<Bool>& mask,Int whichRow=0) const;
     134  virtual void getSpectrum(casa::Vector<casa::Float>& spectrum,
     135                           casa::Int whichRow=0) const;
    137136
    138137  // Get rest frequencies
    139138  std::vector<double> getRestFreqs() const;
    140  
    141   // get info for current row 
     139
     140  // get info for current row
    142141  // if whichRow == -1 the Header time is given
    143   std::string getTime(casa::Int whichRow=0, 
    144                       casa::Bool showDate=casa::False) const ;
    145   casa::MEpoch getEpoch(casa::Int whichRow=0) const; 
     142  std::string getTime(casa::Int whichRow=0,
     143                      casa::Bool showDate=casa::False) const ;
     144  casa::MEpoch getEpoch(casa::Int whichRow=0) const;
    146145  casa::MDirection getDirection(casa::Int whichRow=0,
    147                                 casa::Bool refBeam=casa::False) const;
     146                                casa::Bool refBeam=casa::False) const;
    148147
    149148  std::string getSourceName(casa::Int whichRow=0) const;
     
    154153
    155154  // Set RestFreqID.  source="" and IF=-1 means select all
    156   virtual casa::Bool setRestFreqs(const casa::Vector<casa::Double>& restFreqs, 
    157                                   const casa::String& unit,
    158                                   const std::vector<std::string>& lines,
    159                                   const casa::String& source,
    160                                   casa::Int whichIF=-1);
     155  virtual casa::Bool setRestFreqs(const casa::Vector<casa::Double>& restFreqs,
     156                                  const casa::String& unit,
     157                                  const std::vector<std::string>& lines,
     158                                  const casa::String& source,
     159                                  casa::Int whichIF=-1);
    161160
    162161  // List lines
     
    166165  std::string getFluxUnit() const;
    167166  void setFluxUnit (const std::string& unit);
    168  
     167
    169168  // Set Instrument
    170169  void setInstrument (const std::string& instrument);
     
    178177  virtual void resetCursor();
    179178
    180   //sets the user mask applied to all spectra
    181   virtual bool setMask(std::vector<int> whichChans);
    182179  // Hard flags the current spectrum, not reversible
    183180  virtual void flag(int whichRow);
     
    226223  // return a row as a Masked array, internally converting uChar flags
    227224  // to bool mask
    228   casa::MaskedArray<casa::Float> rowAsMaskedArray(casa::uInt whichRow, 
     225  casa::MaskedArray<casa::Float> rowAsMaskedArray(casa::uInt whichRow,
    229226                                                  casa::Bool toStokes=casa::False) const;
    230227
     
    237234  // rest frequency.  If row number given (>=0), also set
    238235  // frame conversion layer (needs direction & time which require row)
    239   casa::SpectralCoordinate getSpectralCoordinate(casa::uInt freqID, 
     236  casa::SpectralCoordinate getSpectralCoordinate(casa::uInt freqID,
    240237                                                 casa::uInt restFreqID,
    241238                                                 casa::uInt row) const;
     
    243240  // Set just the reference value, pixel and increment into the table
    244241  // No other state is extracted.
    245   casa::Bool setCoordinate(const casa::SpectralCoordinate& speccord, 
    246                            casa::uInt whichIdx);
     242  casa::Bool setCoordinate(const casa::SpectralCoordinate& speccord,
     243                           casa::uInt whichIdx);
    247244
    248245  casa::Int nCoordinates() const;
     
    263260
    264261  void addFit(casa::uInt whichRow,
    265               const casa::Vector<casa::Double>& p,
    266               const casa::Vector<casa::Bool>& m,
    267               const casa::Vector<casa::String>& f,
    268               const casa::Vector<casa::Int>& c);
    269 
    270  
     262              const casa::Vector<casa::Double>& p,
     263              const casa::Vector<casa::Bool>& m,
     264              const casa::Vector<casa::String>& f,
     265              const casa::Vector<casa::Int>& c);
     266
     267
    271268private:
    272269  // utility func for nice printout
     
    279276
    280277  // Generate start and end for shape and current cursor selection
    281   void getCursorSlice(casa::IPosition& start, casa::IPosition& end, 
    282                       const casa::IPosition& shape) const;
     278  void getCursorSlice(casa::IPosition& start, casa::IPosition& end,
     279                      const casa::IPosition& shape) const;
    283280
    284281  // the current cursor into the array
    285282  casa::Int IFSel_,beamSel_,polSel_;
    286   std::vector<bool> chanMask_;
    287283  // the underlying memory table
    288284  casa::Table table_;
  • trunk/src/SDMemTableWrapper.h

    r717 r745  
    8686  }
    8787
    88   std::vector<float> getStokesSpectrum(int whichRow=0, 
    89                                        bool linPol=false) const {
     88  std::vector<float> getStokesSpectrum(int whichRow=0,
     89                                       bool linPol=false) const {
    9090    return table_->getStokesSpectrum(whichRow, linPol);
    9191  }
    9292
    9393  std::vector<float> stokesToPolSpectrum(int whichRow=0, bool linear=false,
    94                                         int polIdx=-1) const {
     94                                        int polIdx=-1) const {
    9595    return table_->stokesToPolSpectrum(whichRow, linear, polIdx);
    9696  }
     
    9898  //  std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
    9999  // Boost fails with 4 arguments.
    100   std::string getPolarizationLabel(bool linear, bool stokes, 
    101                                    bool linPol) const {
     100  std::string getPolarizationLabel(bool linear, bool stokes,
     101                                   bool linPol) const {
    102102    int polIdx = -1;
    103103    return table_->getPolarizationLabel(linear, stokes, linPol, polIdx);
     
    130130    return table_->getMask(whichRow);
    131131  }
    132   bool setMask(const std::vector<int> mvals) const {
    133     return table_->setMask(mvals);
    134   }
    135132
    136133  void flag(int whichRow=-1) {
     
    169166  }
    170167
    171   bool setRestFreqs(const std::vector<double>& restfreqs, 
    172                     const std::string& unit, 
     168  bool setRestFreqs(const std::vector<double>& restfreqs,
     169                    const std::string& unit,
    173170                    const std::vector<std::string>& lines,
    174171                    const std::string& source, int whichIF) {
     
    178175                                casa::Int(whichIF));
    179176  }
    180  
    181   std::string spectralLines() const {table_->spectralLines();}
     177
     178  std::string spectralLines() const {return table_->spectralLines();}
    182179
    183180  std::vector<double> getRestFreqs() {
     
    195192  SDMemTable* getPtr() {return &(*table_);}
    196193
    197   std::string summary(bool verbose=false) const { 
    198     return table_->summary(verbose); 
    199   }
    200  
    201   std::vector<std::string> getHistory() { 
    202     return table_->getHistory(); 
    203   }
    204   void addHistory(const std::string& hist) { 
    205     table_->addHistory(hist); 
     194  std::string summary(bool verbose=false) const {
     195    return table_->summary(verbose);
     196  }
     197
     198  std::vector<std::string> getHistory() {
     199    return table_->getHistory();
     200  }
     201  void addHistory(const std::string& hist) {
     202    table_->addHistory(hist);
    206203  }
    207204
    208205  void addFit(int whichRow, const std::vector<double>& p,
    209               const std::vector<bool>& m, const std::vector<string>& f,
    210               const std::vector<int>& c) {
    211    
     206              const std::vector<bool>& m, const std::vector<string>& f,
     207              const std::vector<int>& c) {
     208
    212209    casa::Vector<casa::Double> p2(p);
    213     casa::Vector<casa::Bool> m2(m); 
     210    casa::Vector<casa::Bool> m2(m);
    214211    casa::Vector<casa::String> f2 = mathutil::toVectorString(f);
    215212    casa::Vector<casa::Int> c2(c);
  • trunk/src/python_SDMemTable.cc

    r539 r745  
    6262    .def("setbeam", &SDMemTableWrapper::setBeam)
    6363    .def("setpol", &SDMemTableWrapper::setPol)
    64     .def("_setmask", &SDMemTableWrapper::setMask)
    6564    .def("get_fluxunit", &SDMemTableWrapper::getFluxUnit)
    6665    .def("set_fluxunit", &SDMemTableWrapper::setFluxUnit)
     
    10099    .def("_save",  &SDMemTableWrapper::makePersistent)
    101100    .def("_summary",  &SDMemTableWrapper::summary,
    102         (boost::python::arg("verbose")=true) )
     101        (boost::python::arg("verbose")=true) )
    103102    .def("_getrestfreqs",  &SDMemTableWrapper::getRestFreqs)
    104103    .def("_setrestfreqs",  &SDMemTableWrapper::setRestFreqs)
Note: See TracChangeset for help on using the changeset viewer.