Changeset 551


Ignore:
Timestamp:
03/10/05 13:54:16 (19 years ago)
Author:
vor010
Message:

Small improvements in the line finder. Most probably users will not notice them at all. Line wings are now detected better
for strong lines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDLineFinder.cc

    r516 r551  
    147147                                           // (pair: start and stop+1 channel)
    148148   RunningBox *running_box;                // running box filter
     149   casa::Vector<Int> signs;                // An array to store the signs of
     150                                           // the value - current mean
     151                                           // (used to search wings)
    149152public:
    150153
     
    157160   // replace the detection criterion
    158161   void setCriterion(int in_min_nchan, casa::Float in_threshold) throw();
     162
     163   // return the array with signs of the value-current mean
     164   // An element is +1 if value>mean, -1 if less, 0 if equal.
     165   // This array is updated each time the findLines method is called and
     166   // is used to search the line wings
     167   const casa::Vector<Int>& getSigns() const throw();
    159168
    160169   // find spectral lines and add them into list
     
    417426      throw AipsError(String("LFAboveThreshold::processCurLine - STL error: ")+ex.what());
    418427  }
     428}
     429
     430// return the array with signs of the value-current mean
     431// An element is +1 if value>mean, -1 if less, 0 if equal.
     432// This array is updated each time the findLines method is called and
     433// is used to search the line wings
     434const casa::Vector<Int>& LFAboveThreshold::getSigns() const throw()
     435{
     436  return signs;
    419437}
    420438
     
    459477      // actual search algorithm
    460478      is_detected_before=False;
    461       Vector<Int> signs(spectrum.nelements(),0);
     479
     480      // initiate the signs array
     481      signs.resize(spectrum.nelements());
     482      signs=Vector<Int>(spectrum.nelements(),0);
    462483
    463484      //ofstream os("dbg.dat");
     
    694715                    // instead, min_nchan is also scaled
    695716                    // it helps to search for broad lines
     717  Vector<Int> signs; // a buffer for signs of the value - mean quantity
     718                     // see LFAboveThreshold for details
     719                     // We need only signs resulted from last iteration
     720                     // because all previous values may be corrupted by the
     721                     // presence of spectral lines
    696722  while (true) {
    697723     // a buffer for new lines found at this iteration
     
    702728         LFAboveThreshold lfalg(new_lines,avg_factor*min_nchan, threshold);
    703729         lfalg.findLines(spectrum,temp_mask,edge,max_box_nchan);
     730         signs.resize(lfalg.getSigns().nelements());
     731         signs=lfalg.getSigns();
    704732         first_pass=False;
    705733         if (!new_lines.size())
     
    725753     temp_mask=getMask();     
    726754  }
     755 
     756  // an additional search for wings because in the presence of very strong
     757  // lines temporary mean used at each iteration will be higher than
     758  // the true mean
     759 
     760  if (lines.size())
     761      LFLineListOperations::searchForWings(lines,signs,mask,edge);
     762     
    727763  return int(lines.size());
    728764}
Note: See TracChangeset for help on using the changeset viewer.