Index: tags/asap-4.1.0/src/Logger.cpp
===================================================================
--- tags/asap-4.1.0/src/Logger.cpp	(revision 2654)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#include "Logger.h"
-
-using namespace asap;
-
-std::string Logger::log_ = std::string("");
-
-Logger::Logger()
-{
-  enableLog();
-}
-
-Logger::Logger(bool enabled)
-{
-  enabled_ = enabled;
-}
-Logger::~Logger()
-{
-}
-
-void Logger::pushLog(const std::string& s, bool newline ) const
-{
-  if (enabled_) {
-    log_+=s;
-    if ( newline ) log_+="\n";
-  };
-}
-std::string Logger::popLog() const
-{
-  std::string out;
-  if (enabled_) out=log_;log_="";
-  return out;
-}
-void Logger::enableLog()
-{
-  enabled_ = true;
-}
-void Logger::disableLog()
-{
-  enabled_ = false;
-}
Index: tags/asap-4.1.0/src/Logger.h
===================================================================
--- tags/asap-4.1.0/src/Logger.h	(revision 2654)
+++ 	(revision )
@@ -1,72 +1,0 @@
-//
-// C++ Interface: Logger
-//
-// Description:
-//
-//
-// Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2005
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-#ifndef ASAPLOGGER_H
-#define ASAPLOGGER_H
-
-#include <string>
-#include <iostream>
-
-namespace asap {
-/**
-  * This class provides the logging within asap. All other classes which need to log
-  * should inherit from this.
-  * @brief The ASAP logging class
-  * @author Malte Marquarding
-  * @date $Date$
-  * @version
-  */
-class Logger {
-public:
-  /**
-   * Default Constructor
-   **/
-  Logger();
-  
-  /**
-   * Constructor with switch to enable/disable logging
-   * @param[in] enabled indicating the deafult state
-   */  
-  explicit Logger(bool enabled);
-
-  /*
-   * Destructor
-   */
-  virtual ~Logger();
-  /**
-   * push another message into the logger
-   * @param[in] s the message
-   * @param[in] newline whether to add a newline character at the end
-   */  
-  void pushLog(const std::string& s, bool newline=true) const;
-  /**
-   * pop the message form the logger
-   * @return the log message string
-   */  
-  std::string popLog() const;
-  /**
-   * enable logging
-   */
-  virtual void enableLog();
-  /**
-   * disable logging
-   */
-  virtual void disableLog();
-  
-private:
-  static std::string log_;
-  bool enabled_;
-};
-
-} // namespace
-
-#endif
-
Index: tags/asap-4.1.0/src/SDFITSImageWriter.cc
===================================================================
--- tags/asap-4.1.0/src/SDFITSImageWriter.cc	(revision 2654)
+++ 	(revision )
@@ -1,266 +1,0 @@
-//#---------------------------------------------------------------------------
-//# SDFITSImageWriter.cc: ASAP class to write out single dish spectra as FITS images
-//#---------------------------------------------------------------------------
-//# Copyright (C) 2004
-//# ATNF
-//#
-//# This program is free software; you can redistribute it and/or modify it
-//# under the terms of the GNU General Public License as published by the Free
-//# Software Foundation; either version 2 of the License, or (at your option)
-//# any later version.
-//#
-//# This program is distributed in the hope that it will be useful, but
-//# WITHOUT ANY WARRANTY; without even the implied warranty of
-//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-//# Public License for more details.
-//#
-//# You should have received a copy of the GNU General Public License along
-//# with this program; if not, write to the Free Software Foundation, Inc.,
-//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
-//#
-//# Correspondence concerning this software should be addressed as follows:
-//#        Internet email: Malte.Marquarding@csiro.au
-//#        Postal address: Malte Marquarding,
-//#                        Australia Telescope National Facility,
-//#                        P.O. Box 76,
-//#                        Epping, NSW, 2121,
-//#                        AUSTRALIA
-//#
-//# $Id$
-//#---------------------------------------------------------------------------
-
-#include "SDFITSImageWriter.h"
-
-#include <casa/aips.h>
-#include <casa/Arrays/Array.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/VectorIter.h>
-#include <casa/Utilities/CountedPtr.h>
-#include <casa/OS/Directory.h>
-
-#include <coordinates/Coordinates/CoordinateUtil.h>
-#include <coordinates/Coordinates/CoordinateSystem.h>
-#include <coordinates/Coordinates/SpectralCoordinate.h>
-#include <coordinates/Coordinates/DirectionCoordinate.h>
-#include <coordinates/Coordinates/StokesCoordinate.h>
-#include <coordinates/Coordinates/ObsInfo.h>
-
-#include <images/Images/ImageFITSConverter.h>
-#include <images/Images/TempImage.h>
-
-#include <lattices/Lattices/ArrayLattice.h>
-
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/Stokes.h>
-
-#include <tables/Tables/Table.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/ArrayColumn.h>
-
-#include "STDefs.h"
-#include "STHeader.h"
-#include "SDMemTable.h"
-#include "SDPol.h"
-
-using namespace casa;
-using namespace asap;
-
-
-SDFITSImageWriter::SDFITSImageWriter()
-{;}
-
-SDFITSImageWriter::~SDFITSImageWriter()
-{;}
-
-
-Bool SDFITSImageWriter::write(const SDMemTable& sdTable, 
-                              const String& dirName, Bool toStokes,
-                              Bool verbose)
-{
-
-// Get global Header from Table
-
-   STHeader header = sdTable.getSTHeader();
-   MEpoch::Ref timeRef(sdTable.getTimeReference());
-   MDirection::Types dirRef = sdTable.getDirectionReference();
-
-// Prepare initial ObsInfo
-
-   ObsInfo oi;
-   oi.setTelescope(String(header.antennaname));
-   oi.setObserver(String(header.observer));
-
-// Column keywords
-
-   Table tab = sdTable.table();
-   ROArrayColumn<Double> dirCol(tab, String("DIRECTION"));
-   ROScalarColumn<Double> timeCol(tab, "TIME");
-   ROArrayColumn<uInt> freqidCol(tab, "FREQID");
-   ROArrayColumn<uInt> restfreqidCol(tab, "RESTFREQID");
-   ROScalarColumn<String> srcCol(tab, "SRCNAME");
-
-// Output Image Shape; spectral axis to be updated
-
-   IPosition shapeOut(4,1);                 // spectral, direction (2), stokes
-
-// Axes (should be in header)
-
-   const uInt beamAxis = asap::BeamAxis;
-   const uInt ifAxis = asap::IFAxis;
-   const uInt stokesAxis = asap::PolAxis;
-   const uInt chanAxis = asap::ChanAxis;
-   const Unit RAD(String("rad"));
-
-// Output Directory
-
-   String dirName2(dirName);
-   if (dirName.length()==0) {
-      dirName2 = String("asap_FITS");
-   }
-   Directory dir(dirName2);
-   dir.create(True);
-   ostringstream oss;
-   oss << "Created directory '" << dirName2 << "' for output files";
-
-   // Temps
-
-   Vector<Int> whichStokes(1,1);
-   Array<Double> whichDir;
-   Vector<Double> lonLat(2);
-   IPosition posDir(2,0);
-   Projection proj(Projection::SIN);                   // What should we use ?
-   Matrix<Double> xForm(2,2);
-   xForm = 0.0; xForm.diagonal() = 1.0;
-   Vector<Double> incLonLat(2,0.0);
-   Vector<Double> refPixLonLat(2,0.0);
-
-// Do we have linear or circular ?  No way to know yet...
-
-   Bool linear = True;
-
-// Loop over rows
-
-   uInt maxMem = 128;
-   Bool preferVelocity = False;
-   Bool opticalVelocity = False;
-   Int bitPix = -32;                     // FLoating point
-   Float minPix = 1.0;
-   Float maxPix = -1.0;
-   Bool overWrite = True;
-   Bool degLast = False;
-   Bool reallyVerbose = False;
-//
-   String errMsg;
-   const uInt nRows = sdTable.nRow();
-   for (uInt iRow=0; iRow<nRows; iRow++) {
-
-// Get data converted to Stokes
-
-      const MaskedArray<Float>& dataIn(sdTable.rowAsMaskedArray(iRow,toStokes));
-      const Array<Float>& values = dataIn.getArray();
-      const Array<Bool>& mask = dataIn.getMask();
-      const IPosition& shapeIn = dataIn.shape();
-      shapeOut(0) = shapeIn(chanAxis);
-      TiledShape tShapeOut(shapeOut);
-
-// Update ObsInfo (time changes per integration)
-
-      Double dTmp;
-      timeCol.get(iRow, dTmp);
-      MVEpoch tmp2(Quantum<Double>(dTmp, Unit(String("d"))));
-      MEpoch epoch(tmp2, timeRef);
-      oi.setObsDate(epoch);
-
-// Iterate through data in this row by spectra
-
-      ReadOnlyVectorIterator<Float> itData(values, chanAxis);
-      ReadOnlyVectorIterator<Bool> itMask(mask, chanAxis);
-      while (!itData.pastEnd()) {
-         const IPosition& pos = itData.pos();
-
-// Form SpectralCoordinate 
-
-         Vector<uInt> iTmp;
-         freqidCol.get(iRow, iTmp);
-         uInt freqID = iTmp(pos(ifAxis));
-//
-         restfreqidCol.get(iRow, iTmp);
-         uInt restFreqID = iTmp(pos(ifAxis));
-//
-         SpectralCoordinate sC = sdTable.getSpectralCoordinate(freqID, restFreqID, iRow);
-
-// Form DirectionCoordinate
- 
-         dirCol.get(iRow, whichDir);
-         posDir(0) = pos(beamAxis);
-         posDir(1) = 0;
-         lonLat[0] = whichDir(posDir);
-//
-         posDir(0) = pos(beamAxis);
-         posDir(1) = 1;
-         lonLat[1] = whichDir(posDir);
-         DirectionCoordinate dC(dirRef, proj, lonLat[0], lonLat[1],
-                               incLonLat[0], incLonLat[1], xForm, 
-                               refPixLonLat[0], refPixLonLat[1]);
-
-// Form Stokes Coordinate (Stokes info still sketchy);
-
-         Stokes::StokesTypes stokes = SDPolUtil::convertStokes(pos(stokesAxis), toStokes, linear);
-         String stokesName = Stokes::name(stokes);
-         whichStokes(0) = Int(stokes);
-         StokesCoordinate stC(whichStokes);
-
-// Create CoordinateSystem
-
-         CoordinateSystem cSys;
-         cSys.addCoordinate(sC);
-         cSys.addCoordinate(dC);
-         cSys.addCoordinate(stC);
-         cSys.setObsInfo(oi);
-
-// Reform data into correct shape for output
-
-         Array<Float> t1(itData.array().reform(shapeOut));
-         Array<Bool> m1(itMask.array().reform(shapeOut));
-
-// Create aips++ Image
-
-         TempImage<Float> tIm(tShapeOut, cSys);
-         tIm.put(t1);
-//
-         ArrayLattice<Bool> latMask(m1);
-         tIm.attachMask(latMask);
-
-// Write out as FITS Image file
-
-         ostringstream oss2;
-         oss2 << "row" << iRow << "_beam" << pos(0) << "_if" 
-	     << pos(1) << "_" << stokesName  << "_" << srcCol(iRow) << ".fits";
-         String tS(oss2);
-         String fileName = dirName2 + String("/") + tS;
-         if (verbose) oss << endl << "Writing row " << iRow 
-			   << " into file '" << tS << "'";
-//
-         Bool ok = ImageFITSConverter::ImageToFITS(errMsg, tIm, fileName, 
-						   maxMem, preferVelocity,
-						   opticalVelocity, bitPix, 
-						   minPix, maxPix, overWrite,
-						   degLast, reallyVerbose);
-         if (!ok) {
-	   oss << endl<< "Error writing fits - " << errMsg;
-         }
-
-// Next spectrum
-
-         itData.next();
-         itMask.next();
-      }
-   }
-//
-   if (!verbose) {
-     oss << endl<< "Wrote " << nRows << " into individual FITS files";
-   }
-   pushLog(String(oss));
-   return True;
-}
-
Index: tags/asap-4.1.0/src/SDFITSImageWriter.h
===================================================================
--- tags/asap-4.1.0/src/SDFITSImageWriter.h	(revision 2654)
+++ 	(revision )
@@ -1,60 +1,0 @@
-//#---------------------------------------------------------------------------
-//# SDFITSImageWriter.h: ASAP class to write out single dish spectra as image FITS
-//#---------------------------------------------------------------------------
-//# Copyright (C) 2004
-//# ATNF
-//#
-//# This program is free software; you can redistribute it and/or modify it
-//# under the terms of the GNU General Public License as published by the Free
-//# Software Foundation; either version 2 of the License, or (at your option)
-//# any later version.
-//#
-//# This program is distributed in the hope that it will be useful, but
-//# WITHOUT ANY WARRANTY; without even the implied warranty of
-//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-//# Public License for more details.
-//#
-//# You should have received a copy of the GNU General Public License along
-//# with this program; if not, write to the Free Software Foundation, Inc.,
-//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
-//#
-//# Correspondence concerning this software should be addressed as follows:
-//#        Internet email: Malte.Marquarding@csiro.au
-//#        Postal address: Malte Marquarding,
-//#                        Australia Telescope National Facility,
-//#                        P.O. Box 76,
-//#                        Epping, NSW, 2121,
-//#                        AUSTRALIA
-//#
-//# $Id$
-//#---------------------------------------------------------------------------
-#ifndef SDFITSIMAGEWRITER_H
-#define SDFITSIMAGEWRITER_H
-
-#include <casa/aips.h>
-#include <casa/BasicSL/String.h>
-#include <SDMemTable.h>
-
-#include "Logger.h"
-
-namespace asap {
-
-class SDFITSImageWriter : public Logger {
-public:
-  // Constructor
-  SDFITSImageWriter();
-  
-  // Destructor
-  ~SDFITSImageWriter();
-  
-  // Write out lots of FITS images, one per row, beam, IF and polarization
-  casa::Bool write(const SDMemTable& table, const casa::String& rootName,
-                   casa::Bool toStokes, casa::Bool verbose=casa::True);
-  
-private:
-  casa::Int convertStokes(casa::Int val, casa::Bool toStokes,
-			  casa::Bool linear) const;
-};
-
-}// namespace
-#endif
Index: tags/asap-4.1.0/src/STAsciiWriter.cpp
===================================================================
--- tags/asap-4.1.0/src/STAsciiWriter.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STAsciiWriter.cpp	(revision 2662)
@@ -44,4 +44,5 @@
 #include <casa/sstream.h>
 #include <casa/iomanip.h>
+#include <casa/Logging/LogIO.h>
 
 #include <measures/Measures/MEpoch.h>
@@ -176,7 +177,6 @@
     }
     of.close();
-    ostringstream oss;
-    oss << "Wrote " << fName;
-    pushLog(String(oss));
+    LogIO os( LogOrigin( "STAsciiWriter") ) ;    
+    os << "Wrote " << fName << LogIO::POST;
     ++iter;
   }
Index: tags/asap-4.1.0/src/STAsciiWriter.h
===================================================================
--- tags/asap-4.1.0/src/STAsciiWriter.h	(revision 2654)
+++ tags/asap-4.1.0/src/STAsciiWriter.h	(revision 2662)
@@ -37,5 +37,5 @@
 
 #include "Scantable.h"
-#include "Logger.h"
+
 
 namespace casa {
@@ -48,5 +48,5 @@
  * A class to export a Scnatble to ASCII file(s)
  */
-class STAsciiWriter : public Logger {
+class STAsciiWriter {
 public:
 // Constructor
Index: tags/asap-4.1.0/src/STAttr.cpp
===================================================================
--- tags/asap-4.1.0/src/STAttr.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STAttr.cpp	(revision 2662)
@@ -37,4 +37,5 @@
 #include <casa/Quanta/Quantum.h>
 #include <casa/Quanta/MVTime.h>
+#include <casa/Logging/LogIO.h>
 
 #include <measures/Measures/MEpoch.h>
@@ -52,6 +53,5 @@
 }
 
-STAttr::STAttr(const STAttr& other):
-  Logger()
+STAttr::STAttr(const STAttr& other)
 {
   (void) other; //suppress unused warning
@@ -123,6 +123,6 @@
 				      const Vector<Float>& freqs) const
 {
-
-  // Look at date where appropriate
+   casa::LogIO os( casa::LogOrigin( "STAttr", "beamEfficiency()" ) );
+   // Look at date where appropriate
    MVTime t(dateObs.getValue());
    uInt year = t.year();
@@ -133,12 +133,12 @@
         {
 	  if (year<2003) {
-	    pushLog("There is no beam efficiency data from before 2003"
-		    " - using 2003 data");
+	    os << "There is no beam efficiency data from before 2003"
+	       <<" - using 2003 data" << casa::LogIO::POST;
 	    facs = interp(freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2003Y_);
 	  } else if (year==2003) {
-	    pushLog("Using beam efficiency data from 2003");
+	    os << "Using beam efficiency data from 2003" << casa::LogIO::POST;
 	    facs = interp(freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2003Y_);
 	  } else {
-	    pushLog("Using beam efficiency data from 2004");
+	    os << "Using beam efficiency data from 2004" << casa::LogIO::POST;
 	    facs = interp(freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2004Y_);
 	  }
@@ -147,5 +147,6 @@
    default:
      {
-       pushLog("No beam efficiency data for this instrument - assuming unity");
+       os << "No beam efficiency data for this instrument - assuming unity"
+	  << casa::LogIO::POST;
      }
    }
@@ -157,5 +158,5 @@
 					 const Vector<Float>& freqs) const
 {
-
+   casa::LogIO os( casa::LogOrigin( "STAttr", "apertureEfficiency()" ) );
   // Look at date where appropriate
   MVTime t(dateObs.getValue());
@@ -167,9 +168,9 @@
     {
       if (year<2004) {
-	pushLog("There is no aperture efficiency data from before 2004"
-		" - using 2004 data");
+	os << "There is no aperture efficiency data from before 2004"
+	   << " - using 2004 data" << casa::LogIO::POST;
 	facs = interp(freqs/1.0e9f, MopEtaApX_, MopEtaAp2004Y_);
       } else {
-	pushLog("Using aperture efficiency data from 2004");
+	os << "Using aperture efficiency data from 2004" << casa::LogIO::POST;
 	facs = interp(freqs/1.0e9f, MopEtaApX_, MopEtaAp2004Y_);
       }
@@ -183,6 +184,6 @@
   default:
     {
-      pushLog("No aperture efficiency data for this instrument"
-	      " - assuming unity");
+      os << "No aperture efficiency data for this instrument"
+	 <<  " - assuming unity" << casa::LogIO::POST;
     }
   }
Index: tags/asap-4.1.0/src/STAttr.h
===================================================================
--- tags/asap-4.1.0/src/STAttr.h	(revision 2654)
+++ tags/asap-4.1.0/src/STAttr.h	(revision 2662)
@@ -38,5 +38,4 @@
 #include <casa/Utilities/CountedPtr.h>
 
-#include "Logger.h"
 #include "STDefs.h"
 
@@ -47,5 +46,5 @@
 namespace asap {
 
-class STAttr : public Logger {
+class STAttr {
 
  public:
Index: tags/asap-4.1.0/src/STFITSImageWriter.cpp
===================================================================
--- tags/asap-4.1.0/src/STFITSImageWriter.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STFITSImageWriter.cpp	(revision 2662)
@@ -30,6 +30,8 @@
 //#---------------------------------------------------------------------------
 
+
 #include <fitsio.h>
-#include <images/Images/TempImage.h>
+#include <casa/Containers/RecordField.h>
+#include <casa/Logging/LogIO.h>
 
 #include <lattices/Lattices/ArrayLattice.h>
@@ -41,5 +43,5 @@
 #include <tables/Tables/TableIter.h>
 #include <tables/Tables/TableRecord.h>
-#include <casa/Containers/RecordField.h>
+
 #include <tables/Tables/TableRow.h>
 #include <tables/Tables/ScalarColumn.h>
@@ -271,8 +273,7 @@
     }
     fits_close_file(fptr, &status);
-    ostringstream oss;
-    oss << "Wrote " << fileName;
-    pushLog(String(oss));  
-    //pushLog(String(oss));
+    
+    LogIO os( casa::LogOrigin("STFITSImageWriter"));
+    os << "Wrote " << fileName << LogIO::POST;
     ++iter;
   }
Index: tags/asap-4.1.0/src/STFITSImageWriter.h
===================================================================
--- tags/asap-4.1.0/src/STFITSImageWriter.h	(revision 2654)
+++ tags/asap-4.1.0/src/STFITSImageWriter.h	(revision 2662)
@@ -33,16 +33,22 @@
 
 #include <casa/aips.h>
-#include <casa/BasicSL/String.h>
-#include <casa/ostream.h>
 
 #include <coordinates/Coordinates/DirectionCoordinate.h>
-#include "Scantable.h"
-#include "Logger.h"
+
+//#include "Scantable.h"
+
+namespace casa {
+  class String;
+}
 
 namespace asap {
+
+class Scantable;
+
+
 /**
  * A class to export a Scantable to FITS file(s)
  */
-class STFITSImageWriter : public Logger {
+class STFITSImageWriter {
 public:
 // Constructor
Index: tags/asap-4.1.0/src/STFiller.cpp
===================================================================
--- tags/asap-4.1.0/src/STFiller.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STFiller.cpp	(revision 2662)
@@ -36,4 +36,5 @@
 #include <atnf/PKSIO/NROReader.h>
 #include <casa/Logging/LogIO.h>
+#include <fits/FITS/FITSSpectralUtil.h>
 
 #include <time.h>
@@ -137,5 +138,4 @@
   // Get basic parameters.
   if ( anyEQ(haveXPol_, True) ) {
-    pushLog("Cross polarization present");
     for (uInt i=0; i< npols.nelements();++i) {
       if (npols[i] < 3) npols[i] += 2;// Convert Complex -> 2 Floats
@@ -164,8 +164,10 @@
     throw(AipsError("Failed to get header."));
   }
+  LogIO os( casa::LogOrigin( "STFiller") );
+  
   if ((header_->obstype).matches("*SW*")) {
     // need robust way here - probably read ahead of next timestamp
-    pushLog("Header indicates frequency switched observation.\n"
-               "setting # of IFs = 1 ");
+    os << "Header indicates frequency switched observation.\n"
+       << "setting # of IFs = 1 " << LogIO::POST;
     nIF_ = 1;
     header_->obstype = String("fswitch");
@@ -226,5 +228,6 @@
   Vector<Int> start(nIF_, 1);
   Vector<Int> end(nIF_, 0);
-  reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0], False, getPt);
+  reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0], False, 
+		  getPt);
   table_->setHeader(*header_);
   //For MS, add the location of POINTING of the input MS so one get
@@ -249,22 +252,10 @@
   //MS style (as PKSMS2reader converts the original frame
   //in FITS standard style)
-  if (freqFrame == "TOPOCENT") {
-    freqFrame = "TOPO";
-  } else if (freqFrame == "GEOCENER") {
-    freqFrame = "GEO";
-  } else if (freqFrame == "BARYCENT") {
-    freqFrame = "BARY";
-  } else if (freqFrame == "GALACTOC") {
-    freqFrame = "GALACTO";
-  } else if (freqFrame == "LOCALGRP") {
-    freqFrame = "LGROUP";
-  } else if (freqFrame == "CMBDIPOL") {
-    freqFrame = "CMB";
-  } else if (freqFrame == "SOURCE") {
-    freqFrame = "REST";
-  }
+  MFrequency::Types fframe;
+  FITSSpectralUtil::frameFromSpecsys(fframe, freqFrame);
   // set both "FRAME" and "BASEFRAME"
-  table_->frequencies().setFrame(freqFrame, false);
-  table_->frequencies().setFrame(freqFrame,true);
+  table_->frequencies().setFrame(fframe, false);
+  table_->frequencies().setFrame(fframe,true);
+  
   //table_->focus().setParallactify(true);
 }
Index: tags/asap-4.1.0/src/STFiller.h
===================================================================
--- tags/asap-4.1.0/src/STFiller.h	(revision 2654)
+++ tags/asap-4.1.0/src/STFiller.h	(revision 2662)
@@ -24,5 +24,5 @@
 #include "Scantable.h"
 #include "STHeader.h"
-#include "Logger.h"
+
 
 class PKSreader;
@@ -39,5 +39,5 @@
 @version  2.0a
 */
-class STFiller : public Logger {
+class STFiller {
 public:
 
Index: tags/asap-4.1.0/src/STFrequencies.cpp
===================================================================
--- tags/asap-4.1.0/src/STFrequencies.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STFrequencies.cpp	(revision 2662)
@@ -15,4 +15,5 @@
 #include <casa/Containers/RecordField.h>
 #include <casa/Arrays/IPosition.h>
+#include <casa/Logging/LogIO.h>
 
 #include <tables/Tables/TableDesc.h>
@@ -264,5 +265,7 @@
   if (!MFrequency::getType(mft, rf)) {
     ostringstream oss;
-    pushLog("WARNING: Frequency type unknown assuming TOPO");
+    LogIO os( casa::LogOrigin( "STFrequencies", "getFrame") );
+    os << LogIO::WARN << "WARNING: Frequency type unknown assuming TOPO"
+       << LogIO::POST;
     mft = MFrequency::TOPO;
   }
Index: tags/asap-4.1.0/src/STMath.cpp
===================================================================
--- tags/asap-4.1.0/src/STMath.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STMath.cpp	(revision 2662)
@@ -388,7 +388,5 @@
       cycColOut.put(i, uInt(0));
     } else {
-      ostringstream oss;
-      oss << "For output row="<<i<<", all input rows of data are flagged. no averaging" << endl;
-      pushLog(String(oss));
+      os << "For output row="<<i<<", all input rows of data are flagged. no averaging" << LogIO::POST;
     }
     acc.reset();
@@ -1252,4 +1250,5 @@
                                           casa::Float tau )
 {
+  LogIO os( casa::LogOrigin( "STMath", "dosigref()"));
 if ( ! ref->conformant(*sig) ) {
     throw(AipsError("'sig' and 'ref' scantables are not conformant."));
@@ -1263,6 +1262,6 @@
     smref = smooth(ref, inkernel, fsmoothref );
     ostringstream oss;
-    oss<<"Applied smoothing of "<<fsmoothref<<" on the reference."<<endl;
-    pushLog(String(oss));
+    os <<"Applied smoothing of "<<fsmoothref<<" on the reference."
+       << LogIO::POST;
   }
   else {
@@ -1309,5 +1308,5 @@
         Float elev;
         refelevCol.get(i, elev);
-        oss << "user specified Tsys = " << tsysv;
+        os << "user specified Tsys = " << tsysv;
         // do recalc elevation if EL = 0
         if ( elev == 0 ) {
@@ -1320,6 +1319,5 @@
           }
         }
-        oss << ", corrected (for El) tsys= "<<tsysrefscalar;
-        pushLog(String(oss));
+        os << ", corrected (for El) tsys= "<<tsysrefscalar;
       }
       else {
@@ -1357,4 +1355,5 @@
 {
   setInsitu(false);
+  LogIO os( casa::LogOrigin( "STMath", "donod()"));
   STSelector sel;
   std::vector<int> scan1, scan2, beams, types;
@@ -1444,7 +1443,5 @@
 
   msg=String("Processing dototalpower for subset of the data");
-  ostringstream oss1;
-  oss1 << msg  << endl;
-  pushLog(String(oss1));
+  os << msg << LogIO::POST;
   // Debug for IRC CS data
   //float tcal1=7.0;
@@ -1459,7 +1456,5 @@
   // dosigref calibration
   msg=String("Processing dosigref for subset of the data");
-  ostringstream oss2;
-  oss2 << msg  << endl;
-  pushLog(String(oss2));
+  os << msg  << endl;
   calb1=dosigref(sig1,ref2,smoothref,tsysv,tau);
   calb2=dosigref(sig2,ref1,smoothref,tsysv,tau);
@@ -2161,4 +2156,5 @@
                                                const std::string& method)
 {
+  LogIO os( LogOrigin( "STMath", "gainElevation", WHERE ) ) ;
   // Get elevation data from Scantable and convert to degrees
   CountedPtr< Scantable > out = getScantable(in, false);
@@ -2203,8 +2199,6 @@
       throw(AipsError("There is no known gain-elevation polynomial known for this instrument"));
     }
-    ostringstream oss;
-    oss << "Making polynomial correction with " << msg << " coefficients:" << endl;
-    oss << "   " <<  coeff;
-    pushLog(String(oss));
+    os << "Making polynomial correction with " << msg << " coefficients:" << endl;
+    os << "   " <<  coeff << LogIO::POST;
     const uInt nrow = tab.nrow();
     Vector<Float> factor(nrow);
@@ -2217,5 +2211,5 @@
   } else {
     // Read and correct
-    pushLog("Making correction from ascii Table");
+    os << "Making correction from ascii Table" << LogIO::POST;
     scaleFromAsciiTable(tab, filename, method, x, true);
   }
@@ -2288,4 +2282,6 @@
                                              float jyperk )
 {
+  LogIO os( LogOrigin( "STMath", "convertFlux", WHERE ) ) ;
+
   CountedPtr< Scantable > out = getScantable(in, false);
   Table& tab = in->table();
@@ -2299,5 +2295,5 @@
 
   if ( fluxUnit == JY ) {
-    pushLog("Converting to K");
+    os << "Converting to K" << LogIO::POST;
     Quantum<Double> t(1.0,fluxUnit);
     Quantum<Double> t2 = t.get(JY);
@@ -2307,5 +2303,5 @@
     out->setFluxUnit("K");
   } else if ( fluxUnit == K ) {
-    pushLog("Converting to Jy");
+    os << "Converting to Jy" << LogIO::POST;
     Quantum<Double> t(1.0,fluxUnit);
     Quantum<Double> t2 = t.get(K);
@@ -2324,7 +2320,5 @@
     factor *= jyperk;
     if ( tokelvin ) factor = 1.0 / jyperk;
-    ostringstream oss;
-    oss << "Jy/K = " << jyperk;
-    pushLog(String(oss));
+    os << "Jy/K = " << jyperk << LogIO::POST;
     Vector<Float> factors(outtab.nrow(), factor);
     scaleByVector(outtab,factors, false);
@@ -2338,7 +2332,5 @@
     }
     jyperk = STAttr::findJyPerK(etaap, d);
-    ostringstream oss;
-    oss << "Jy/K = " << jyperk;
-    pushLog(String(oss));
+    os << "Jy/K = " << jyperk << LogIO::POST;
     factor *= jyperk;
     if ( tokelvin ) {
@@ -2354,5 +2346,5 @@
     // change per integration.
 
-    pushLog("Looking up conversion factors");
+    os <<"Looking up conversion factors" << LogIO::POST;
     convertBrightnessUnits(out, tokelvin, cfac);
   }
@@ -2547,5 +2539,4 @@
     if ( ! (*it)->conformant(*out) ) {
       // non conformant.
-      //pushLog(String("Warning: Can't merge scantables as header info differs."));
       LogIO os( LogOrigin( "STMath", "merge()", WHERE ) ) ;
       os << LogIO::SEVERE << "Can't merge scantables as header informations (any one of AntennaName, Equinox, and FluxUnit) differ." << LogIO::EXCEPTION ;
@@ -2746,4 +2737,5 @@
                                 const std::string & method)
 {
+  LogIO os( casa::LogOrigin("STMath", "frequencyAlign()", WHERE));
   // clone as this is not working insitu
   bool insitu = insitu_;
@@ -2784,8 +2776,6 @@
   MVTime mvt(refEpoch.getValue());
   String epochout = mvt.string(MVTime::YMD) + String(" (") + refEpoch.getRefString() + String(")");
-  ostringstream oss;
-  oss << "Aligned at reference Epoch " << epochout
-      << " in frame " << MFrequency::showType(system);
-  pushLog(String(oss));
+  os << "Aligned at reference Epoch " << epochout
+     << " in frame " << MFrequency::showType(system) << LogIO::POST;
   // set up the iterator
   Block<String> cols(4);
Index: tags/asap-4.1.0/src/STMath.h
===================================================================
--- tags/asap-4.1.0/src/STMath.h	(revision 2654)
+++ tags/asap-4.1.0/src/STMath.h	(revision 2662)
@@ -23,5 +23,4 @@
 #include <scimath/Mathematics/InterpolateArray1D.h>
 
-#include "Logger.h"
 #include "Scantable.h"
 #include "STDefs.h"
@@ -34,5 +33,5 @@
 	* @author Malte Marquarding
 */
-class STMath : private Logger {
+class STMath {
 public:
 	// typedef for long method name
Index: tags/asap-4.1.0/src/STSubTable.h
===================================================================
--- tags/asap-4.1.0/src/STSubTable.h	(revision 2654)
+++ tags/asap-4.1.0/src/STSubTable.h	(revision 2662)
@@ -16,5 +16,5 @@
 #include <tables/Tables/ScalarColumn.h>
 
-#include "Logger.h"
+
 
 namespace asap {
@@ -28,5 +28,5 @@
 @version $Revision:$
 */
-class STSubTable : public Logger {
+class STSubTable  {
 public:
   STSubTable() {;}
Index: tags/asap-4.1.0/src/STWriter.cpp
===================================================================
--- tags/asap-4.1.0/src/STWriter.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STWriter.cpp	(revision 2662)
@@ -38,9 +38,7 @@
 #include <casa/Utilities/CountedPtr.h>
 #include <casa/Utilities/Assert.h>
+#include <casa/Logging/LogIO.h>
 
 #include <atnf/PKSIO/PKSrecord.h>
-#ifndef NOPKSMS
-#include <atnf/PKSIO/PKSMS2writer.h>
-#endif
 #include <atnf/PKSIO/PKSSDwriter.h>
 #include <atnf/PKSIO/SrcType.h>
@@ -51,4 +49,6 @@
 #include <tables/Tables/ArrayColumn.h>
 
+#include <fits/FITS/FITSSpectralUtil.h>
+
 #include "STFITSImageWriter.h"
 #include "STAsciiWriter.h"
@@ -68,9 +68,5 @@
   t.upcase();
   if (t == "MS2") {
-    #ifdef NOPKSMS
     throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED"));
-    #else
-    writer_ = new PKSMS2writer();
-    #endif
   } else if (t == "SDFITS") {
     writer_ = new PKSSDwriter();
@@ -99,9 +95,5 @@
   t.upcase();
   if (t== "MS2") {
-    #ifdef NOPKSMS
     throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED"));
-    #else
-    writer_ = new PKSMS2writer();
-    #endif
   } else if (t== "SDFITS") {
     writer_ = new PKSSDwriter();
@@ -121,6 +113,12 @@
   // in asap on-the-fly.
 
+  String freqframe;
+  FITSSpectralUtil::specsysFromFrame(freqframe, 
+				     in->frequencies().getFrame(true));
   CountedPtr<Scantable> inst = in;
   if (in->frequencies().getFrame(true) != in->frequencies().getFrame(false)) {
+    FITSSpectralUtil::specsysFromFrame(freqframe, 
+				     in->frequencies().getFrame(false));
+  
     STMath stm(false);
     inst = stm.frequencyAlign(in);
@@ -151,6 +149,4 @@
   // before. Need to check with the Offline User Test data
   STHeader hdr = inst->getHeader();
-  //const Int nPol  = hdr.npol;
-  //const Int nChan = hdr.nchan;
   std::vector<uint> ifs = inst->getIFNos();
   int nIF = inst->nif();//ifs.size();
@@ -177,13 +173,8 @@
   // Create the output file and write static data.
   Int status;
-//   status = writer_->create(String(filename), hdr.observer, hdr.project,
-//                            hdr.antennaname, hdr.antennaposition,
-//                            hdr.obstype, hdr.fluxunit,
-//                            hdr.equinox, hdr.freqref,
-//                            nChan, nPol, havexpol, False);
   status = writer_->create(String(filename), hdr.observer, hdr.project,
                            inst->getAntennaName(), hdr.antennaposition,
                            hdr.obstype, hdr.fluxunit,
-                           hdr.equinox, hdr.freqref,
+                           hdr.equinox, freqframe,
                            nChan, nPol, havexpol, False);
   if ( status ) {
@@ -331,13 +322,10 @@
     ++scanit;
   }
-  ostringstream oss;
-  oss << "STWriter: wrote " << count << " rows to " << filename;
-  pushLog(String(oss));
-  
+  LogIO os( casa::LogOrigin("STWriter"));
+  os << "STWriter: wrote " << count << " rows to " << filename
+     << casa::LogIO::POST;
+
   writer_->close();
-  //if MS2 delete POINTING table exists and copy the one in the keyword
-  if ( format_ == "MS2" ) {
-    replacePtTab(table, filename);
-  }
+
   return 0;
 }
@@ -390,21 +378,4 @@
 }
 
-// For writing MS data, if there is the reference to
-// original pointing table it replace it by it.
-void STWriter::replacePtTab (const Table& tab, const std::string& fname)
-{
-  String oldPtTabName = fname;
-  oldPtTabName.append("/POINTING");
-  if ( tab.keywordSet().isDefined("POINTING") ) {
-    String PointingTab = tab.keywordSet().asString("POINTING");
-    if ( Table::isReadable(PointingTab) ) {
-      Table newPtTab(PointingTab, Table::Old);
-      newPtTab.copy(oldPtTabName, Table::New);
-      ostringstream oss;
-      oss << "STWriter: copied  " <<PointingTab  << " to " << fname;
-      pushLog(String(oss));
-    }
-  }
-}
 
 // get obsType string from SRCTYPE value
Index: tags/asap-4.1.0/src/STWriter.h
===================================================================
--- tags/asap-4.1.0/src/STWriter.h	(revision 2654)
+++ tags/asap-4.1.0/src/STWriter.h	(revision 2662)
@@ -38,5 +38,4 @@
 #include <casa/BasicSL/String.h>
 
-#include "Logger.h"
 #include "Scantable.h"
 
@@ -53,5 +52,5 @@
   * @version 2.0a
 */
-class STWriter : public Logger {
+class STWriter {
 public:
   explicit STWriter(const string &format = "SDFITS");
@@ -82,6 +81,4 @@
                       const casa::Table& tab);
 
-  void replacePtTab(const casa::Table& tab, const std::string& fname);
-
   casa::String getObsTypes( casa::Int srctype ) ;
 
Index: tags/asap-4.1.0/src/Scantable.cpp
===================================================================
--- tags/asap-4.1.0/src/Scantable.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/Scantable.cpp	(revision 2662)
@@ -20,4 +20,5 @@
 #include <casa/OS/File.h>
 #include <casa/OS/Path.h>
+#include <casa/Logging/LogIO.h>
 #include <casa/Arrays/Array.h>
 #include <casa/Arrays/ArrayAccessor.h>
@@ -168,6 +169,5 @@
 */
 
-Scantable::Scantable( const Scantable& other, bool clear ):
-  Logger()
+Scantable::Scantable( const Scantable& other, bool clear )
 {
   // with or without data
@@ -726,14 +726,17 @@
 
 void Scantable::calculateAZEL()
-{
+{  
+  LogIO os( LogOrigin( "Scantable", "calculateAZEL()", WHERE ) ) ;
   MPosition mp = getAntennaPosition();
   MEpoch::ROScalarColumn timeCol(table_, "TIME");
   ostringstream oss;
-  oss << "Computed azimuth/elevation using " << endl
-      << mp << endl;
+  oss << mp;
+  os << "Computed azimuth/elevation using " << endl
+     << String(oss) << endl;
   for (Int i=0; i<nrow(); ++i) {
     MEpoch me = timeCol(i);
     MDirection md = getDirection(i);
-    oss  << " Time: " << formatTime(me,False) << " Direction: " << formatDirection(md)
+    os  << " Time: " << formatTime(me,False) 
+	<< " Direction: " << formatDirection(md)
          << endl << "     => ";
     MeasFrame frame(mp, me);
@@ -744,8 +747,7 @@
     azCol_.put(i,Float(azel[0]));
     elCol_.put(i,Float(azel[1]));
-    oss << "azel: " << azel[0]/C::pi*180.0 << " "
-        << azel[1]/C::pi*180.0 << " (deg)" << endl;
-  }
-  pushLog(String(oss));
+    os << "azel: " << azel[0]/C::pi*180.0 << " "
+       << azel[1]/C::pi*180.0 << " (deg)" << LogIO::POST;
+  }
 }
 
@@ -885,4 +887,6 @@
                                            const std::string& poltype ) const
 {
+  LogIO os( LogOrigin( "Scantable", "getSpectrum()", WHERE ) ) ;
+
   String ptype = poltype;
   if (poltype == "" ) ptype = getPolType();
@@ -907,5 +911,7 @@
   }
   if ( arr.nelements() == 0 )
-    pushLog("Not enough polarisations present to do the conversion.");
+    
+    os << "Not enough polarisations present to do the conversion." 
+       << LogIO::POST;
   arr.tovector(out);
   return out;
Index: tags/asap-4.1.0/src/Scantable.h
===================================================================
--- tags/asap-4.1.0/src/Scantable.h	(revision 2654)
+++ tags/asap-4.1.0/src/Scantable.h	(revision 2662)
@@ -39,5 +39,5 @@
 #include <tables/Tables/Table.h>
 
-#include "Logger.h"
+
 #include "MathUtils.h"
 #include "STFit.h"
@@ -74,5 +74,5 @@
   * @version
 */
-class Scantable : private Logger
+class Scantable
 {
 
Index: tags/asap-4.1.0/src/python_Logger.cpp
===================================================================
--- tags/asap-4.1.0/src/python_Logger.cpp	(revision 2654)
+++ 	(revision )
@@ -1,52 +1,0 @@
-//#---------------------------------------------------------------------------
-//# python_Logger.cc: python exposure of c++ Logger class
-//#---------------------------------------------------------------------------
-//# Copyright (C) 2004
-//# ATNF
-//#
-//# This program is free software; you can redistribute it and/or modify it
-//# under the terms of the GNU General Public License as published by the Free
-//# Software Foundation; either version 2 of the License, or (at your option)
-//# any later version.
-//#
-//# This program is distributed in the hope that it will be useful, but
-//# WITHOUT ANY WARRANTY; without even the implied warranty of
-//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-//# Public License for more details.
-//#
-//# You should have received a copy of the GNU General Public License along
-//# with this program; if not, write to the Free Software Foundation, Inc.,
-//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
-//#
-//# Correspondence concerning this software should be addressed as follows:
-//#        Internet email: Malte.Marquarding@csiro.au
-//#        Postal address: Malte Marquarding,
-//#                        Australia Telescope National Facility,
-//#                        P.O. Box 76,
-//#                        Epping, NSW, 2121,
-//#                        AUSTRALIA
-//#
-//# $Id:
-//#---------------------------------------------------------------------------
-#include <boost/python.hpp>
-
-#include "Logger.h"
-
-using namespace boost::python;
-
-namespace asap {
-  namespace python {
-    void python_Logger() {
-      class_<Logger>("Log")
-        .def( init <> () )
-        //.def( init <bool> () )
-	.def("push", &Logger::pushLog,
-         (boost::python::arg("newline")=1))
-	.def("pop", &Logger::popLog)
-	.def("disable", &Logger::disableLog)
-	.def("enable", &Logger::enableLog)
-      ;
-    };
-
-  } //namespace python
-} // namespace asap
Index: tags/asap-4.1.0/src/python_asap.cpp
===================================================================
--- tags/asap-4.1.0/src/python_asap.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/python_asap.cpp	(revision 2662)
@@ -81,5 +81,4 @@
   asap::python::python_MSWriter();
   asap::python::python_LineCatalog();
-  asap::python::python_Logger();
   asap::python::python_LogSink();
   asap::python::python_STCoordinate();
