Changeset 1490


Ignore:
Timestamp:
01/23/09 18:06:33 (16 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1043

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Changed criteria if new row is added to the

FREQUENCIES subtable or not.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/src/STFiller.cpp

    r1489 r1490  
    456456       << ")" << endl ;
    457457  //
    458   if ( nreader_->open() != 0 ) {
    459     throw( AipsError( "Error while opening file "+filename_ ) ) ;
    460   }
     458//   if ( nreader_->open() != 0 ) {
     459//     throw( AipsError( "Error while opening file "+filename_ ) ) ;
     460//   }
    461461
    462462  isNRO_ = true ;
     
    591591  uInt id ;
    592592  uInt imax = nreader_->getRowNum() ;
     593  vector< vector<double > > freqs ;
    593594  //uInt imax = 30 ;
    594595  uInt i = 0 ;
     
    636637      *sdirCol = nreader_->getSourceDirection() ;
    637638      RecordFieldPtr<Double> svelCol(rec, "SRCVELOCITY") ;
    638       *svelCol = h->getURVEL() ;   // [m/s]
    639       //*svelCol = h->getURVEL() + d->VRAD ;  // [m/s]
     639      //*svelCol = h->getURVEL() ;   // [m/s]
     640      *svelCol = h->getURVEL() + d->VRAD ;  // [m/s]
    640641      RecordFieldPtr<Int> fitCol(rec, "FIT_ID") ;
    641642      *fitCol = -1 ;
     
    662663      RecordFieldPtr<uInt> mfreqidCol(rec, "FREQ_ID") ;
    663664      vector<double> fqs = nreader_->getFrequencies( i ) ;
    664       id = table_->frequencies().addEntry( Double( fqs[0] ),
    665                                            Double( fqs[1] ),
    666                                            Double( fqs[2] ) ) ;
    667       *mfreqidCol = id ;
    668       *ifCol = id ;
     665      //cout << "STFiller::readNRO()  fqs[1] = " << fqs[1] << endl ;
     666      if ( freqs.size() == 0 ) {
     667        id = table_->frequencies().addEntry( Double( fqs[0] ),
     668                                             Double( fqs[1] ),
     669                                             Double( fqs[2] ) ) ;
     670        *mfreqidCol = id ;
     671        *ifCol = id ;
     672        freqs.push_back( fqs ) ;
     673      }
     674      else {
     675        int iadd = -1 ;
     676        for ( uInt iif = 0 ; iif < freqs.size() ; iif++ ) {
     677          //cout << "STFiller::readNRO()  freqs[" << iif << "][1] = " << freqs[iif][1] << endl ;
     678          double fdiff = abs( freqs[iif][1] - fqs[1] ) / freqs[iif][1] ;
     679          //cout << "STFiller::readNRO()  fdiff = " << fdiff << endl ;
     680          if ( fdiff < 1.0e-8 ) {
     681            iadd = iif ;
     682            break ;
     683          }
     684        }
     685        if ( iadd == -1 ) {
     686          id = table_->frequencies().addEntry( Double( fqs[0] ),
     687                                               Double( fqs[1] ),
     688                                               Double( fqs[2] ) ) ;
     689          *mfreqidCol = id ;
     690          *ifCol = id ;
     691          freqs.push_back( fqs ) ;
     692        }
     693        else {
     694          *mfreqidCol = iadd ;
     695          *ifCol = iadd ;
     696        }
     697      }
    669698      RecordFieldPtr<uInt> molidCol(rec, "MOLECULE_ID") ;
    670699      Vector<Double> restfreq( IPosition( 1, 1 ) ) ;
Note: See TracChangeset for help on using the changeset viewer.