Changeset 1315


Ignore:
Timestamp:
01/30/07 20:59:42 (18 years ago)
Author:
vor010
Message:

bug fixed: the criterion required nch+1 instead of nch, number of averaging steps occuring was also one more

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STLineFinder.cpp

    r1016 r1315  
    5050//
    5151// RunningBox -    a running box calculator. This class implements
    52 //                 interations over the specified spectrum and calculates
     52//                 iterations over the specified spectrum and calculates
    5353//                 running box filter statistics.
    5454//
     
    399399          if (last_sign && last_sign!=getAboveMeanSign())
    400400              detect=False;
    401           }
    402           if (detect) {
    403               last_sign=getAboveMeanSign();
    404               if (is_detected_before)
    405                   cur_line.second=running_box->getChannel()+1;
    406               else {
    407                   is_detected_before=True;
    408                   cur_line.first=running_box->getChannel();
    409                   cur_line.second=running_box->getChannel()+1;
    410               }
    411           } else processCurLine(mask);
     401       }
     402       if (detect) {
     403           last_sign=getAboveMeanSign();
     404           if (is_detected_before)
     405               cur_line.second=running_box->getChannel()+1;
     406           else {
     407               is_detected_before=True;
     408               cur_line.first=running_box->getChannel();
     409               cur_line.second=running_box->getChannel()+1;
     410           }
     411       } else processCurLine(mask);
    412412  }
    413413  catch (const AipsError &ae) {
     
    426426  try {
    427427       if (is_detected_before) {
    428            if (cur_line.second-cur_line.first>min_nchan) {
     428           if (cur_line.second-cur_line.first>=min_nchan) {
    429429               // it was a detection. We need to change the list
    430430               Bool add_new_line=False;
     
    517517           signs[ch]=getAboveMeanSign();
    518518           // os<<ch<<" "<<spectrum[ch]<<" "<<fabs(running_box->aboveMean())<<" "<<
    519            //   threshold*offline_variance<<endl;
     519           // threshold*offline_variance<<endl;
    520520
    521521           const Float buf=running_box->aboveMean();
     
    523523           else if (buf<0) signs[ch]=-1;
    524524           else if (buf==0) signs[ch]=0;
    525         //   os<<ch<<" "<<spectrum[ch]<<" "<<running_box->getLinMean()<<" "<<
    526           //              threshold*offline_variance<<endl;
     525           //os<<ch<<" "<<spectrum[ch]<<" "<<running_box->getLinMean()<<" "<<
     526           //             threshold*offline_variance<<endl;
    527527      }
    528528      if (lines.size())
     
    768768         // nothing new - proceed to the next step of averaging, if any
    769769         // (to search for broad lines)
    770          if (avg_factor>avg_limit) break; // averaging up to avg_limit
     770         if (avg_factor>=avg_limit) break; // averaging up to avg_limit
    771771                                          // adjacent channels,
    772772                                          // stop after that
     
    775775         averageAdjacentChannels(temp_mask,avg_factor);
    776776         continue;
    777      }
     777     } 
    778778     keepStrongestOnly(temp_mask,new_lines,max_box_nchan);
    779779     // update the list (lines) merging intervals, if necessary
     
    951951// they will be find again at the next iteration. This approach
    952952// increases the number of iterations required, but is able to remove
    953 // the sidelobes likely to occur near strong lines.
     953// spurious detections likely to occur near strong lines.
    954954// Later a better criterion may be implemented, e.g.
    955955// taking into consideration the brightness of different lines. Now
Note: See TracChangeset for help on using the changeset viewer.