Ignore:
Timestamp:
08/04/11 12:58:21 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: No

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: Describe your changes here...

Preparation for check in tuning on NRO filler.
Merge changes in trunk.

r2154
r2156
r2158
r2198-2203
r2212
r2261


Location:
branches/parallel
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/parallel

  • branches/parallel/external-alma

  • branches/parallel/external-alma/atnf/PKSIO/ASTEReader.cc

    r1868 r2262  
    118118}
    119119
     120Int ASTEReader::getNumIF()
     121{
     122  vector<Bool> v ;
     123  vector<int> arry = dataset_->getARRY() ;
     124  for ( uInt i = 0 ; i < arry.size() ; i++ ) {
     125    if ( arry[i] != 0 ) {
     126      v.push_back( True ) ;
     127    }
     128  }
     129  Int nif = v.size() ;
     130  return nif ;
     131}
     132
     133Int ASTEReader::getNumBeam()
     134{
     135  // ASTE doesn't have array receiver so far
     136  return 1 ;
     137}
  • branches/parallel/external-alma/atnf/PKSIO/ASTEReader.h

    r1757 r2262  
    8181  virtual int read() ;
    8282
     83  // get number of IF
     84  virtual Int getNumIF() ;
     85
     86  // get number of Beams
     87  virtual Int getNumBeam() ;
     88
    8389 protected:
    8490  // Get Antenna Position in ITRF coordinate
  • branches/parallel/external-alma/atnf/PKSIO/NRO45Reader.cc

    r1868 r2262  
    124124}
    125125
     126Int NRO45Reader::getNumIF()
     127{
     128  Int nif = 1 ;
     129  if ( (dataset_->getRX()[0]).find("MULT2-") == string::npos ) {
     130    vector<Bool> v ;
     131    vector<int> arry = dataset_->getARRY() ;
     132    for ( uInt i = 0 ; i < arry.size() ; i++ ) {
     133      if ( arry[i] != 0 ) {
     134        v.push_back( True ) ;
     135      }
     136    }
     137    nif = v.size() ;
     138  }
     139  return nif ;
     140}
     141
     142Int NRO45Reader::getNumBeam()
     143{
     144  Int nbeam = 25 ;
     145  if ( (dataset_->getRX()[0]).find("MULT2-") == string::npos ) {
     146    nbeam = 1 ;
     147  }
     148  return nbeam ;
     149}
  • branches/parallel/external-alma/atnf/PKSIO/NRO45Reader.h

    r1757 r2262  
    8383  virtual int read() ;
    8484
     85  // get number of IF
     86  virtual Int getNumIF() ;
     87
     88  // get number of Beams
     89  virtual Int getNumBeam() ;
     90
    8591 protected:
    8692  // Get Antenna Position in ITRF coordinate
  • branches/parallel/external-alma/atnf/PKSIO/NRODataset.cc

    r2031 r2262  
    8383  }
    8484  same_ = -1 ;
     85
     86  // Record for frequency setting
     87  frec_ = Record() ;
    8588}
    8689
     
    602605}
    603606
     607double NRODataset::getScanTime( int i )
     608{
     609  double startTime = getStartIntTime( i ) ;
     610  double interval = getIPTIM() / 86400.0 ; // [sec]->[day]
     611  return startTime+0.5*interval ;
     612}
     613
    604614vector<bool> NRODataset::getIFs()
    605615{
     
    657667  NRODataRecord *record = getRecord( i ) ;
    658668  string arryt = string( record->ARRYT ) ;
    659   //string sbeamno = arryt.substr( 1, arryt.size()-1 ) ;
    660   //uInt ib = atoi( sbeamno.c_str() ) - 1 ;
    661669  uInt ib = getArrayId( arryt ) ;
    662 
    663   int ia = -1 ;
     670  string rxname = getRX()[0] ;
     671  string key = arryt ;
     672  if ( rxname.find("MULT2") != string::npos )
     673    key = "BEARS" ;
     674
     675  if ( frec_.isDefined( key ) ) {
     676    // frequency for the array is already calculated
     677    Vector<Double> f =  frec_.asArrayDouble( key ) ;
     678    Double *f_p = f.data() ;
     679    for ( int i = 0 ; i < 3 ; i++ )
     680      v[i] = (double)(f_p[i]) ;
     681    return v ;
     682  }
     683
     684  //int ia = -1 ;
    664685  bool isAOS = false ;
    665686  //cout << "NRODataset::getFrequencies()  record->ARRYT=" << record->ARRYT << endl ;
    666687  //cout << "NRODataset::getFrequencies()  ib = " << ib << endl ;
    667688
    668   if ( strncmp( record->ARRYT, "X", 1 ) == 0 ) {
    669     // FX
    670     if ( strncmp( (record->ARRYT)+1, "1", 1 ) == 0
    671          || strncmp( (record->ARRYT)+1, "3", 1 ) ) {
    672       // FX1, 3
    673       ia = 2 ;
    674     }
    675     else {
    676       // FX2, 4
    677       ia = 1 ;
    678     }
    679   }
    680   else if ( strncmp( record->ARRYT, "A", 1 ) == 0 )
    681     ia = 2 ;  // AC
    682   else if ( strncmp( record->ARRYT, "W", 1 ) == 0 ) {
    683     // AOS-W   
    684     ia = 2 ; 
     689  if ( arryt[0] == 'W' || arryt[0] == 'U' || arryt[0] == 'H' )
    685690    isAOS = true ;
    686   }
    687   else if ( strncmp( record->ARRYT, "U", 1 ) == 0 ) {
    688     // AOS-U
    689     ia = 2 ; 
    690     isAOS = true ;
    691   }
    692   else if ( strncmp( record->ARRYT, "H", 1 ) == 0 ) {
    693     // AOS-H
    694     isAOS = true ;
    695     //cout << record->ARRYT << " " <<  strlen(record->ARRYT) << endl ;
    696     //cout << (record->ARRYT)+1 << endl ;
    697     if ( strncmp( (record->ARRYT)+2, " ", 1 ) == 0 ) {
    698       // H1-9
    699       if ( strncmp( (record->ARRYT)+1, "9", 1 ) == 0 ) {
    700         // H9
    701         ia = 2 ;
    702       }
    703       else {
    704         // H1-8
    705         ia = 1 ;
    706       }
    707     }
    708     else {
    709       // H10-16
    710       ia = 2 ;
    711     }
    712   }
    713 
    714   int iu ;
     691
     692  Bool isUSB ;
    715693  if ( record->FQIF1 > 0 )
    716     iu = 1 ;  // USB
     694    isUSB = True ;  // USB
    717695  else
    718     iu = 2 ;  // LSB
     696    isUSB = False ;  // LSB
    719697
    720698  int ivdef = -1 ;
    721   //if ( strncmp( (dataset_->getVDEF()).c_str(), "RAD", 3 ) == 0 )
    722699  if ( (getVDEF()).compare( 0, 3, "RAD" ) == 0 )
    723700    ivdef = 0 ;
    724   //else if ( strncmp( dataset_->getVDEF(), "OPT", 3 ) == 0 )
    725701  else if ( (getVDEF()).compare( 0, 3, "OPT" ) == 0 )
    726702    ivdef = 1 ;
     
    734710
    735711  int ncal = getNFCAL()[ib] ;
    736   vector<double> freqs( ncal ) ;
    737712  double cw = 0.0 ;
    738713  vector<double> fqcal = getFQCAL()[ib] ;
    739714  vector<double> chcal = getCHCAL()[ib] ;
    740 
     715  double f0cal = getF0CAL()[ib] ;
     716  Vector<Double> freqs( ncal, fq0-f0cal ) ;
     717
     718  double factor = vel / cvel ;
     719  if ( ivdef == 0 )
     720    factor = 1.0 / ( 1.0 - factor ) ;
    741721  for ( int ii = 0 ; ii < ncal ; ii++ ) {
    742     freqs[ii] = fqcal[ii] ;
    743     freqs[ii] -= getF0CAL()[ib] ;
    744     if ( ia == 1 ) {
    745       if ( iu == 1 ) {
    746         freqs[ii] = fq0 + freqs[ii] ;
    747       }
    748       else if ( iu == 2 ) {
    749         freqs[ii] = fq0 - freqs[ii] ;
    750       }
    751     }
    752     else if ( ia == 2 ) {
    753       if ( iu == 1 ) {
    754         freqs[ii] = fq0 - freqs[ii] ;
    755       }
    756       else if ( iu == 2 ) {
    757         freqs[ii] = fq0 + freqs[ii] ;
    758       }
    759     }     
    760 //       if ( ivdef == 0 ) {
    761 //         double factor = 1.0 / ( 1.0 - vel / cvel ) ;
    762 //         freqs[ii] = freqs[ii] * factor - record->FQTRK * ( factor - 1.0 ) ;
    763 //       }
    764 //       else if ( ivdef == 1 ) {
    765 //         double factor = vel / cvel ;
    766 //         freqs[ii] = freqs[ii] * ( 1.0 + factor ) - record->FQTRK * factor ;
    767 //       }
     722    freqs[ii] += fqcal[ii] ;
     723    if ( ivdef == 0 ) {
     724      freqs[ii] = freqs[ii] * factor + record->FQTRK * ( 1.0 - factor ) ;
     725    }
     726    else if ( ivdef == 1 ) {
     727      freqs[ii] = freqs[ii] * ( 1.0 + factor ) - record->FQTRK * factor ;
     728    }
     729
     730    //ofstream ofs("freqs.txt",ios::out|ios::app) ;
     731    //ofs << setprecision(16) ;
     732    //ofs << i << " " << record->ARRYT << " " << chcal[ii] << " " << freqs[ii] << " " << record->ISCAN << " " << fqcal[ii] << " " << f0cal << " " << record->FQTRK << " " << vel << endl ;
     733    //ofs.close() ;
     734
    768735  }
    769736
     
    790757  }
    791758  else {
    792     cw = getBERES()[ib] ;
     759
     760    cw = ( freqs[1] - freqs[0] )
     761      / ( chcal[1] - chcal[0] ) ;   
     762
     763    if ( isUSB ) {
     764      // channel frequency inversion
     765      cw *= -1.0 ;
     766      Double tmp = freqs[1] ;
     767      freqs[1] = freqs[0] ;
     768      freqs[0] = tmp ;
     769    }
    793770   
    794     if ( iu == 2 )
    795       cw *= -1.0 ;
    796 
    797     if ( cw == 0.0 ) {
    798       cw = ( freqs[1] - freqs[0] )
    799         / ( chcal[1] - chcal[0] ) ;
    800 //           if ( cw < 0.0 )
    801 //             cw = - cw ;
    802     }
    803771    v[0] = chcal[0] - 1 ; // 0-base
    804772    v[1] = freqs[0] ;
     
    806774  }
    807775
    808   // conversion from TOPO to LSRK
    809   v[1] = toLSR( v[1], getStartIntTime( i ), record_->SCX, record_->SCY ) ;
    810 
    811   if ( refFreq_[ib] != 0.0 ) {
    812     v[1] = refFreq_[ib] ;
    813   }
    814   else {
     776  if ( refFreq_[ib] == 0.0 )
    815777    refFreq_[ib] = v[1] ;
    816   }
     778
     779  // register frequency setting to Record
     780  Vector<Double> f( v ) ;
     781  frec_.define( key, f ) ;
    817782
    818783  return v ;
  • branches/parallel/external-alma/atnf/PKSIO/NRODataset.h

    r1868 r2262  
    4141//#include <casa/aips.h>
    4242#include <casa/Logging/LogIO.h>
     43#include <casa/Containers/Record.h>
    4344#include <atnf/PKSIO/NRODataRecord.h>
    4445#include <casa/namespace.h>
     
    194195  virtual vector<double> getStartIntTime() ;
    195196  virtual double getStartIntTime( int i ) ;
     197  virtual double getScanTime( int i ) ;
    196198  virtual double getMJD( char *time ) ;
    197199  virtual vector<bool> getIFs() ;
     
    512514  // reference frequency for each array
    513515  vector<double> refFreq_ ;
     516
     517  // record to store REFPIX, REFVAL, INCREMENT pair for each array
     518  Record frec_ ;
    514519} ;
    515520
  • branches/parallel/external-alma/atnf/PKSIO/NROFITSDataset.cc

    r1869 r2262  
    622622//   for ( int i = 0 ; i < ARYNM ; i++ ) {
    623623//     if ( i == 0 ) {
    624 //       //cout << "RX      " ;
     624//       cout << "RX      " ;
    625625//     }
    626626//     else if ( ( i % 5 ) == 0 ) {
    627 //       //cout << endl << "        " ;
    628 //     }
    629 //     //cout << "\'" << RX[i] << "\' " ;
     627//       cout << endl << "        " ;
     628//     }
     629//     cout << "\'" << RX[i] << "\' " ;
    630630//   }
    631 //   //cout << endl ;
     631//   cout << endl ;
    632632  //
    633633  if ( readColumn( HPBW, "HPBW", sameEndian ) != 0 ) {
     
    27342734}
    27352735
     2736double NROFITSDataset::getScanTime( int i )
     2737{
     2738  double startTime = getStartIntTime( i ) ;
     2739  double interval = getIPTIM() ;
     2740  interval /= 86400.0 ;
     2741  return startTime+0.5*interval ;
     2742}
     2743
    27362744// double NROFITSDataset::toLSR( double v, double t, double x, double y )
    27372745// {
  • branches/parallel/external-alma/atnf/PKSIO/NROFITSDataset.h

    r1868 r2262  
    9696  virtual uInt getArrayId( string type ) ;
    9797  virtual double getStartIntTime( int i ) ;
     98  virtual double getScanTime( int i ) ;
    9899
    99100 protected:
  • branches/parallel/external-alma/atnf/PKSIO/NROReader.cc

    r1868 r2262  
    3939#include <atnf/PKSIO/ASTEDataset.h>
    4040
     41#include <measures/Measures/MEpoch.h>
     42#include <measures/Measures/MPosition.h>
    4143#include <measures/Measures/MDirection.h>
    4244#include <measures/Measures/MCDirection.h>
     45#include <measures/Measures/MeasFrame.h>
    4346#include <measures/Measures/MeasConvert.h>
    4447
     
    314317    //<< srcra << "," << srcdec << ") B1950 to ("
    315318    //<< v( 0 ) << ","<< v( 1 ) << ") J2000" << endl ;
    316     os << LogIO::NORMAL << "SRCDIRECTION convert from ("
    317        << srcra << "," << srcdec << ") B1950 to ("
    318        << v( 0 ) << ","<< v( 1 ) << ") J2000" << LogIO::POST ;
     319    //os << LogIO::NORMAL << "SRCDIRECTION convert from ("
     320    //   << srcra << "," << srcdec << ") B1950 to ("
     321    //   << v( 0 ) << ","<< v( 1 ) << ") J2000" << LogIO::POST ;
    319322  }
    320323  else if ( strncmp( epoch, "J2000", 5 ) == 0 ) {
     
    353356    //<< dirx << "," << diry << ") LB to ("
    354357    //<< v( 0 ) << ","<< v( 1 ) << ") RADEC" << endl ;
    355     os << LogIO::NORMAL << "DIRECTION convert from ("
    356        << dirx << "," << diry << ") LB to ("
    357        << v( 0 ) << ","<< v( 1 ) << ") RADEC" << LogIO::POST ;
     358    //os << LogIO::NORMAL << "DIRECTION convert from ("
     359    //   << dirx << "," << diry << ") LB to ("
     360    //   << v( 0 ) << ","<< v( 1 ) << ") RADEC" << LogIO::POST ;
    358361  }
    359362  else if ( icoord == 2 ) {
    360363    // convert from AZEL to RADEC
     364    vector<double> antpos = getAntennaPosition() ;
     365    Vector<Quantity> qantpos( 3 ) ;
     366    for ( int ip = 0 ; ip < 3 ; ip++ )
     367      qantpos[ip] = Quantity( antpos[ip], "m" ) ;
     368    Double scantime = Double( dataset_->getScanTime( i ) ) ;
     369    MEpoch me( Quantity( scantime, "d" ), MEpoch::UTC ) ;
     370    MPosition mp( MVPosition( qantpos ), MPosition::ITRF ) ;
     371    MeasFrame mf( me, mp ) ;
    361372    MDirection result =
    362373      MDirection::Convert( MDirection( Quantity( dirx, "rad" ),
    363374                                       Quantity( diry, "rad" ),
    364375                                       MDirection::Ref( MDirection::AZEL ) ),
    365                            MDirection::Ref( MDirection::J2000 ) ) () ;
     376                           MDirection::Ref( MDirection::J2000, mf ) ) () ;
    366377    v = result.getAngle().getValue() ;
    367378    //cout << "NROReader::getDirection()  DIRECTION convert from ("
    368379    //<< dirx << "," << diry << ") AZEL to ("
    369380    //<< v( 0 ) << ","<< v( 1 ) << ") RADEC" << endl ;
    370     os << LogIO::NORMAL << "DIRECTION convert from ("
    371        << dirx << "," << diry << ") AZEL to ("
    372        << v( 0 ) << ","<< v( 1 ) << ") RADEC" << LogIO::POST ;
     381    //os << LogIO::NORMAL << "DIRECTION convert from ("
     382    //   << dirx << "," << diry << ") AZEL to ("
     383    //   << v( 0 ) << ","<< v( 1 ) << ") RADEC" << LogIO::POST ;
    373384  }
    374385  else if ( icoord == 0 ) {
     
    387398      //<< dirx << "," << diry << ") B1950 to ("
    388399      //<< v( 0 ) << ","<< v( 1 ) << ") J2000" << endl ;
    389       os << LogIO::NORMAL << "DIRECTION convert from ("
    390          << dirx << "," << diry << ") B1950 to ("
    391          << v( 0 ) << ","<< v( 1 ) << ") J2000" << LogIO::POST ;
     400      //os << LogIO::NORMAL << "DIRECTION convert from ("
     401      //   << dirx << "," << diry << ") B1950 to ("
     402      //   << v( 0 ) << ","<< v( 1 ) << ") J2000" << LogIO::POST ;
    392403    }
    393404    else if ( strncmp( epoch, "J2000", 5 ) == 0 ) {
     
    441452  //cout << "antpos = " << antpos << endl ;
    442453  string eq = dataset_->getEPOCH() ;
    443   if ( eq.compare( 0, 5, "B1950" ) == 0 )
    444     equinox = 1950.0 ;
    445   else if ( eq.compare( 0, 5, "J2000" ) == 0 )
    446     equinox = 2000.0 ;
     454//   if ( eq.compare( 0, 5, "B1950" ) == 0 )
     455//     equinox = 1950.0 ;
     456//   else if ( eq.compare( 0, 5, "J2000" ) == 0 )
     457//     equinox = 2000.0 ;
     458  // equinox is always 2000.0
     459  equinox = 2000.0 ;
    447460  //cout << "equinox = " << equinox << endl ;
    448461  string vref = dataset_->getVREF() ;
     
    456469  }
    457470  //freqref = vref ;
    458   freqref = "LSRK" ;
     471  //freqref = "LSRK" ;
     472  freqref = "REST" ;
    459473  //cout << "freqref = " << freqref << endl ;
    460474  NRODataRecord *record = dataset_->getRecord( 0 ) ;
     
    483497  //cout << "poltype = " << poltype << endl ;
    484498
    485   vector<Bool> ifs = getIFs() ;
    486   nif = ifs.size() ;
     499  //vector<Bool> ifs = getIFs() ;
     500  //nif = ifs.size() ;
     501  nif = getNumIF() ;
    487502  //cout << "nif = " << nif << endl ;
    488503
    489   vector<Bool> beams = getBeams() ;
    490   nbeam = beams.size() ;
     504  //vector<Bool> beams = getBeams() ;
     505  //nbeam = beams.size() ;
     506  nbeam = getNumBeam() ;
    491507  //cout << "nbeam = " << nbeam << endl ;
    492508
     
    505521                            uInt &scanno,
    506522                            uInt &cycleno,
     523                            uInt &ifno,
    507524                            uInt &beamno,
    508525                            uInt &polno,
     
    548565  //cout << "cycleno = " << cycleno << endl ;
    549566
    550   // beamno
    551   string arryt = string( record->ARRYT ) ;
    552   string sbeamno = arryt.substr( 1, arryt.size()-1 ) ;
    553   uInt ibeamno = atoi( sbeamno.c_str() ) ;
    554   beamno = ibeamno - 1 ;
     567  // beamno and ifno
     568  string rxname = dataset_->getRX()[0] ;
     569  if ( rxname.find("MULT2") != string::npos ) {
     570    string arryt = string( record->ARRYT ) ;
     571    beamno = dataset_->getArrayId( arryt ) ;
     572    ifno = 0 ;
     573  }
     574  else {
     575    beamno = 0 ;
     576    string arryt = string( record->ARRYT ) ;
     577    ifno = dataset_->getArrayId( arryt ) ;
     578  }
    555579  //cout << "beamno = " << beamno << endl ;
    556580
     
    575599
    576600  // scantime
    577   scantime = Double( dataset_->getStartIntTime( irow ) ) ;
     601  //scantime = Double( dataset_->getStartIntTime( irow ) ) ;
     602  scantime = Double( dataset_->getScanTime( irow ) ) ;
    578603  //cout << "scantime = " << scantime << endl ;
    579604
  • branches/parallel/external-alma/atnf/PKSIO/NROReader.h

    r1757 r2262  
    129129                           uInt &scanno,
    130130                           uInt &cycleno,
     131                           uInt &ifno,
    131132                           uInt &beamno,
    132133                           uInt &polno,
     
    171172  virtual vector<Bool> getIFs() ;
    172173
     174  // Get Number of IFs
     175  virtual Int getNumIF() = 0 ;
     176
    173177  // Get Beam settings
    174178  virtual vector<Bool> getBeams() ;
     179
     180  // Get Number of Beams
     181  virtual Int getNumBeam() = 0 ;
    175182
    176183 protected:
  • branches/parallel/external-alma/atnf/pks/pks_maths.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.