Index: /trunk/src/Block.cc
===================================================================
--- /trunk/src/Block.cc	(revision 33)
+++ /trunk/src/Block.cc	(revision 34)
@@ -100,9 +100,29 @@
   {
     /**
-     * Returns the value of the equinox keyword as one of four alternative
-     * strings. The equinox keyword takes the form of a code number, which
-     * needs to be translated into a human-readable string. These are the four 
-     * const strings defined in namespace Block.
-     * \return One of the four std::string elements.
+     * Returns the value of the equinox, assuming the coordinate type
+     * is equatorial. If we are using Galactic or Ecliptic, a blank
+     * string is returned.
+     *\return A std::string containing the equinox value.
+     */
+    int type = this->getKeyword<int>(COORD_TYPE);
+    std::string output;
+    switch(type){
+    case 2: output = "";               break;
+    case 3: output = Block::eq_b1950;  break;
+    case 4: output = "";               break;
+    case 5:
+    default: output = Block::eq_j2000; break;
+    }
+    return output;
+  }
+  //--------------------------------------------------------------------------
+
+  std::string DataBlock::getCoordMode()
+  {
+    /**
+     * Returns the value of the coord_md keyword as one of a number of
+     * alternative strings. This keyword should be one of EQUAT, GAL,
+     * ECLIP, etc. If the equinox is B1950 or J2000, return EQUAT.
+     * \return A coord type: one of EQUAT, GAL, ECLIP...
      */
     int type = this->getKeyword<int>(COORD_TYPE);
@@ -110,8 +130,8 @@
     switch(type){
     case 2: output = Block::eq_date;   break;
-    case 3: output = Block::eq_b1950;  break;
+    case 3: output = Block::eq_equat;  break;
     case 4: output = Block::eq_gal;    break;
     case 5:
-    default: output = Block::eq_j2000; break;
+    default: output = Block::eq_equat; break;
     }
     return output;
Index: /trunk/src/Block.hh
===================================================================
--- /trunk/src/Block.hh	(revision 33)
+++ /trunk/src/Block.hh	(revision 34)
@@ -13,8 +13,10 @@
   /** The length of the data part of the block [bytes] */
   const int dataLength = 49152; // = 48*1024
+  /** Four possible ways to express the equinox. These are return values for DataBlock::getEquinox().  */
   const std::string eq_date  = "Equat. of date"; 
   const std::string eq_b1950 = "B1950";
-  const std::string eq_gal   = "Galactic";
-  const std::string eq_j2000 = "J2000"; ///< Four possible ways to express the equinox. These are return values for DataBlock::getEquinox().
+  const std::string eq_gal   = "GAL";
+  const std::string eq_j2000 = "J2000";
+  const std::string eq_equat = "EQUAT";
 
   /**
@@ -58,6 +60,9 @@
     Header::SURVEY getSurveyType(){return surveyType;};
 
-    /** Get the equinox header keyword in a useful format */
+    /** Get the equinox in a string format. */
     std::string getEquinox();
+
+    /** Get the coordinate type. */
+    std::string getCoordMode();
 
     /** Was the telescope not moving, and tracking fine for this block? */
Index: /trunk/src/Header.cc
===================================================================
--- /trunk/src/Header.cc	(revision 33)
+++ /trunk/src/Header.cc	(revision 34)
@@ -107,5 +107,5 @@
 
       this->frontend = "70cm_Cavity_Disk";
-      this->fd_mode  = "FIXED";
+      this->fd_mode  = "FA";
       this->fd_poln  = "LIN";
       this->fd_hand  = 1;
Index: /trunk/src/PSRFits_fileIO.cc
===================================================================
--- /trunk/src/PSRFits_fileIO.cc	(revision 33)
+++ /trunk/src/PSRFits_fileIO.cc	(revision 34)
@@ -23,5 +23,4 @@
      *  Corrects known errors that exist in the PSRFITS definition:
      *  <ul><li> Set the TFORM keyword for the data column in the SUBINT table
-     *      <li> Fix the units for the RA & DEC columns
      *  </ul>
      */
@@ -38,17 +37,4 @@
     fits_update_key(this->fptr, TSTRING, "TFORM19", cval, NULL, &status);
     if(status) FITSError("PSRFits::fixPSRFITS 1", status);
-
-//     status=0;
-//     strcpy(cval,"deg");
-//     fits_update_key(this->fptr, TSTRING, "TUNIT6", cval, NULL, &status);
-//     if(status) FITSError("PSRFits::fixPSRFITS 2", status);
-//     status=0;
-//     fits_update_key(this->fptr, TSTRING, "TUNIT7", cval, NULL, &status);
-//     if(status) FITSError("PSRFits::fixPSRFITS 3", status);
-
-//     status=0;
-//     strcpy(cval,"MHz");
-//     fits_update_key(this->fptr, TSTRING, "TUNIT15", cval, NULL, &status);
-//     if(status) FITSError("PSRFits::fixPSRFITS 4", status);
 
     this->gotoPHU();
@@ -90,5 +76,4 @@
     if(this->newFile){
       newUT = block.getKeyword<std::string>(UT);
-//     newUT = block.getKeyword<std::string>(UT_STRT);
       date   = block.getKeyword<std::string>(DATE);
 
@@ -244,11 +229,5 @@
     if(status) FITSError("Subint::writeKeywords 10", status);
 
-//     int numData = this->nbits * this->nch_file * this->npol * this->nsblk;
-//     //    int dataPerByte = 8 / block.getKeyword<int>(NBITS,0);
-//     //    int numBytes = numData / dataPerByte;   
-//     int numBytes = numData / 8;
-    status=0;
-//     if(USE_X) fits_modify_vector_len (fptr, colnum, numData, &status);
-//     else      fits_modify_vector_len (fptr, colnum, numBytes, &status);
+    status=0;
     if(USE_X) fits_modify_vector_len (fptr, colnum, this->getDataSize(), &status);
     else      fits_modify_vector_len (fptr, colnum, this->getDataSizeBytes(), &status);
@@ -280,5 +259,5 @@
      *      <li> Start a new row with startNewSubintRow()
      *      <li> Write the single-valued columns with writeColumnValue()
-     *      <li> Write the muli-valued DAT_... columns
+     *      <li> Write the multi-valued DAT_... columns
      *      <li> Write the data.
      * </ul>
@@ -288,5 +267,5 @@
     this->gotoSubint();
     this->startNewSubintRow(); 
-    // CHECK -- need some check of blk_cntr to make sure the number is 
+    // CHECK -- need some check of blk_cntr to make sure the number is
     // CHECK -- incrementing correctly?
     float tsubint = block.getKeyword<float>(BLK_SEC);
@@ -378,11 +357,6 @@
     }
 
-//     int numData = this->subintTable.nbits * this->subintTable.nbin * this->subintTable.nch_file * 
-//       this->subintTable.npol * this->subintTable.nsblk;
-//     int dataPerByte = 8 / this->subintTable.nbits;
-//     int numBytes = numData / dataPerByte;   
     colnum = this->getColnum("DATA");
     status=0;
-//     fits_write_col_byt(this->fptr, colnum, nrows, 1, numBytes, data, &status);
     fits_write_col_byt(this->fptr, colnum, nrows, 1, this->subintTable.getDataSizeBytes(), data, &status);
     if(status) FITSError("PSRFits::writeDataArray 4", status);
@@ -422,6 +396,24 @@
     int nrcvr            = block.getKeyword<int>(NFILTER);
     std::string obs_mode = block.Survey().getObs_mode();
+
+//     double f0            = block.getKeyword<double>(FREQ_CHAN1);
+//     double bw            = block.getKeyword<double>(CHANBW);
+//     double nc            = block.getKeyword<double>(NCHAN);
+//     float obsfreq        = f0 + ((nc-1)/2.) * bw;
+    std::string date_obs = deblank(block.getKeyword<std::string>(DATE));
+    if(date_obs[0]=='0') date_obs = "20" + date_obs;
+    else                 date_obs = "19" + date_obs;
+    for(int i=0;i<date_obs.size();i++) if(date_obs[i]=='/') date_obs[i]='-';
+    date_obs             += "T" + deblank(block.getKeyword<std::string>(UT));
+    date_obs             = date_obs.substr(0, date_obs.size()-7);
+
     std::string src_name = deblank(block.getKeyword<std::string>(PSRNAME));
-    std::string coord_md = block.getEquinox();
+    std::string coord_md = block.getCoordMode();
+    std::string equinox  = block.getEquinox();
+    std::string ra       = deblank(block.getKeyword<std::string>(RA));
+    std::string dec      = deblank(block.getKeyword<std::string>(DEC));
+    float bmaj           = block.Survey().getBmaj();
+    float bmin           = block.Survey().getBmin();
+    float bpa            = block.Survey().getBpa();
     std::string stt_crd1 = deblank(block.getKeyword<std::string>(RA));
     std::string stt_crd2 = deblank(block.getKeyword<std::string>(DEC));
@@ -436,9 +428,4 @@
     float cal_dcyc       = block.Survey().getCal_dcyc();
     float cal_phs        = block.Survey().getCal_phs();
-    std::string stt_date = deblank(block.getKeyword<std::string>(DATE));
-    if(stt_date[0] == '0') stt_date = "20" + stt_date;
-    else                   stt_date = "19" + stt_date;
-    for(int i=0;i<stt_date.size();i++) if(stt_date[i]=='/') stt_date[i]='-';
-    std::string stt_time = deblank(block.getKeyword<std::string>(UT));
     long stt_imjd        = block.getKeyword<int>(MJD);
     long stt_smjd        = long(dmsToDec(stt_time) * 3600.);
@@ -464,6 +451,13 @@
     this->updateKeyword("NRCVR",    nrcvr);
     this->updateKeyword("OBS_MODE", obs_mode);
+    this->updateKeyword("DATE_OBS", date_obs);
     this->updateKeyword("SRC_NAME", src_name);
     this->updateKeyword("COORD_MD", coord_md);
+    this->updateKeyword("EQUINOX",  equinox);
+    this->updateKeyword("RA",       ra);
+    this->updateKeyword("DEC",      dec);
+    this->updateKeyword("BMAJ",     bmaj);
+    this->updateKeyword("BMIN",     bmin);
+    this->updateKeyword("BPA",      bpa);
     this->updateKeyword("STT_CRD1", stt_crd1);
     this->updateKeyword("STT_CRD2", stt_crd2);
@@ -478,6 +472,4 @@
     this->updateKeyword("CAL_DCYC", cal_dcyc);
     this->updateKeyword("CAL_PHS ", cal_phs);
-    this->updateKeyword("STT_DATE", stt_date);
-    this->updateKeyword("STT_TIME", stt_time);
     this->updateKeyword("STT_IMJD", stt_imjd);
     this->updateKeyword("STT_SMJD", stt_smjd);
@@ -511,59 +503,59 @@
     if(status) FITSError("PSRFits::addNewKeywords 1", status);
 
-    // RA
-    std::string ra  = deblank(block.getKeyword<std::string>(RA));
-    status = 0;
-    fits_update_key(this->fptr, TSTRING, "RA", (char *)ra.c_str(),
-		    "Right Ascension", &status);
-    if(status) FITSError("PSRFits::addNewKeywords 2", status);
-
-    // DEC
-    std::string dec = deblank(block.getKeyword<std::string>(DEC));
-    status = 0;
-    fits_update_key(this->fptr, TSTRING, "Dec", (char *)dec.c_str(),
-		    "Declination", &status);
-    if(status) FITSError("PSRFits::addNewKeywords 3", status);
-    
-    // DATE-OBS
-    std::string dateobs = deblank(block.getKeyword<std::string>(DATE));
-    if(dateobs[0] == '0') dateobs = "20" + dateobs;
-    else                  dateobs = "19" + dateobs;
-    for(int i=0;i<dateobs.size();i++) if(dateobs[i]=='/') dateobs[i]='-';
-    dateobs += "T" + deblank(block.getKeyword<std::string>(UT));
-    dateobs = dateobs.substr(0, dateobs.size()-7);
-    status = 0;
-    fits_update_key(this->fptr, TSTRING, "DATE-OBS", (char *)dateobs.c_str(),
-		    "Date of observation (YY-MM-DDThh:mm:ss UTC)", &status);
-    if(status) FITSError("PSRFits::addNewKeywords 4", status);
-
-    // EQUINOX
-    std::string equinox_str = block.getEquinox();
-    if(equinox_str == Block::eq_b1950 || equinox_str == Block::eq_j2000){
-      float equinox;
-      if(equinox_str == Block::eq_b1950) equinox = 1950.;
-      else equinox = 2000.;
-      status = 0;
-      fits_update_key(this->fptr, TFLOAT, "EQUINOX", &equinox,
-		      "Equinox", &status);
-      if(status) FITSError("PSRFits::addNewKeywords 5", status);
-    }
-
-    // BEAM INFORMATION
-    float fval;
-    // BMAJ
-    fval = block.Survey().getBmaj();
-    status = 0;
-    fits_update_key(this->fptr, TFLOAT, "BMAJ", &fval, "", &status);
-    if(status) FITSError("PSRFits::addNewKeywords 6", status);
-    // BMIN
-    fval = block.Survey().getBmin();
-    status = 0;
-    fits_update_key(this->fptr, TFLOAT, "BMIN", &fval, "", &status);
-    if(status) FITSError("PSRFits::addNewKeywords 7", status);
-    // BPA
-    fval = block.Survey().getBpa();
-    status = 0;
-    fits_update_key(this->fptr, TFLOAT, "BPA", &fval, "", &status);
-    if(status) FITSError("PSRFits::addNewKeywords 8", status);
+//     // RA
+//     std::string ra  = deblank(block.getKeyword<std::string>(RA));
+//     status = 0;
+//     fits_update_key(this->fptr, TSTRING, "RA", (char *)ra.c_str(),
+// 		    "Right Ascension", &status);
+//     if(status) FITSError("PSRFits::addNewKeywords 2", status);
+
+//     // DEC
+//     std::string dec = deblank(block.getKeyword<std::string>(DEC));
+//     status = 0;
+//     fits_update_key(this->fptr, TSTRING, "Dec", (char *)dec.c_str(),
+// 		    "Declination", &status);
+//     if(status) FITSError("PSRFits::addNewKeywords 3", status);
+    
+//     // DATE-OBS
+//     std::string dateobs = deblank(block.getKeyword<std::string>(DATE));
+//     if(dateobs[0] == '0') dateobs = "20" + dateobs;
+//     else                  dateobs = "19" + dateobs;
+//     for(int i=0;i<dateobs.size();i++) if(dateobs[i]=='/') dateobs[i]='-';
+//     dateobs += "T" + deblank(block.getKeyword<std::string>(UT));
+//     dateobs = dateobs.substr(0, dateobs.size()-7);
+//     status = 0;
+//     fits_update_key(this->fptr, TSTRING, "DATE-OBS", (char *)dateobs.c_str(),
+// 		    "Date of observation (YY-MM-DDThh:mm:ss UTC)", &status);
+//     if(status) FITSError("PSRFits::addNewKeywords 4", status);
+
+//     // EQUINOX
+//     std::string equinox_str = block.getEquinox();
+//     if(equinox_str == Block::eq_b1950 || equinox_str == Block::eq_j2000){
+//       float equinox;
+//       if(equinox_str == Block::eq_b1950) equinox = 1950.;
+//       else equinox = 2000.;
+//       status = 0;
+//       fits_update_key(this->fptr, TFLOAT, "EQUINOX", &equinox,
+// 		      "Equinox", &status);
+//       if(status) FITSError("PSRFits::addNewKeywords 5", status);
+//     }
+
+//     // BEAM INFORMATION
+//     float fval;
+//     // BMAJ
+//     fval = block.Survey().getBmaj();
+//     status = 0;
+//     fits_update_key(this->fptr, TFLOAT, "BMAJ", &fval, "", &status);
+//     if(status) FITSError("PSRFits::addNewKeywords 6", status);
+//     // BMIN
+//     fval = block.Survey().getBmin();
+//     status = 0;
+//     fits_update_key(this->fptr, TFLOAT, "BMIN", &fval, "", &status);
+//     if(status) FITSError("PSRFits::addNewKeywords 7", status);
+//     // BPA
+//     fval = block.Survey().getBpa();
+//     status = 0;
+//     fits_update_key(this->fptr, TFLOAT, "BPA", &fval, "", &status);
+//     if(status) FITSError("PSRFits::addNewKeywords 8", status);
     
   }
Index: /trunk/src/Utils.hh
===================================================================
--- /trunk/src/Utils.hh	(revision 33)
+++ /trunk/src/Utils.hh	(revision 34)
@@ -7,8 +7,8 @@
 /** Return the filename of the defintion file of the PSRFITS format. */
 inline std::string getPSRFITSdefn(){ 
-  //  return getenv("PSRFITSDEFN"); 
+  return getenv("PSRFITSDEFN"); 
 
-  std::cerr << "Using local PSRFITS definition! --> $PVO/templates/psrheader_20070209.fits\n"; 
-  return "/DATA/SITAR_1/whi550/VO/PulsarVO/templates/psrheader_20070209.fits"; 
+//   std::cerr << "Using local PSRFITS definition! --> $PVO/templates/psrheader_20070209.fits\n"; 
+//   return "/DATA/SITAR_1/whi550/VO/PulsarVO/templates/psrheader_20070209.fits"; 
 };
 
