Changeset 1868


Ignore:
Timestamp:
08/10/10 12:28:15 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): atnf

Description: Describe your changes here...

Sync with code/atnf/implement/PKSIO


Location:
trunk/external-alma/atnf/PKSIO
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/atnf/PKSIO/ASTEDataset.cc

    r1757 r1868  
    124124    + sizeof( char ) * 116                       // CDMY1
    125125    + sizeof( double ) * ASTE_ARYMAX ;           // DSBFC
     126
     127  refFreq_.resize( ASTE_ARYMAX, 0.0 ) ;
    126128}
    127129
  • trunk/external-alma/atnf/PKSIO/ASTEFXDataset.cc

    r1757 r1868  
    124124    + sizeof( char ) * 116                          // CDMY1
    125125    + sizeof( double ) * ASTE_ARYMAX_FX ;           // DSBFC
     126
     127  refFreq_.resize( ASTE_ARYMAX_FX, 0.0 ) ;
    126128}
    127129
  • trunk/external-alma/atnf/PKSIO/ASTEReader.cc

    r1757 r1868  
    8888  // Ref.: Ezawa, H. et al. 2004, Proc. SPIE, 5489, 763
    8989  //
    90   double elon = -67. - 42. / 60. - 11. / 3600. ;
    91   double nlat = -22. - 58. / 60. - 18. / 3600. ;
    92   double alti = 2400. ;
     90  // double elon = -67. - 42. / 60. - 11. / 3600. ;
     91  // double nlat = -22. - 58. / 60. - 18. / 3600. ;
     92  // double alti = 2400. ;
     93  double elon = -67.7031 ;
     94  double nlat = -22.9717 ;
     95  double alti = 4800.0 ;
    9396
    9497  // APEX value
     
    101104                           Quantity( nlat, "deg" ) ),
    102105               MPosition::Ref( MPosition::WGS84 ) ) ;
     106
    103107  MeasFrame frame( p ) ;
    104108  MVPosition mvp ;
  • trunk/external-alma/atnf/PKSIO/MBFITSreader.cc

    r1757 r1868  
    146146  if (rpfitsin(jstat)) {
    147147    sprintf(cMsg, "Failed to open MBFITS file\n%s", rpname);
    148     os << LogIO::SEVERE << cMsg << LogIO::POST ;
     148    //os << LogIO::SEVERE << cMsg << LogIO::POST ;
    149149    return 1;
    150150  }
     
    165165    sprintf(cMsg, "Failed to read MBFITS header in file\n"
    166166                  "%s", rpname);
    167     os << LogIO::SEVERE << cMsg << LogIO::POST ;
     167    //os << LogIO::SEVERE << cMsg << LogIO::POST ;
    168168    close();
    169169    return 1;
  • trunk/external-alma/atnf/PKSIO/MBrecord.cc

    r1757 r1868  
    3737
    3838#include <atnf/PKSIO/MBrecord.h>
     39#include <atnf/PKSIO/SrcType.h>
    3940
    4041#include <string.h>
     
    5859  decRate = 0.0f;
    5960  nIF     = 0;
     61
     62  srcType = SrcType::NOTYPE ;
     63  srcVelocity = 0.0 ;
    6064}
    6165
     
    325329  srcVelocity = other.srcVelocity ;
    326330
     331  srcType = other.srcType ;
     332
    327333  return *this;
    328334}
     
    442448  srcVelocity = other.srcVelocity ;
    443449
     450  srcType = other.srcType ;
     451
    444452  return 0;
    445453}
  • trunk/external-alma/atnf/PKSIO/MBrecord.h

    r1757 r1868  
    167167                                // mode (added 1999/03/17).
    168168    int polNo ;                 // polarization ID
    169     float srcVelocity ;         // source velocity w.r.t. reference frame
     169    double srcVelocity ;        // source velocity w.r.t. reference frame
     170
     171    int srcType ;               // source type
    170172
    171173  private:
  • trunk/external-alma/atnf/PKSIO/NRO45Reader.cc

    r1757 r1868  
    9393  // (conversion is done by http://vldb.gsi.go.jp/sokuchi/tky2jgd/)
    9494 
    95   double elon = 138. + 28. / 60. + 9.96444 / 3600. ;
    96   double nlat = 35. + 56. / 60. + 52.3314 / 3600. ;
    97   double alti = 1350. ;
     95//   double elon = 138. + 28. / 60. + 9.96444 / 3600. ;
     96//   double nlat = 35. + 56. / 60. + 52.3314 / 3600. ;
     97//   double alti = 1350. ;
    9898
    99   MPosition p( MVPosition( Quantity( alti, "m" ),
    100                            Quantity( elon, "deg" ),
    101                            Quantity( nlat, "deg" ) ),
    102                MPosition::Ref( MPosition::WGS84 ) ) ;
     99//   Double elon = 138.4725 ;
     100//   Double nlat = 35.9445 ;
     101//   Double alti = 1412.599 ;
     102
     103//   MPosition p( MVPosition( Quantity( alti, "m" ),
     104//                            Quantity( elon, "deg" ),
     105//                            Quantity( nlat, "deg" ) ),
     106//                MPosition::Ref( MPosition::WGS84 ) ) ;
     107
     108  Double posx = -3.8710235e6 ;
     109  Double posy = 3.4281068e6 ;
     110  Double posz = 3.7240395e6 ;
     111  MPosition p( MVPosition( posx, posy, posz ),
     112               MPosition::ITRF ) ;
     113
    103114  MeasFrame frame( p ) ;
    104115  MVPosition mvp ;
  • trunk/external-alma/atnf/PKSIO/NRODataset.cc

    r1757 r1868  
    3434#include <casa/OS/Time.h>
    3535#include <scimath/Mathematics/InterpolateArray1D.h>
     36
     37#include <measures/Measures/MeasConvert.h>
     38#include <measures/Measures/MCFrequency.h>
     39#include <measures/Measures/MFrequency.h>
     40#include <measures/Measures/MPosition.h>
     41#include <measures/Measures/MEpoch.h>
     42#include <measures/Measures/MDirection.h>
    3643
    3744#include <math.h>
     
    796803  }
    797804
     805  // conversion from TOPO to LSRK
     806  v[1] = toLSR( v[1], getStartIntTime( i ), record_->SCX, record_->SCY ) ;
     807
     808  if ( refFreq_[ib] != 0.0 ) {
     809    v[1] = refFreq_[ib] ;
     810  }
     811  else {
     812    refFreq_[ib] = v[1] ;
     813  }
     814
    798815  return v ;
    799816}
     
    820837
    821838}
     839
     840double NRODataset::toLSR( double v, double t, double x, double y )
     841{
     842  double vlsr ;
     843
     844  // get epoch
     845  double tcent = t + 0.5*getIPTIM()/86400.0 ;
     846  MEpoch me( Quantity( tcent, "d" ), MEpoch::UTC ) ;
     847
     848  // get antenna position
     849  MPosition mp ;
     850  if ( SITE.find( "45" ) != string::npos ) {
     851    // 45m telescope
     852    Double posx = -3.8710235e6 ;
     853    Double posy = 3.4281068e6 ;
     854    Double posz = 3.7240395e6 ;
     855    mp = MPosition( MVPosition( posx, posy, posz ),
     856                    MPosition::ITRF ) ;
     857  }
     858  else {
     859    // ASTE
     860    Vector<Double> pos( 2 ) ;
     861    pos[0] = -67.7031 ;
     862    pos[1] = -22.9717 ;
     863    Double sitealt = 4800.0 ;
     864    mp = MPosition( MVPosition( Quantity( sitealt, "m" ),
     865                                Quantum< Vector<Double> >( pos, "deg" ) ),
     866                    MPosition::WGS84 ) ;
     867  }
     868
     869  // get direction
     870  MDirection md ;
     871  if ( SCNCD == 0 ) {
     872    // RADEC
     873    if ( EPOCH == "B1950" ) {
     874      md = MDirection( Quantity( Double(x), "rad" ), Quantity( Double(y), "rad" ),
     875                       MDirection::B1950 ) ;
     876    }
     877    else {
     878      md = MDirection( Quantity( Double(x), "rad" ), Quantity( Double(y), "rad" ),
     879                       MDirection::J2000 ) ;
     880    }
     881  }
     882  else if ( SCNCD == 1 ) {
     883    // LB
     884    md = MDirection( Quantity( Double(x), "rad" ), Quantity( Double(y), "rad" ),
     885                     MDirection::GALACTIC ) ;
     886  }
     887  else {
     888    // AZEL
     889    md = MDirection( Quantity( Double(x), "rad" ), Quantity( Double(y), "rad" ),
     890                     MDirection::AZEL ) ;
     891  }
     892   
     893  // to LSR
     894  MeasFrame mf( me, mp, md ) ;
     895  MFrequency::Convert tolsr( MFrequency::TOPO, MFrequency::Ref( MFrequency::LSRK, mf ) ) ;
     896  vlsr = (double)(tolsr( Double(v) ).get( "Hz" ).getValue()) ;
     897
     898  return vlsr ;
     899}
  • trunk/external-alma/atnf/PKSIO/NRODataset.h

    r1757 r1868  
    233233  void show() ;
    234234
     235  // convert frequency frame
     236  virtual double toLSR( double v, double t, double x, double y ) ;
     237
    235238  // Type of file record
    236239  string LOFIL ;
     
    506509  // Logger
    507510  //LogIO os ;
     511
     512  // reference frequency for each array
     513  vector<double> refFreq_ ;
    508514} ;
    509515
  • trunk/external-alma/atnf/PKSIO/NROFITSDataset.cc

    r1757 r1868  
    179179    + sizeof( double ) * ARYNM * 10 * 3    // FQCAL, CHCAL, CWCAL
    180180    + sizeof( char ) * 180 ;               // CDMY1
     181
     182  refFreq_.resize( ARYNM, 0.0 ) ;
    181183}
    182184
     
    11651167  }
    11661168  else {
    1167     sprintf( record_->LAVST, "%d%d%d%d%d%d.000", itmp[0], itmp[1], itmp[2], itmp[3], itmp[4], itmp[5] ) ;
     1169    sprintf( record_->LAVST, "%4d%02d%02d%02d%02d%02d.000", itmp[0], itmp[1], itmp[2], itmp[3], itmp[4], itmp[5] ) ;
    11681170  }
    11691171  // DEBUG
     
    14601462//   //cout << endl ;
    14611463  //
     1464
     1465
     1466  // Update IPTIM since it depends on the row for NROFITS
     1467  int integ ;
     1468  status = readTable( integ, "INTEG", same_, i ) ;
     1469  if ( !status ) {
     1470    IPTIM = (double)integ ;
     1471  }
     1472
    14621473  return status ;
    14631474}
     
    27152726  return ib ;
    27162727}
     2728
     2729double NROFITSDataset::getStartIntTime( int i )
     2730{
     2731  double v ;
     2732  readTable( v, "MJDST", same_, i ) ;
     2733  return v/86400.0 ;
     2734}
     2735
     2736// double NROFITSDataset::toLSR( double v, double t, double x, double y )
     2737// {
     2738//   return v ;
     2739// }
  • trunk/external-alma/atnf/PKSIO/NROFITSDataset.h

    r1757 r1868  
    9595  virtual int getPolarizationNum() ;
    9696  virtual uInt getArrayId( string type ) ;
     97  virtual double getStartIntTime( int i ) ;
    9798
    9899 protected:
     
    153154  int getOffset( char *name ) ;
    154155
     156  // convert frequency frame
     157//   virtual double toLSR( double v, double t, double x, double y ) ;
     158
    155159  // number of column for scan header
    156160  int numField_ ;
  • trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc

    r1757 r1868  
    128128    + sizeof( double ) * NRO_ARYMAX * 10 * 3    // FQCAL, CHCAL, CWCAL
    129129    + sizeof( char ) * 180 ;                    // CDMY1
     130
     131  refFreq_.resize( NRO_ARYMAX, 0.0 ) ;
    130132}
    131133
  • trunk/external-alma/atnf/PKSIO/NROReader.cc

    r1757 r1868  
    455455    }
    456456  }
    457   freqref = vref ;
    458   // DEBUG
    459   freqref = "TOPO" ;
    460   //
     457  //freqref = vref ;
     458  freqref = "LSRK" ;
    461459  //cout << "freqref = " << freqref << endl ;
    462460  NRODataRecord *record = dataset_->getRecord( 0 ) ;
  • trunk/external-alma/atnf/PKSIO/PKSFITSreader.cc

    r1757 r1868  
    3636#include <atnf/PKSIO/MBFITSreader.h>
    3737#include <atnf/PKSIO/SDFITSreader.h>
     38#include <atnf/PKSIO/GBTFITSreader.h>
    3839#include <atnf/PKSIO/PKSFITSreader.h>
    3940#include <atnf/PKSIO/PKSrecord.h>
     
    5859  if (fitsType == "SDFITS") {
    5960    cReader = new SDFITSreader();
     61  } else if (fitsType == "GBTFITS") {
     62    cReader = new GBTFITSreader();
    6063  } else {
    6164    cReader = new MBFITSreader(retry, interpolate ? 1 : 0);
     
    429432    }
    430433  }
     434 
     435  pksrec.srcType = cMBrec.srcType ;
    431436
    432437  pksrec.srcDir.resize(2);
  • trunk/external-alma/atnf/PKSIO/PKSreader.cc

    r1757 r1868  
    8181      buf[30] = '\0';
    8282      if (String(buf) == "SIMPLE  =                    T") {
    83         // Looks like SDFITS.
    84         format = "SDFITS";
    85         reader = new PKSFITSreader("SDFITS");
    86 
     83        file.seek(560);
     84        file.read(26, buf, False);
     85        buf[26] = '\0' ;
     86        if ( String(buf) == "ORIGIN  = 'NRAO Green Bank" ) {
     87          // Looks like GBT SDFITS
     88          format = "GBTFITS" ;
     89          reader = new PKSFITSreader("GBTFITS") ;
     90        }
     91        else {
     92          // Looks like SDFITS.
     93          format = "SDFITS";
     94          reader = new PKSFITSreader("SDFITS");
     95        }
    8796       } else {
    8897         // Assume it's MBFITS.
Note: See TracChangeset for help on using the changeset viewer.