Changeset 996


Ignore:
Timestamp:
04/06/06 13:45:58 (18 years ago)
Author:
mar637
Message:

more fixes after compiling with -Wall.

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MathUtils.cpp

    r983 r996  
    4242
    4343float mathutil::statistics(const String& which,
    44                            const MaskedArray<Float>& data)
     44                           const MaskedArray<Float>& data)
    4545{
    4646   String str(which);
     
    6868      return median(data);
    6969   }
     70   return 0.0;
    7071}
    7172
  • trunk/src/STAsciiWriter.cpp

    r994 r996  
    123123
    124124    of << std::left << setw(16) << "x";
    125     for ( int i=0; i<t.nrow(); ++i ) {
     125    for ( unsigned int i=0; i<t.nrow(); ++i ) {
    126126      ostringstream os,os1;
    127127      os << "y" << i;
     
    136136    Matrix<Float> specs = specCol.getColumn();
    137137    Matrix<uChar> flags = flagCol.getColumn();
    138     for ( int i=0; i<specs.nrow(); ++i ) {
     138    for ( unsigned int i=0; i<specs.nrow(); ++i ) {
    139139      of << setw(16) << setprecision(8) << abc[i] ;
    140       for ( int j=0; j<specs.ncolumn(); ++j ) {
     140      for ( unsigned int j=0; j<specs.ncolumn(); ++j ) {
    141141        of << setw(16) << setprecision(8) << specs(i,j) ;
    142142        of << setw(7) << Int(flags(i,j));
  • trunk/src/STAsciiWriter.h

    r988 r996  
    5050
    5151// Destructor
    52   ~STAsciiWriter();
     52  virtual ~STAsciiWriter();
    5353
    5454// Write out ascii table
  • trunk/src/STAttr.h

    r894 r996  
    5252
    5353  // Destructor
    54   ~STAttr();
     54  virtual ~STAttr();
    5555
    5656  // Copy Constructor (copy semantics)
     
    6666  casa::Vector<casa::Float>
    6767  beamEfficiency(Instrument instr, const casa::MEpoch& dateObs,
    68                 const casa::Vector<casa::Float>& freqs) const;
     68                const casa::Vector<casa::Float>& freqs) const;
    6969
    7070  // Aperture efficiency. Frequency in Hz.  Returns 1 if unknown.
    7171  casa::Vector<casa::Float>
    7272  apertureEfficiency(Instrument instr,
    73                      const casa::MEpoch& dateObs,
    74                      const casa::Vector<casa::Float>& freqs) const;
     73                     const casa::MEpoch& dateObs,
     74                     const casa::Vector<casa::Float>& freqs) const;
    7575
    7676  // Find factor to convert Jy -> K for this telescope, date of
    7777  // observation and frequency (Hz)
    7878  casa::Vector<casa::Float> JyPerK(Instrument instr,
    79                                    const casa::MEpoch& dateObs,
    80                                    const casa::Vector<casa::Float>& freqs)
     79                                   const casa::MEpoch& dateObs,
     80                                   const casa::Vector<casa::Float>& freqs)
    8181    const;
    8282
     
    117117  // Linear interpolation
    118118  casa::Vector<casa::Float> interp(const casa::Vector<casa::Float>& xOut,
    119                                    const casa::Vector<casa::Float>& xIn,
    120                                    const casa::Vector<casa::Float>& yIn) const;
     119                                   const casa::Vector<casa::Float>& xIn,
     120                                   const casa::Vector<casa::Float>& yIn) const;
    121121
    122122
  • trunk/src/STFiller.h

    r901 r996  
    6666   * Destructor
    6767   */
    68   ~STFiller();
     68  virtual ~STFiller();
    6969
    7070  /**
  • trunk/src/STLineFinder.cpp

    r991 r996  
    8181   int start_advance;     // number of channel from which the box can
    8282                          // be moved (the middle of the box, if there is no
    83                           // masking)
     83                          // masking)
    8484public:
    8585   // set up the object with the references to actual data
     
    8787   RunningBox(const casa::Vector<casa::Float>  &in_spectrum,
    8888                 const casa::Vector<casa::Bool>   &in_mask,
    89                 const std::pair<int,int>         &in_edge,
    90                 int in_max_box_nchan) throw(AipsError);
     89                const std::pair<int,int>         &in_edge,
     90                int in_max_box_nchan) throw(AipsError);
    9191
    9292   // access to the statistics
     
    139139   int  min_nchan;                         // A minimum number of consequtive
    140140                                           // channels, which should satisfy
    141                                            // the detection criterion, to be
    142                                            // a detection
     141                                           // the detection criterion, to be
     142                                           // a detection
    143143   casa::Float threshold;                  // detection threshold - the
    144144                                           // minimal signal to noise ratio
     
    148148   casa::Vector<Int> signs;                // An array to store the signs of
    149149                                           // the value - current mean
    150                                            // (used to search wings)
     150                                           // (used to search wings)
    151151   casa::Int last_sign;                    // a sign (+1, -1 or 0) of the
    152152                                           // last point of the detected line
     
    157157   LFAboveThreshold(std::list<pair<int,int> > &in_lines,
    158158                    int in_min_nchan = 3,
    159                     casa::Float in_threshold = 5) throw();
     159                    casa::Float in_threshold = 5) throw();
    160160   virtual ~LFAboveThreshold() throw();
    161161
     
    175175   //    max_box_nchan  - number of channels in the running box
    176176   void findLines(const casa::Vector<casa::Float> &spectrum,
    177                   const casa::Vector<casa::Bool> &mask,
    178                   const std::pair<int,int> &edge,
    179                   int max_box_nchan) throw(casa::AipsError);
     177                  const casa::Vector<casa::Bool> &mask,
     178                  const std::pair<int,int> &edge,
     179                  int max_box_nchan) throw(casa::AipsError);
    180180
    181181protected:
     
    213213RunningBox::RunningBox(const casa::Vector<casa::Float>  &in_spectrum,
    214214                       const casa::Vector<casa::Bool>   &in_mask,
    215                        const std::pair<int,int>         &in_edge,
    216                        int in_max_box_nchan) throw(AipsError) :
     215                       const std::pair<int,int>         &in_edge,
     216                       int in_max_box_nchan) throw(AipsError) :
    217217        spectrum(in_spectrum), mask(in_mask), edge(in_edge),
    218         max_box_nchan(in_max_box_nchan)
     218        max_box_nchan(in_max_box_nchan)
    219219{
    220220  rewind();
     
    287287          sumf+=spectrum[ch];
    288288          sumf2+=square(spectrum[ch]);
    289           sumch+=Float(ch);
    290           sumch2+=square(Float(ch));
    291           sumfch+=spectrum[ch]*Float(ch);
    292           need2recalculate=True;
     289          sumch+=Float(ch);
     290          sumch2+=square(Float(ch));
     291          sumfch+=spectrum[ch]*Float(ch);
     292          need2recalculate=True;
    293293      }
    294294  int ch2remove=ch-max_box_nchan;
     
    298298          sumf-=spectrum[ch2remove];
    299299          sumf2-=square(spectrum[ch2remove]);
    300           sumch-=Float(ch2remove);
    301           sumch2-=square(Float(ch2remove));
    302           sumfch-=spectrum[ch2remove]*Float(ch2remove);
    303           need2recalculate=True;
     300          sumch-=Float(ch2remove);
     301          sumch2-=square(Float(ch2remove));
     302          sumfch-=spectrum[ch2remove]*Float(ch2remove);
     303          need2recalculate=True;
    304304      }
    305305}
     
    361361                                   casa::Float in_threshold) throw() :
    362362             min_nchan(in_min_nchan), threshold(in_threshold),
    363              lines(in_lines), running_box(NULL) {}
     363             lines(in_lines), running_box(NULL) {}
    364364
    365365LFAboveThreshold::~LFAboveThreshold() throw()
     
    427427       if (is_detected_before) {
    428428           if (cur_line.second-cur_line.first>min_nchan) {
    429                // it was a detection. We need to change the list
    430                Bool add_new_line=False;
    431                if (lines.size()) {
    432                    for (int i=lines.back().second;i<cur_line.first;++i)
    433                         if (mask[i]) { // one valid channel in between
    434                                 //  means that we deal with a separate line
    435                             add_new_line=True;
    436                             break;
    437                         }
    438                } else add_new_line=True;
    439                if (add_new_line)
    440                    lines.push_back(cur_line);
     429               // it was a detection. We need to change the list
     430               Bool add_new_line=False;
     431               if (lines.size()) {
     432                   for (int i=lines.back().second;i<cur_line.first;++i)
     433                        if (mask[i]) { // one valid channel in between
     434                                //  means that we deal with a separate line
     435                            add_new_line=True;
     436                            break;
     437                        }
     438               } else add_new_line=True;
     439               if (add_new_line)
     440                   lines.push_back(cur_line);
    441441               else lines.back().second=cur_line.second;
    442            }
    443            is_detected_before=False;
     442           }
     443           is_detected_before=False;
    444444       }
    445445  }
     
    463463// find spectral lines and add them into list
    464464void LFAboveThreshold::findLines(const casa::Vector<casa::Float> &spectrum,
    465                               const casa::Vector<casa::Bool> &mask,
    466                               const std::pair<int,int> &edge,
    467                               int max_box_nchan)
     465                              const casa::Vector<casa::Bool> &mask,
     466                              const std::pair<int,int> &edge,
     467                              int max_box_nchan)
    468468                        throw(casa::AipsError)
    469469{
     
    483483      for (;running_box->haveMore();running_box->next())
    484484           variances[running_box->getChannel()-edge.first]=
    485                                 running_box->getLinVariance();
     485                                running_box->getLinVariance();
    486486
    487487      // in the future we probably should do a proper Chi^2 estimation
     
    511511           const int ch=running_box->getChannel();
    512512           if (running_box->getNumberOfBoxPoints()>=minboxnchan)
    513                processChannel(mask[ch] && (fabs(running_box->aboveMean()) >=
    514                   threshold*offline_variance), mask);
    515            else processCurLine(mask); // just finish what was accumulated before
    516 
    517            signs[ch]=getAboveMeanSign();
    518            // os<<ch<<" "<<spectrum[ch]<<" "<<fabs(running_box->aboveMean())<<" "<<
     513               processChannel(mask[ch] && (fabs(running_box->aboveMean()) >=
     514                  threshold*offline_variance), mask);
     515           else processCurLine(mask); // just finish what was accumulated before
     516
     517           signs[ch]=getAboveMeanSign();
     518           // os<<ch<<" "<<spectrum[ch]<<" "<<fabs(running_box->aboveMean())<<" "<<
    519519           //   threshold*offline_variance<<endl;
    520520
    521            const Float buf=running_box->aboveMean();
    522            if (buf>0) signs[ch]=1;
    523            else if (buf<0) signs[ch]=-1;
    524            else if (buf==0) signs[ch]=0;
    525         //   os<<ch<<" "<<spectrum[ch]<<" "<<running_box->getLinMean()<<" "<<
    526           //              threshold*offline_variance<<endl;
     521           const Float buf=running_box->aboveMean();
     522           if (buf>0) signs[ch]=1;
     523           else if (buf<0) signs[ch]=-1;
     524           else if (buf==0) signs[ch]=0;
     525        //   os<<ch<<" "<<spectrum[ch]<<" "<<running_box->getLinMean()<<" "<<
     526          //              threshold*offline_variance<<endl;
    527527      }
    528528      if (lines.size())
     
    653653void STLineFinder::setOptions(const casa::Float &in_threshold,
    654654                              const casa::Int &in_min_nchan,
    655                               const casa::Int &in_avg_limit,
     655                              const casa::Int &in_avg_limit,
    656656                              const casa::Float &in_box_size) throw()
    657657{
     
    680680//   can be achieved using a spectrum mask only
    681681int STLineFinder::findLines(const std::vector<bool> &in_mask,
    682                 const std::vector<int> &in_edge,
    683                 const casa::uInt &whichRow) throw(casa::AipsError)
    684 {
    685   const int minboxnchan=4;
     682                const std::vector<int> &in_edge,
     683                const casa::uInt &whichRow) throw(casa::AipsError)
     684{
     685  //const int minboxnchan=4;
    686686  if (scan.null())
    687687      throw AipsError("STLineFinder::findLines - a scan should be set first,"
     
    704704  if (in_edge.size()>2)
    705705      throw AipsError("STLineFinder::findLines - the length of the in_edge parameter"
    706                       "should not exceed 2");
     706                      "should not exceed 2");
    707707      if (!in_edge.size()) {
    708708           // all spectra, no rejection
    709709           edge.first=0;
    710            edge.second=nchan;
     710           edge.second=nchan;
    711711      } else {
    712712           edge.first=in_edge[0];
    713            if (edge.first<0)
    714                throw AipsError("STLineFinder::findLines - the in_edge parameter has a negative"
    715                                 "number of channels to drop");
    716            if (edge.first>=nchan)
    717                throw AipsError("STLineFinder::findLines - all channels are rejected by the in_edge parameter");
     713           if (edge.first<0)
     714               throw AipsError("STLineFinder::findLines - the in_edge parameter has a negative"
     715                                "number of channels to drop");
     716           if (edge.first>=int(nchan))
     717               throw AipsError("STLineFinder::findLines - all channels are rejected by the in_edge parameter");
    718718           if (in_edge.size()==2) {
    719                edge.second=in_edge[1];
    720                if (edge.second<0)
    721                    throw AipsError("STLineFinder::findLines - the in_edge parameter has a negative"
    722                                    "number of channels to drop");
     719               edge.second=in_edge[1];
     720               if (edge.second<0)
     721                   throw AipsError("STLineFinder::findLines - the in_edge parameter has a negative"
     722                                   "number of channels to drop");
    723723               edge.second=nchan-edge.second;
    724            } else edge.second=nchan-edge.first;
     724           } else edge.second=nchan-edge.first;
    725725           if (edge.second<0 || (edge.first>=edge.second))
    726                throw AipsError("STLineFinder::findLines - all channels are rejected by the in_edge parameter");
     726               throw AipsError("STLineFinder::findLines - all channels are rejected by the in_edge parameter");
    727727       }
    728728
     
    743743  Int avg_factor=1; // this number of adjacent channels is averaged together
    744744                    // the total number of the channels is not altered
    745                     // instead, min_nchan is also scaled
    746                     // it helps to search for broad lines
     745                    // instead, min_nchan is also scaled
     746                    // it helps to search for broad lines
    747747  Vector<Int> signs; // a buffer for signs of the value - mean quantity
    748748                     // see LFAboveThreshold for details
    749                      // We need only signs resulted from last iteration
    750                      // because all previous values may be corrupted by the
    751                      // presence of spectral lines
     749                     // We need only signs resulted from last iteration
     750                     // because all previous values may be corrupted by the
     751                     // presence of spectral lines
    752752  while (true) {
    753753     // a buffer for new lines found at this iteration
     
    758758         LFAboveThreshold lfalg(new_lines,avg_factor*min_nchan, threshold);
    759759         lfalg.findLines(spectrum,temp_mask,edge,max_box_nchan);
    760         signs.resize(lfalg.getSigns().nelements());
    761         signs=lfalg.getSigns();
     760        signs.resize(lfalg.getSigns().nelements());
     761        signs=lfalg.getSigns();
    762762         first_pass=False;
    763763         if (!new_lines.size())
    764               throw AipsError("spurious"); // nothing new - use the same
    765                                            // code as for a real exception
     764              throw AipsError("spurious"); // nothing new - use the same
     765                                           // code as for a real exception
    766766     }
    767767     catch(const AipsError &ae) {
    768768         if (first_pass) throw;
    769769         // nothing new - proceed to the next step of averaging, if any
    770         // (to search for broad lines)
    771         if (avg_factor>avg_limit) break; // averaging up to avg_limit
    772                                           // adjacent channels,
    773                                           // stop after that
    774         avg_factor*=2; // twice as more averaging
    775         subtractBaseline(temp_mask,9);
    776         averageAdjacentChannels(temp_mask,avg_factor);
    777         continue;
     770        // (to search for broad lines)
     771        if (avg_factor>avg_limit) break; // averaging up to avg_limit
     772                                          // adjacent channels,
     773                                          // stop after that
     774        avg_factor*=2; // twice as more averaging
     775        subtractBaseline(temp_mask,9);
     776        averageAdjacentChannels(temp_mask,avg_factor);
     777        continue;
    778778     }
    779779     keepStrongestOnly(temp_mask,new_lines,max_box_nchan);
     
    804804  Fitter sdf;
    805805  std::vector<float> absc(spectrum.nelements());
    806   for (Int i=0;i<absc.size();++i)
     806  for (unsigned int i=0;i<absc.size();++i)
    807807       absc[i]=float(i)/float(spectrum.nelements());
    808808  std::vector<float> spec;
     
    835835       for (int k=n;k<n+boxsize && k<edge.second;++k)
    836836            if (mask2update[k]) {  // k is a valid channel
    837                 mean+=spectrum[k];
    838                 ++nboxch;
     837                mean+=spectrum[k];
     838                ++nboxch;
    839839            }
    840840       if (nboxch<boxsize) // mask these channels
    841841           for (int k=n;k<n+boxsize && k<edge.second;++k)
    842                 mask2update[k]=False;
     842                mask2update[k]=False;
    843843       else {
    844844          mean/=Float(boxsize);
    845            for (int k=n;k<n+boxsize && k<edge.second;++k)
    846                 spectrum[k]=mean;
     845           for (int k=n;k<n+boxsize && k<edge.second;++k)
     846                spectrum[k]=mean;
    847847       }
    848848  }
     
    866866       if (!lines.size())
    867867           throw AipsError("STLineFinder::getMask - one have to search for "
    868                            "lines first, use find_lines");
     868                           "lines first, use find_lines");
    869869       */
    870870       std::vector<bool> res_mask(mask.nelements());
    871871       // iterator through lines
    872872       std::list<std::pair<int,int> >::const_iterator cli=lines.begin();
    873        for (int ch=0;ch<res_mask.size();++ch)
     873       for (int ch=0;ch<int(res_mask.size());++ch)
    874874            if (ch<edge.first || ch>=edge.second) res_mask[ch]=false;
    875             else if (!mask[ch]) res_mask[ch]=false;
    876             else {
    877                     res_mask[ch]=!invert; // no line by default
    878                     if (cli==lines.end()) continue;
    879                     if (ch>=cli->first && ch<cli->second)
    880                         res_mask[ch]=invert; // this is a line
     875            else if (!mask[ch]) res_mask[ch]=false;
     876            else {
     877                    res_mask[ch]=!invert; // no line by default
     878                    if (cli==lines.end()) continue;
     879                    if (ch>=cli->first && ch<cli->second)
     880                        res_mask[ch]=invert; // this is a line
    881881                    if (ch>=cli->second)
    882                         ++cli; // next line in the list
    883                  }
     882                        ++cli; // next line in the list
     883                 }
    884884
    885885       return res_mask;
     
    925925       if (!lines.size())
    926926           throw AipsError("STLineFinder::getLineRangesInChannels - one have to search for "
    927                            "lines first, use find_lines");
     927                           "lines first, use find_lines");
    928928
    929929       std::vector<int> res(2*lines.size());
     
    932932       std::vector<int>::iterator ri=res.begin();
    933933       for (;cli!=lines.end() && ri!=res.end();++cli,++ri) {
    934             *ri=cli->first;
    935             if (++ri!=res.end())
    936                 *ri=cli->second-1;
     934            *ri=cli->first;
     935            if (++ri!=res.end())
     936                *ri=cli->second-1;
    937937       }
    938938       return res;
     
    962962// max_box_nchan - channels in the running box for baseline filtering
    963963void STLineFinder::keepStrongestOnly(const casa::Vector<casa::Bool> &temp_mask,
    964                   std::list<std::pair<int, int> > &lines2update,
    965                   int max_box_nchan)
     964                  std::list<std::pair<int, int> > &lines2update,
     965                  int max_box_nchan)
    966966                                   throw (casa::AipsError)
    967967{
     
    982982
    983983           if (li==lines2update.end()) break; // no more lines
    984            const int ch=running_box.getChannel();
    985            if (ch>=li->first && ch<li->second)
    986                if (temp_mask[ch] && tmp_flux<fabs(running_box.aboveMean()))
    987                    tmp_flux=fabs(running_box.aboveMean());
    988            if (ch==li->second-1) {
    989                if (peak_flux<tmp_flux) { // if peak_flux=-1, this condition
    990                    peak_flux=tmp_flux;   // will be satisfied
    991                    strongli=li;
    992                }
    993                ++li;
    994                tmp_flux=-1;
    995            }
     984           const int ch=running_box.getChannel();
     985           if (ch>=li->first && ch<li->second)
     986               if (temp_mask[ch] && tmp_flux<fabs(running_box.aboveMean()))
     987                   tmp_flux=fabs(running_box.aboveMean());
     988           if (ch==li->second-1) {
     989               if (peak_flux<tmp_flux) { // if peak_flux=-1, this condition
     990                   peak_flux=tmp_flux;   // will be satisfied
     991                   strongli=li;
     992               }
     993               ++li;
     994               tmp_flux=-1;
     995           }
    996996      }
    997997      std::list<std::pair<int,int> > res;
     
    10291029           cli!=newlines.end();++cli) {
    10301030
    1031            // the first item, which has a non-void intersection or touches
    1032            // the new line
    1033            std::list<pair<int,int> >::iterator pos_beg=find_if(lines_list.begin(),
    1034                           lines_list.end(), IntersectsWith(*cli));
    1035            // the last such item
    1036            std::list<pair<int,int> >::iterator pos_end=find_if(pos_beg,
    1037                           lines_list.end(), not1(IntersectsWith(*cli)));
     1031           // the first item, which has a non-void intersection or touches
     1032           // the new line
     1033           std::list<pair<int,int> >::iterator pos_beg=find_if(lines_list.begin(),
     1034                          lines_list.end(), IntersectsWith(*cli));
     1035           // the last such item
     1036           std::list<pair<int,int> >::iterator pos_end=find_if(pos_beg,
     1037                          lines_list.end(), not1(IntersectsWith(*cli)));
    10381038
    10391039           // extract all lines which intersect or touch a new one into
    1040            // a temporary buffer. This may invalidate the iterators
    1041            // line_buffer may be empty, if no lines intersects with a new
    1042            // one.
    1043            std::list<pair<int,int> > lines_buffer;
    1044            lines_buffer.splice(lines_buffer.end(),lines_list, pos_beg, pos_end);
    1045 
    1046            // build a union of all intersecting lines
    1047            pair<int,int> union_line=for_each(lines_buffer.begin(),
    1048                    lines_buffer.end(),BuildUnion(*cli)).result();
    1049 
    1050            // search for a right place for the new line (union_line) and add
    1051            std::list<pair<int,int> >::iterator pos2insert=find_if(lines_list.begin(),
    1052                           lines_list.end(), LaterThan(union_line));
    1053            lines_list.insert(pos2insert,union_line);
     1040           // a temporary buffer. This may invalidate the iterators
     1041           // line_buffer may be empty, if no lines intersects with a new
     1042           // one.
     1043           std::list<pair<int,int> > lines_buffer;
     1044           lines_buffer.splice(lines_buffer.end(),lines_list, pos_beg, pos_end);
     1045
     1046           // build a union of all intersecting lines
     1047           pair<int,int> union_line=for_each(lines_buffer.begin(),
     1048                   lines_buffer.end(),BuildUnion(*cli)).result();
     1049
     1050           // search for a right place for the new line (union_line) and add
     1051           std::list<pair<int,int> >::iterator pos2insert=find_if(lines_list.begin(),
     1052                          lines_list.end(), LaterThan(union_line));
     1053           lines_list.insert(pos2insert,union_line);
    10541054      }
    10551055  }
     
    10691069void LFLineListOperations::searchForWings(std::list<std::pair<int, int> > &newlines,
    10701070           const casa::Vector<casa::Int> &signs,
    1071            const casa::Vector<casa::Bool> &mask,
    1072            const std::pair<int,int> &edge) throw(casa::AipsError)
     1071           const casa::Vector<casa::Bool> &mask,
     1072           const std::pair<int,int> &edge) throw(casa::AipsError)
    10731073{
    10741074  try {
    10751075      for (std::list<pair<int,int> >::iterator li=newlines.begin();
    10761076           li!=newlines.end();++li) {
    1077            // update the left hand side
    1078            for (int n=li->first-1;n>=edge.first;--n) {
    1079                 if (!mask[n]) break;
    1080                 if (signs[n]==signs[li->first] && signs[li->first])
    1081                     li->first=n;
    1082                 else break;
    1083            }
    1084            // update the right hand side
    1085            for (int n=li->second;n<edge.second;++n) {
    1086                 if (!mask[n]) break;
    1087                 if (signs[n]==signs[li->second-1] && signs[li->second-1])
    1088                     li->second=n;
    1089                 else break;
    1090            }
     1077           // update the left hand side
     1078           for (int n=li->first-1;n>=edge.first;--n) {
     1079                if (!mask[n]) break;
     1080                if (signs[n]==signs[li->first] && signs[li->first])
     1081                    li->first=n;
     1082                else break;
     1083           }
     1084           // update the right hand side
     1085           for (int n=li->second;n<edge.second;++n) {
     1086                if (!mask[n]) break;
     1087                if (signs[n]==signs[li->second-1] && signs[li->second-1])
     1088                    li->second=n;
     1089                else break;
     1090           }
    10911091      }
    10921092      // need to search for possible mergers.
  • trunk/src/STMath.cpp

    r992 r996  
    128128
    129129  for (uInt i=0; i < tout.nrow(); ++i) {
    130     for ( int j=0; j < in.size(); ++j ) {
     130    for ( int j=0; j < int(in.size()); ++j ) {
    131131      const Table& tin = in[j]->table();
    132132      const TableRecord& rec = row.get(i);
     
    425425//
    426426{
    427   InterpolateArray1D<Double,Float>::InterpolationMethod interp;
     427  //InterpolateArray1D<Double,Float>::InterpolationMethod interp;
    428428  Int interpMethod(stringToIMethod(method));
    429429
     
    621621  // Interpolate (and extrapolate) with desired method
    622622
    623    //InterpolateArray1D<Double,Float>::InterpolationMethod method;
    624    Int intmethod(stringToIMethod(method));
     623  InterpolateArray1D<Double,Float>::InterpolationMethod interp = stringToIMethod(method);
    625624
    626625   Vector<Float> yout;
    627626   Vector<Bool> maskout;
    628627   InterpolateArray1D<Float,Float>::interpolate(yout, maskout, xout,
    629                                                 xin, yin, maskin, intmethod,
     628                                                xin, yin, maskin, interp,
    630629                                                True, True);
    631630
     
    706705    STAttr sda;
    707706    if (d < 0) d = sda.diameter(inst);
    708     Float jyPerk = STAttr::findJyPerK(etaap, d);
     707    jyperk = STAttr::findJyPerK(etaap, d);
    709708    ostringstream oss;
    710709    oss << "Jy/K = " << jyperk;
     
    898897  STMath::invertPhase( const CountedPtr < Scantable >& in )
    899898{
    900   applyToPol(in, &STPol::invertPhase, Float(0.0));
     899  return applyToPol(in, &STPol::invertPhase, Float(0.0));
    901900}
    902901
     
    10251024  MPosition refPos = in->getAntennaPosition();
    10261025
    1027   InterpolateArray1D<Double,Float>::InterpolationMethod interp;
    1028   Int interpMethod(stringToIMethod(method));
     1026  InterpolateArray1D<Double,Float>::InterpolationMethod interp = stringToIMethod(method);
    10291027  // test if user frame is different to base frame
    10301028  if ( in->frequencies().getFrameString(true)
     
    10951093        bool first = true;
    10961094        // these rows should be just be POLNO
    1097         for (int i=0; i<tab.nrow(); ++i) {
     1095        for (int i=0; i<int(tab.nrow()); ++i) {
    10981096          // input values
    10991097          Vector<uChar> flag = flagCol(i);
  • trunk/src/STMathWrapper.h

    r992 r996  
    4343  {
    4444    std::vector<casa::CountedPtr<Scantable> > sts;
    45     for (int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
     45    for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
    4646    return ScantableWrapper(STMath::average(sts, mask, weight, avmode));
    4747  }
     
    8787                  const std::vector<float>& coeff,
    8888                  const std::string& filename,
    89                   const std::string& method)
     89                  const std::string& method)
    9090
    9191  { return
     
    106106  {
    107107    std::vector<casa::CountedPtr<Scantable> > sts;
    108     for (int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
     108    for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
    109109    return ScantableWrapper(STMath::merge(sts)); }
    110110
  • trunk/src/STWriter.cpp

    r988 r996  
    141141  Int status;
    142142  Bool havexpol = Bool(in->npol() > 2);
    143   if (status = writer_->create(filename, hdr.observer, hdr.project,
     143  status = writer_->create(filename, hdr.observer, hdr.project,
    144144                               hdr.antennaname, hdr.antennaposition,
    145145                               hdr.obstype, hdr.equinox, hdr.freqref,
    146                                nChan, nPol, False, havexpol)) {
     146                               nChan, nPol, False, havexpol);
     147  if ( status ) {
    147148    throw(AipsError("Failed to create output file"));
    148149  }
     
    214215          Vector<Float>   sigma(npol, 0.0f);
    215216          Vector<Float>   calFctr(npol, 0.0f);
    216           if (status = writer_->write(scanno, cycno, rec.asDouble("TIME"),
     217          status = writer_->write(scanno, cycno, rec.asDouble("TIME"),
    217218                                      rec.asDouble("INTERVAL"),
    218219                                      rec.asString("FIELDNAME"),
     
    239240                                      specs, flags,
    240241                                      xCalFctr,//
    241                                       xpol)
    242                                       ) {
     242                                      xpol);
     243          if ( status ) {
    243244            writer_->close();
    244245            throw(AipsError("STWriter: Failed to export Scantable."));
     
    281282                              Vector< Complex > & xpol, const Table & tab )
    282283{
    283   TableRow row(tab);
    284284  String poltype = tab.keywordSet().asString("POLTYPE");
    285285  if ( poltype != "linear") {
     
    287287    throw(AipsError(msg));
    288288  }
    289   // use the first row to fill in all the "metadata"
    290   const TableRecord& rec = row.get(0);
    291289  ROArrayColumn<Float> specCol(tab, "SPECTRA");
    292290  ROArrayColumn<uChar> flagCol(tab, "FLAGTRA");
  • trunk/src/Scantable.cpp

    r987 r996  
    101101  initFactories();
    102102  Table tab(name, Table::Update);
    103   Int version;
     103  uInt version;
    104104  tab.keywordSet().get("VERSION", version);
    105105  if (version != version_) {
     
    322322
    323323int Scantable::nscan() const {
    324   int n = 0;
    325   Int previous = -1; Int current = 0;
    326324  Vector<uInt> scannos(scanCol_.getColumn());
    327325  uInt nout = GenSort<uInt>::sort( scannos, Sort::Ascending,
     
    384382{
    385383  bool throwIt = true;
    386   Instrument ins = STAttr::convertInstrument(name, throwIt);
     384  // create an Instrument to see if this is valid
     385  STAttr::convertInstrument(name, throwIt);
    387386  String nameU(name);
    388387  nameU.upcase();
     
    555554  oss << "Computed azimuth/elevation using " << endl
    556555      << mp << endl;
    557   for (uInt i=0; i<nrow(); ++i) {
     556  for (Int i=0; i<nrow(); ++i) {
    558557    MEpoch me = timeCol(i);
    559558    MDirection md = getDirection(i);
     
    795794std::vector< double > asap::Scantable::getAbcissa( int whichrow ) const
    796795{
    797   if ( whichrow > table_.nrow() ) throw(AipsError("Illegal ro number"));
     796  if ( whichrow > int(table_.nrow()) ) throw(AipsError("Illegal ro number"));
    798797  std::vector<double> stlout;
    799798  int nchan = specCol_(whichrow).nelements();
     
    864863std::string Scantable::getAbcissaLabel( int whichrow ) const
    865864{
    866   if ( whichrow > table_.nrow() ) throw(AipsError("Illegal ro number"));
     865  if ( whichrow > int(table_.nrow()) ) throw(AipsError("Illegal ro number"));
    867866  const MPosition& mp = getAntennaPosition();
    868867  const MDirection& md = getDirection(whichrow);
Note: See TracChangeset for help on using the changeset viewer.