Changeset 924 for trunk


Ignore:
Timestamp:
03/24/06 13:33:17 (18 years ago)
Author:
mar637
Message:

fix for incorrect use of Scantable::nchan. Fix for std::vector / casa::Vector conusion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STLineFinder.cpp

    r907 r924  
    192192   void processCurLine(const casa::Vector<casa::Bool> &mask)
    193193                                                 throw(casa::AipsError);
    194    
     194
    195195   // get the sign of runningBox->aboveMean(). The RunningBox pointer
    196196   // should be defined
     
    519519           // os<<ch<<" "<<spectrum[ch]<<" "<<fabs(running_box->aboveMean())<<" "<<
    520520           //   threshold*offline_variance<<endl;
    521            
     521
    522522           const Float buf=running_box->aboveMean();
    523523           if (buf>0) signs[ch]=1;
     
    670670  scan=in_scan.getCP();
    671671  AlwaysAssert(!scan.null(),AipsError);
    672  
     672
    673673}
    674674
     
    688688      throw AipsError("STLineFinder::findLines - a scan should be set first,"
    689689                      " use set_scan");
    690  
     690
     691  uInt nchan = scan->nchan(scan->getIF(whichRow));
    691692  // set up mask and edge rejection
    692   mask=in_mask;
    693   if (mask.nelements()!=scan->nchan(whichRow))
     693  // no mask given...
     694  if (in_mask.size() == 0) {
     695    mask = Vector<Bool>(nchan,True);
     696  } else {
     697    // use provided mask
     698    mask=Vector<Bool>(in_mask);
     699  }
     700  if (mask.nelements()!=nchan)
    694701      throw AipsError("STLineFinder::findLines - in_scan and in_mask have different"
    695702            "number of spectral channels.");
    696 
     703  cout << mask.nelements() << endl;
    697704  // number of elements in in_edge
    698705  if (in_edge.size()>2)
     
    702709           // all spectra, no rejection
    703710           edge.first=0;
    704            edge.second=scan->nchan(whichRow);
     711           edge.second=nchan;
    705712      } else {
    706713           edge.first=in_edge[0];
     
    708715               throw AipsError("STLineFinder::findLines - the in_edge parameter has a negative"
    709716                                "number of channels to drop");
    710            if (edge.first>=scan->nchan(whichRow))
     717           if (edge.first>=nchan)
    711718               throw AipsError("STLineFinder::findLines - all channels are rejected by the in_edge parameter");
    712719           if (in_edge.size()==2) {
     
    715722                   throw AipsError("STLineFinder::findLines - the in_edge parameter has a negative"
    716723                                   "number of channels to drop");
    717                edge.second=scan->nchan(whichRow)-edge.second;
    718            } else edge.second=scan->nchan(whichRow)-edge.first;
     724               edge.second=nchan-edge.second;
     725           } else edge.second=nchan-edge.first;
    719726           if (edge.second<0 || (edge.first>=edge.second))
    720727               throw AipsError("STLineFinder::findLines - all channels are rejected by the in_edge parameter");
    721728       }
    722      
     729
    723730  //
    724   int max_box_nchan=int(scan->nchan(whichRow)*box_size); // number of channels in running
     731  int max_box_nchan=int(nchan*box_size); // number of channels in running
    725732                                                 // box
    726733  if (max_box_nchan<2)
     
    856863           throw AipsError("STLineFinder::getMask - a scan should be set first,"
    857864                      " use set_scan followed by find_lines");
    858        DebugAssert(mask.nelements()==scan->nchan(last_row_used), AipsError);
     865       DebugAssert(mask.nelements()==scan->getChannels(last_row_used), AipsError);
    859866       /*
    860867       if (!lines.size())
     
    915922           throw AipsError("STLineFinder::getLineRangesInChannels - a scan should be set first,"
    916923                      " use set_scan followed by find_lines");
    917        DebugAssert(mask.nelements()==scan->nchan(last_row_used), AipsError);
     924       DebugAssert(mask.nelements()==scan->getChannels(last_row_used), AipsError);
    918925
    919926       if (!lines.size())
Note: See TracChangeset for help on using the changeset viewer.