Index: branches/mergetest/external/atnf/PKSIO/PKSFITSreader.cc
===================================================================
--- branches/mergetest/external/atnf/PKSIO/PKSFITSreader.cc	(revision 1777)
+++ branches/mergetest/external/atnf/PKSIO/PKSFITSreader.cc	(revision 1779)
@@ -34,5 +34,4 @@
 //#---------------------------------------------------------------------------
 
-#include <atnf/PKSIO/PKSmsg.h>
 #include <atnf/PKSIO/MBFITSreader.h>
 #include <atnf/PKSIO/SDFITSreader.h>
@@ -44,4 +43,5 @@
 #include <casa/BasicMath/Math.h>
 #include <casa/Quanta/MVTime.h>
+#include <casa/Logging/LogIO.h>
 
 //----------------------------------------------- PKSFITSreader::PKSFITSreader
@@ -61,7 +61,4 @@
     cReader = new MBFITSreader(retry, interpolate ? 1 : 0);
   }
-
-  // By default, messages are written to stderr.
-  initMsg();
 }
 
@@ -76,17 +73,4 @@
 }
 
-//------------------------------------------------------ PKSFITSreader::setMsg
-
-// Set message disposition.  If fd is non-zero messages will be written
-// to that file descriptor, else stored for retrieval by getMsg().
-
-Int PKSFITSreader::setMsg(FILE *fd)
-{
-  PKSmsg::setMsg(fd);
-  cReader->setMsg(fd);
-
-  return 0;
-}
-
 //-------------------------------------------------------- PKSFITSreader::open
 
@@ -95,4 +79,5 @@
 Int PKSFITSreader::open(
         const String fitsName,
+        const String antenna,
         Vector<Bool> &beams,
         Vector<Bool> &IFs,
@@ -103,6 +88,4 @@
         Bool   &haveSpectra)
 {
-  clearMsg();
-
   int    extraSysCal, haveBase_, *haveXPol_, haveSpectra_, nBeam, *nChan_,
          nIF, *nPol_, status;
@@ -110,6 +93,6 @@
                          nChan_, nPol_, haveXPol_, haveBase_, haveSpectra_,
                          extraSysCal);
-  logMsg(cReader->getMsg());
-  cReader->clearMsg();
+  //logMsg(cReader->getMsg());
+  //cReader->clearMsg();
   if (status) {
     return status;
@@ -178,6 +161,6 @@
                               obsType_, bunit_, equinox_, radecsys,
                               dopplerFrame_, datobs, utc, refFreq, bandwidth);
-  logMsg(cReader->getMsg());
-  cReader->clearMsg();
+  //logMsg(cReader->getMsg());
+  //cReader->clearMsg();
   if (status) {
     return 1;
@@ -218,6 +201,6 @@
   Int status = cReader->getFreqInfo(nIF, startfreq, endfreq);
 
-  logMsg(cReader->getMsg());
-  cReader->clearMsg();
+  //logMsg(cReader->getMsg());
+  //cReader->clearMsg();
   if (!status) {
     startFreq.takeStorage(IPosition(1,nIF), startfreq, TAKE_OVER);
@@ -240,4 +223,6 @@
         const Bool getSpectra,
         const Bool getXPol,
+        const Bool getFeedPos,
+        const Bool getPointing,
         const Int  coordSys)
 {
@@ -307,10 +292,12 @@
   cGetSpectra = getSpectra;
   cGetXPol    = getXPol;
+  cGetFeedPos = getFeedPos;
+  cGetPointing = getPointing;
   cCoordSys   = coordSys;
 
   uInt maxNChan = cReader->select(start, end, ref, cGetSpectra, cGetXPol,
-                                  cCoordSys);
-  logMsg(cReader->getMsg());
-  cReader->clearMsg();
+                                  cGetFeedPos, cGetPointing, cCoordSys);
+  //logMsg(cReader->getMsg());
+  //cReader->clearMsg();
 
   delete [] end;
@@ -336,6 +323,6 @@
 
   Int status = cReader->findRange(nRow, nSel, dateSpan, utcSpan, posns);
-  logMsg(cReader->getMsg());
-  cReader->clearMsg();
+  //logMsg(cReader->getMsg());
+  //cReader->clearMsg();
 
   if (!status) {
@@ -361,6 +348,6 @@
 {
   Int status = cReader->read(cMBrec);
-  logMsg(cReader->getMsg());
-  cReader->clearMsg();
+  //logMsg(cReader->getMsg());
+  //cReader->clearMsg();
 
   if (status) {
@@ -378,9 +365,18 @@
   pksrec.scanNo  = cMBrec.scanNo;
   pksrec.cycleNo = cMBrec.cycleNo;
+  pksrec.polNo = cMBrec.polNo ;
 
   // Extract MJD.
   Int day, month, year;
-  sscanf(cMBrec.datobs, "%4d-%2d-%2d", &year, &month, &day);
-  pksrec.mjd = MVTime(year, month, Double(day)).day() + cMBrec.utc/86400.0;
+  if ( strstr( cMBrec.datobs, "T" ) == NULL ) {
+    sscanf(cMBrec.datobs, "%4d-%2d-%2d", &year, &month, &day);
+    pksrec.mjd = MVTime(year, month, Double(day)).day() + cMBrec.utc/86400.0;
+  }
+  else {
+    Double dd, hour, min, sec ;
+    sscanf( cMBrec.datobs, "%4d-%2d-%2lfT%lf:%lf:%lf", &year, &month, &dd, &hour, &min, &sec ) ;
+    dd = dd + ( hour * 3600.0 + min * 60.0 + sec ) / 86400.0 ;
+    pksrec.mjd = MVTime(year, month, dd).day() ;
+  }
 
   pksrec.interval  = cMBrec.exposure;
@@ -388,4 +384,49 @@
   pksrec.fieldName = trim(cMBrec.srcName);
   pksrec.srcName   = pksrec.fieldName;
+
+  int namelen = pksrec.srcName.length() ;
+  if ( namelen > 4 ) {
+    String srcsub = pksrec.srcName.substr( namelen-4, 4 ) ;
+    if ( srcsub.find( "_psc" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_ps_calon" ;
+    }
+    else if ( srcsub.find( "_pso" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_ps" ;
+    }
+    else if ( srcsub.find( "_prc" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_psr_calon" ;
+    }
+    else if ( srcsub.find( "_pro" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_psr" ;
+    }
+    else if ( srcsub.find( "_fsc" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_fs_calon" ;
+    }
+    else if ( srcsub.find( "_fso" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_fs" ;
+    }
+    else if ( srcsub.find( "_frc" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_fsr_calon" ;
+    }
+    else if ( srcsub.find( "_fro" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_fsr" ;
+    }
+    else if ( srcsub.find( "_nsc" ) != string::npos || srcsub.find( "_nrc" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_nod_calon" ;
+    }
+    else if ( srcsub.find( "_nso" ) != string::npos || srcsub.find( "_nro" ) != string::npos ) {
+      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
+      pksrec.srcName = pksrec.fieldName + "_nod" ;
+    }
+  }
 
   pksrec.srcDir.resize(2);
@@ -396,5 +437,5 @@
   pksrec.srcPM(0)  = 0.0;
   pksrec.srcPM(1)  = 0.0;
-  pksrec.srcVel    = 0.0;
+  pksrec.srcVel    = cMBrec.srcVelocity;
   pksrec.obsType   = trim(cMBrec.obsType);
 
@@ -404,5 +445,6 @@
   pksrec.bandwidth = chanWidth * nChan;
   pksrec.freqInc   = cMBrec.fqDelt[0];
-  pksrec.restFreq  = cMBrec.restFreq;
+  pksrec.restFreq.resize(1) ;
+  pksrec.restFreq(0)  = cMBrec.restFreq;
 
   pksrec.tcal.resize(nPol);
@@ -498,6 +540,6 @@
 {
   cReader->close();
-  logMsg(cReader->getMsg());
-  cReader->clearMsg();
+  //logMsg(cReader->getMsg());
+  //cReader->clearMsg();
 }
 
