Changeset 1519


Ignore:
Timestamp:
02/25/09 19:32:49 (15 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: asap_init()

s=sd.scantable('NRO_DATA_FILE',False)

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Get all necessary informations for ASAP table

using NROReader::getScanInfo() method.


Location:
branches/alma/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/src/Makefile

    r1455 r1519  
    77###    3. Replase library names in G2CARCH '-lcasa_*' with '-l*'.
    88###    4. Comment-IN the definition of 'CXXOPTS'.
    9 TARGET   := /tmp/_asap.so
     9#TARGET   := /tmp/_asap.so
     10TARGET   := /home/nakazato/tmp/_asap.so
    1011
    1112# the casa environment AIPSPATH has to be defined
     
    2526CXXFLAGS += -ansi -Wno-long-long -Wall
    2627#CXXOPTS := -DAIPS_NO_TEMPLATE_SRC
     28CXXOPTS := -DAIPS_64B
    2729
    2830# darwin specific flags
     
    5658             -lcasa_lattices -lcasa_fits -lcasa_measures -lcasa_measures_f \
    5759             -lcasa_tables -lcasa_scimath -lcasa_scimath_f -lcasa_casa  \
    58              $(CASALIB)/libwcs.a \
     60             /usr/lib64/libwcs.so \
    5961             $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
    6062
  • branches/alma/src/STFiller.cpp

    r1518 r1519  
    480480  }
    481481
     482  // DEBUG
     483  //cout << "STFiller::openNRO()  getHeaderInfo " << endl ;
     484  //
     485
    482486  ifOffset_ = 0;
    483487  vector<Bool> ifs = nreader_->getIFs() ;
     
    499503  }
    500504
     505  // DEBUG
     506  //cout << "STFiller::openNRO()  nIF " << endl ;
     507  //
     508
    501509  beamOffset_ = 0;
    502510  vector<Bool> beams = nreader_->getBeams() ;
     
    518526  }
    519527
     528  // DEBUG
     529  //cout << "STFiller::openNRO()  nBeam " << endl ;
     530  //
     531
    520532  header_->nbeam = nBeam_ ;
    521533  header_->nif = nIF_ ;
     
    557569  //
    558570
    559   // get header
    560   NROHeader *h = nreader_->getHeader() ;
    561 
    562571  // fill row
    563572  uInt id ;
     
    566575  uInt i = 0 ;
    567576  int count = 0 ;
     577  uInt scanno ;
     578  uInt cycleno ;
     579  uInt beamno ;
     580  uInt polno ;
     581  vector<double> fqs ;
     582  Vector<Double> restfreq ;
     583  uInt refbeamno ;
     584  Double scantime ;
     585  Double interval ;
     586  String srcname ;
     587  String fieldname ;
     588  Array<Float> spectra ;
     589  Array<uChar> flagtra ;
     590  Array<Float> tsys ;
     591  Array<Double> direction ;
     592  Float azimuth ;
     593  Float elevation ;
     594  Float parangle ;
     595  Float opacity ;
     596  uInt tcalid ;
     597  Int fitid ;
     598  uInt focusid ;
     599  Float temperature ;
     600  Float pressure ;
     601  Float humidity ;
     602  Float windvel ;
     603  Float winddir ;
     604  Double srcvel ;
     605  Array<Double> propermotion ;
     606  Vector<Double> srcdir ;
     607  Array<Double> scanrate ;
    568608  for ( i = 0 ; i < imax ; i++ ) {
    569609    if( nreader_->getData( i ) != 0 ) {
     
    571611      return -1 ;
    572612    }
    573     NRODataset *d = nreader_->getData() ;
    574 
    575     char *scanType = d->SCANTP ;
     613
     614    string scanType = nreader_->getScanType( i ) ;
    576615    Int srcType = -1 ;
    577     if ( strncmp( scanType, "ON", 2 ) == 0 ) {
     616    if ( scanType.compare( 0, 2, "ON") == 0 ) {
    578617      srcType = 0 ;
    579618    }
    580     else if ( strncmp( scanType, "OFF", 3 ) == 0 ) {
     619    else if ( scanType.compare( 0, 3, "OFF" ) == 0 ) {
    581620      //cout << "OFF srcType: " << i << endl ;
    582621      srcType = 1 ;
    583622    }
    584     else if ( strncmp( scanType, "ZERO", 4 ) == 0 ) {
     623    else if ( scanType.compare( 0, 4, "ZERO" ) == 0 ) {
    585624      //cout << "ZERO srcType: " << i << endl ;
    586625      srcType = 2 ;
     
    596635      TableRecord& rec = row.record();
    597636
    598       RecordFieldPtr<Int> srctCol(rec, "SRCTYPE") ;
    599       *srctCol = srcType ;     
    600       RecordFieldPtr<Array<Double> > srateCol(rec, "SCANRATE");
    601       Array<Double> srcarr( IPosition( 1, 2 ) ) ;
    602       srcarr = 0.0 ;
    603       *srateCol = srcarr ;
    604       RecordFieldPtr<Array<Double> > spmCol(rec, "SRCPROPERMOTION") ;
    605       *spmCol = srcarr ;
    606       RecordFieldPtr<Array<Double> > sdirCol(rec, "SRCDIRECTION") ;
    607       *sdirCol = nreader_->getSourceDirection() ;
    608       RecordFieldPtr<Double> svelCol(rec, "SRCVELOCITY") ;
    609       *svelCol = h->getURVEL() ;   // [m/s]
    610       RecordFieldPtr<Int> fitCol(rec, "FIT_ID") ;
    611       *fitCol = -1 ;
     637      if ( nreader_->getScanInfo( i,
     638                                  scanno,
     639                                  cycleno,
     640                                  beamno,
     641                                  polno,
     642                                  fqs,
     643                                  restfreq,
     644                                  refbeamno,
     645                                  scantime,
     646                                  interval,
     647                                  srcname,
     648                                  fieldname,
     649                                  spectra,
     650                                  flagtra,
     651                                  tsys,
     652                                  direction,
     653                                  azimuth,
     654                                  elevation,
     655                                  parangle,
     656                                  opacity,
     657                                  tcalid,
     658                                  fitid,
     659                                  focusid,
     660                                  temperature,
     661                                  pressure,
     662                                  humidity,
     663                                  windvel,
     664                                  winddir,
     665                                  srcvel,
     666                                  propermotion,
     667                                  srcdir,
     668                                  scanrate ) ) {
     669        cerr << "STFiller::readNRO()  Failed to get scan information." << endl ;
     670        return 1 ;
     671      }
     672
    612673      RecordFieldPtr<uInt> scannoCol( rec, "SCANNO" ) ;
    613       //*scannoCol = (uInt)(d->getISCAN()) ;
    614       *scannoCol = (uInt)(d->ISCAN) ;
    615       RecordFieldPtr<uInt> cyclenoCol(rec, "CYCLENO");
    616       RecordFieldPtr<Double> mjdCol( rec, "TIME" ) ;
    617       *mjdCol = Double( nreader_->getStartIntTime( i ) ) ;
    618       RecordFieldPtr<Double> intervalCol( rec, "INTERVAL" ) ;
    619       *intervalCol = Double( h->getIPTIM() ) ;
    620       RecordFieldPtr<String> srcnCol(rec, "SRCNAME") ;
    621       *srcnCol = String( h->getOBJ() ) ;
    622       RecordFieldPtr<String> fieldnCol(rec, "FIELDNAME");
    623       *fieldnCol = String( h->getOBJ() ) ;
    624       // BEAMNO is 0-base
     674      *scannoCol = scanno ;
     675      RecordFieldPtr<uInt> cyclenoCol(rec, "CYCLENO") ;
     676      *cyclenoCol = cycleno ;
    625677      RecordFieldPtr<uInt> beamCol(rec, "BEAMNO") ;
    626       string arryt = string( d->ARRYT ) ;
    627       string sbeamno = arryt.substr( 1, arryt.size()-1 ) ;
    628       uInt ibeamno = atoi( sbeamno.c_str() ) ;
    629       *beamCol = ibeamno - 1 ;
    630       RecordFieldPtr<Int> rbCol(rec, "REFBEAMNO") ;
     678      *beamCol = beamno ;
    631679      RecordFieldPtr<uInt> ifCol(rec, "IFNO") ;
     680      RecordFieldPtr< uInt > polnoCol(rec, "POLNO") ;
     681      *polnoCol = polno ;
    632682      RecordFieldPtr<uInt> mfreqidCol(rec, "FREQ_ID") ;
    633       vector<double> fqs = nreader_->getFrequencies( i ) ;
    634       //cout << "STFiller::readNRO()  fqs[1] = " << fqs[1] << endl ;
    635683      if ( freqs.size() == 0 ) {
    636684        id = table_->frequencies().addEntry( Double( fqs[0] ),
     
    666714      }
    667715      RecordFieldPtr<uInt> molidCol(rec, "MOLECULE_ID") ;
    668       Vector<Double> restfreq( IPosition( 1, 1 ) ) ;
    669       restfreq( 0 ) = d->FREQ0 ;
    670716      id = table_->molecules().addEntry( restfreq ) ;
    671717      *molidCol = id ;
     718      RecordFieldPtr<Int> rbCol(rec, "REFBEAMNO") ;
     719      *rbCol = refbeamno ;
     720      RecordFieldPtr<Double> mjdCol( rec, "TIME" ) ;
     721      *mjdCol = scantime ;
     722      RecordFieldPtr<Double> intervalCol( rec, "INTERVAL" ) ;
     723      *intervalCol = interval ;
     724      RecordFieldPtr<String> srcnCol(rec, "SRCNAME") ;
     725      *srcnCol = srcname ;
     726      RecordFieldPtr<Int> srctCol(rec, "SRCTYPE") ;
     727      *srctCol = srcType ;     
     728      RecordFieldPtr<String> fieldnCol(rec, "FIELDNAME");
     729      *fieldnCol = fieldname ;
     730      RecordFieldPtr< Array<Float> > specCol(rec, "SPECTRA") ;
     731      *specCol = spectra ;
     732      RecordFieldPtr< Array<uChar> > flagCol(rec, "FLAGTRA") ;
     733      *flagCol = flagtra ;
     734      RecordFieldPtr< Array<Float> > tsysCol(rec, "TSYS") ;
     735      *tsysCol = tsys ;
     736      RecordFieldPtr< Array<Double> > dirCol(rec, "DIRECTION") ;
     737      *dirCol = direction ;
     738      RecordFieldPtr<Float> azCol(rec, "AZIMUTH") ;
     739      *azCol = azimuth ;
     740      RecordFieldPtr<Float> elCol(rec, "ELEVATION") ;
     741      *elCol = elevation ;
     742      RecordFieldPtr<Float> parCol(rec, "PARANGLE") ;
     743      *parCol = parangle ;
     744      RecordFieldPtr<Float> tauCol(rec, "OPACITY") ;
     745      *tauCol = opacity ;
    672746      RecordFieldPtr<uInt> mcalidCol(rec, "TCAL_ID") ;
    673       //
    674       // No Tcal information in the data
    675       //
    676       // 2008/11/20 Takeshi Nakazato
    677       //
    678       *mcalidCol = 0 ;
     747      *mcalidCol = tcalid ;
     748      RecordFieldPtr<Int> fitCol(rec, "FIT_ID") ;
     749      *fitCol = fitid ;
     750      RecordFieldPtr<uInt> mfocusidCol(rec, "FOCUS_ID") ;
     751      *mfocusidCol = focusid ;
    679752      RecordFieldPtr<uInt> mweatheridCol(rec, "WEATHER_ID") ;
    680 
    681       id = table_->weather().addEntry( Float( d->TEMP ),
    682                                        Float( d->PATM ),
    683                                        Float( d->PH2O ),
    684                                        Float( d->VWIND ),
    685                                        Float( d->DWIND ) ) ;
    686 
     753      id = table_->weather().addEntry( temperature,
     754                                       pressure,
     755                                       humidity,
     756                                       windvel,
     757                                       winddir ) ;
    687758      *mweatheridCol = id ;         
    688       RecordFieldPtr<uInt> mfocusidCol(rec, "FOCUS_ID") ;
    689       RecordFieldPtr< Array<Double> > dirCol(rec, "DIRECTION") ;
    690       *dirCol = nreader_->getDirection( i ) ;
    691       RecordFieldPtr<Float> azCol(rec, "AZIMUTH") ;
    692       *azCol = d->RAZ ;
    693       RecordFieldPtr<Float> elCol(rec, "ELEVATION") ;
    694       *elCol = d->REL ;
    695       RecordFieldPtr<Float> parCol(rec, "PARANGLE") ;
    696       RecordFieldPtr< Array<Float> > specCol(rec, "SPECTRA") ;
    697       vector<double> spec = nreader_->getSpectrum( i ) ;
    698       Array<Float> sp( IPosition( 1, spec.size() ) ) ;
    699       int index = 0 ;
    700       for ( Array<Float>::iterator itr = sp.begin() ; itr != sp.end() ; itr++ ) {
    701         *itr = spec[index++] ;
    702       }
    703       *specCol = sp ;
    704       RecordFieldPtr< Array<uChar> > flagCol(rec, "FLAGTRA") ;
    705       Array<uChar> flag( sp.shape() ) ;
    706       flag.set( 0 ) ;
    707       *flagCol = flag ;
    708       RecordFieldPtr< uInt > polnoCol(rec, "POLNO") ;
    709       *polnoCol = 0 ;
    710       RecordFieldPtr< Array<Float> > tsysCol(rec, "TSYS") ;
    711       Array<Float> tsys( IPosition( 1, 1 ), d->TSYS ) ;
    712       *tsysCol = tsys ;
     759      RecordFieldPtr<Double> svelCol(rec, "SRCVELOCITY") ;
     760      *svelCol = srcvel ;
     761      RecordFieldPtr<Array<Double> > spmCol(rec, "SRCPROPERMOTION") ;
     762      *spmCol = propermotion ;
     763      RecordFieldPtr<Array<Double> > sdirCol(rec, "SRCDIRECTION") ;
     764      *sdirCol = srcdir ;
     765      RecordFieldPtr<Array<Double> > srateCol(rec, "SCANRATE");
     766      *srateCol = scanrate ;
    713767
    714768      table_->table().addRow() ;
Note: See TracChangeset for help on using the changeset viewer.