Changeset 2658 for trunk


Ignore:
Timestamp:
10/10/12 14:29:17 (12 years ago)
Author:
Malte Marquarding
Message:

Ticket #199: Excised Logger::pushLog; now everything is using LogIO

Location:
trunk/src
Files:
5 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STAsciiWriter.cpp

    r2335 r2658  
    4444#include <casa/sstream.h>
    4545#include <casa/iomanip.h>
     46#include <casa/Logging/LogIO.h>
    4647
    4748#include <measures/Measures/MEpoch.h>
     
    176177    }
    177178    of.close();
    178     ostringstream oss;
    179     oss << "Wrote " << fName;
    180     pushLog(String(oss));
     179    LogIO os( LogOrigin( "STAsciiWriter") ) ;   
     180    os << "Wrote " << fName << LogIO::POST;
    181181    ++iter;
    182182  }
  • trunk/src/STAsciiWriter.h

    r1106 r2658  
    3737
    3838#include "Scantable.h"
    39 #include "Logger.h"
     39
    4040
    4141namespace casa {
     
    4848 * A class to export a Scnatble to ASCII file(s)
    4949 */
    50 class STAsciiWriter : public Logger {
     50class STAsciiWriter {
    5151public:
    5252// Constructor
  • trunk/src/STAttr.cpp

    r2163 r2658  
    3737#include <casa/Quanta/Quantum.h>
    3838#include <casa/Quanta/MVTime.h>
     39#include <casa/Logging/LogIO.h>
    3940
    4041#include <measures/Measures/MEpoch.h>
     
    5253}
    5354
    54 STAttr::STAttr(const STAttr& other):
    55   Logger()
     55STAttr::STAttr(const STAttr& other)
    5656{
    5757  (void) other; //suppress unused warning
     
    123123                                      const Vector<Float>& freqs) const
    124124{
    125 
    126   // Look at date where appropriate
     125   casa::LogIO os( casa::LogOrigin( "STAttr", "beamEfficiency()" ) );
     126   // Look at date where appropriate
    127127   MVTime t(dateObs.getValue());
    128128   uInt year = t.year();
     
    133133        {
    134134          if (year<2003) {
    135             pushLog("There is no beam efficiency data from before 2003"
    136                     " - using 2003 data");
     135            os << "There is no beam efficiency data from before 2003"
     136               <<" - using 2003 data" << casa::LogIO::POST;
    137137            facs = interp(freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2003Y_);
    138138          } else if (year==2003) {
    139             pushLog("Using beam efficiency data from 2003");
     139            os << "Using beam efficiency data from 2003" << casa::LogIO::POST;
    140140            facs = interp(freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2003Y_);
    141141          } else {
    142             pushLog("Using beam efficiency data from 2004");
     142            os << "Using beam efficiency data from 2004" << casa::LogIO::POST;
    143143            facs = interp(freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2004Y_);
    144144          }
     
    147147   default:
    148148     {
    149        pushLog("No beam efficiency data for this instrument - assuming unity");
     149       os << "No beam efficiency data for this instrument - assuming unity"
     150          << casa::LogIO::POST;
    150151     }
    151152   }
     
    157158                                         const Vector<Float>& freqs) const
    158159{
    159 
     160   casa::LogIO os( casa::LogOrigin( "STAttr", "apertureEfficiency()" ) );
    160161  // Look at date where appropriate
    161162  MVTime t(dateObs.getValue());
     
    167168    {
    168169      if (year<2004) {
    169         pushLog("There is no aperture efficiency data from before 2004"
    170                 " - using 2004 data");
     170        os << "There is no aperture efficiency data from before 2004"
     171           << " - using 2004 data" << casa::LogIO::POST;
    171172        facs = interp(freqs/1.0e9f, MopEtaApX_, MopEtaAp2004Y_);
    172173      } else {
    173         pushLog("Using aperture efficiency data from 2004");
     174        os << "Using aperture efficiency data from 2004" << casa::LogIO::POST;
    174175        facs = interp(freqs/1.0e9f, MopEtaApX_, MopEtaAp2004Y_);
    175176      }
     
    183184  default:
    184185    {
    185       pushLog("No aperture efficiency data for this instrument"
    186               " - assuming unity");
     186      os << "No aperture efficiency data for this instrument"
     187         <<  " - assuming unity" << casa::LogIO::POST;
    187188    }
    188189  }
  • trunk/src/STAttr.h

    r1346 r2658  
    3838#include <casa/Utilities/CountedPtr.h>
    3939
    40 #include "Logger.h"
    4140#include "STDefs.h"
    4241
     
    4746namespace asap {
    4847
    49 class STAttr : public Logger {
     48class STAttr {
    5049
    5150 public:
  • trunk/src/STFITSImageWriter.cpp

    r1823 r2658  
    3030//#---------------------------------------------------------------------------
    3131
     32
    3233#include <fitsio.h>
    33 #include <images/Images/TempImage.h>
     34#include <casa/Containers/RecordField.h>
     35#include <casa/Logging/LogIO.h>
    3436
    3537#include <lattices/Lattices/ArrayLattice.h>
     
    4143#include <tables/Tables/TableIter.h>
    4244#include <tables/Tables/TableRecord.h>
    43 #include <casa/Containers/RecordField.h>
     45
    4446#include <tables/Tables/TableRow.h>
    4547#include <tables/Tables/ScalarColumn.h>
     
    271273    }
    272274    fits_close_file(fptr, &status);
    273     ostringstream oss;
    274     oss << "Wrote " << fileName;
    275     pushLog(String(oss)); 
    276     //pushLog(String(oss));
     275   
     276    LogIO os( casa::LogOrigin("STFITSImageWriter"));
     277    os << "Wrote " << fileName << LogIO::POST;
    277278    ++iter;
    278279  }
  • trunk/src/STFITSImageWriter.h

    r1823 r2658  
    3333
    3434#include <casa/aips.h>
    35 #include <casa/BasicSL/String.h>
    36 #include <casa/ostream.h>
    3735
    3836#include <coordinates/Coordinates/DirectionCoordinate.h>
    39 #include "Scantable.h"
    40 #include "Logger.h"
     37
     38//#include "Scantable.h"
     39
     40namespace casa {
     41  class String;
     42}
    4143
    4244namespace asap {
     45
     46class Scantable;
     47
     48
    4349/**
    4450 * A class to export a Scantable to FITS file(s)
    4551 */
    46 class STFITSImageWriter : public Logger {
     52class STFITSImageWriter {
    4753public:
    4854// Constructor
  • trunk/src/STFiller.cpp

    r2657 r2658  
    138138  // Get basic parameters.
    139139  if ( anyEQ(haveXPol_, True) ) {
    140     pushLog("Cross polarization present");
    141140    for (uInt i=0; i< npols.nelements();++i) {
    142141      if (npols[i] < 3) npols[i] += 2;// Convert Complex -> 2 Floats
     
    165164    throw(AipsError("Failed to get header."));
    166165  }
     166  LogIO os( casa::LogOrigin( "STFiller") );
     167 
    167168  if ((header_->obstype).matches("*SW*")) {
    168169    // need robust way here - probably read ahead of next timestamp
    169     pushLog("Header indicates frequency switched observation.\n"
    170                "setting # of IFs = 1 ");
     170    os << "Header indicates frequency switched observation.\n"
     171       << "setting # of IFs = 1 " << LogIO::POST;
    171172    nIF_ = 1;
    172173    header_->obstype = String("fswitch");
  • trunk/src/STFiller.h

    r1819 r2658  
    2424#include "Scantable.h"
    2525#include "STHeader.h"
    26 #include "Logger.h"
     26
    2727
    2828class PKSreader;
     
    3939@version  2.0a
    4040*/
    41 class STFiller : public Logger {
     41class STFiller {
    4242public:
    4343
  • trunk/src/STFrequencies.cpp

    r2243 r2658  
    1515#include <casa/Containers/RecordField.h>
    1616#include <casa/Arrays/IPosition.h>
     17#include <casa/Logging/LogIO.h>
    1718
    1819#include <tables/Tables/TableDesc.h>
     
    264265  if (!MFrequency::getType(mft, rf)) {
    265266    ostringstream oss;
    266     pushLog("WARNING: Frequency type unknown assuming TOPO");
     267    LogIO os( casa::LogOrigin( "STFrequencies", "getFrame") );
     268    os << LogIO::WARN << "WARNING: Frequency type unknown assuming TOPO"
     269       << LogIO::POST;
    267270    mft = MFrequency::TOPO;
    268271  }
  • trunk/src/STMath.cpp

    r2643 r2658  
    388388      cycColOut.put(i, uInt(0));
    389389    } else {
    390       ostringstream oss;
    391       oss << "For output row="<<i<<", all input rows of data are flagged. no averaging" << endl;
    392       pushLog(String(oss));
     390      os << "For output row="<<i<<", all input rows of data are flagged. no averaging" << LogIO::POST;
    393391    }
    394392    acc.reset();
     
    12521250                                          casa::Float tau )
    12531251{
     1252  LogIO os( casa::LogOrigin( "STMath", "dosigref()"));
    12541253if ( ! ref->conformant(*sig) ) {
    12551254    throw(AipsError("'sig' and 'ref' scantables are not conformant."));
     
    12631262    smref = smooth(ref, inkernel, fsmoothref );
    12641263    ostringstream oss;
    1265     oss<<"Applied smoothing of "<<fsmoothref<<" on the reference."<<endl;
    1266     pushLog(String(oss));
     1264    os <<"Applied smoothing of "<<fsmoothref<<" on the reference."
     1265       << LogIO::POST;
    12671266  }
    12681267  else {
     
    13091308        Float elev;
    13101309        refelevCol.get(i, elev);
    1311         oss << "user specified Tsys = " << tsysv;
     1310        os << "user specified Tsys = " << tsysv;
    13121311        // do recalc elevation if EL = 0
    13131312        if ( elev == 0 ) {
     
    13201319          }
    13211320        }
    1322         oss << ", corrected (for El) tsys= "<<tsysrefscalar;
    1323         pushLog(String(oss));
     1321        os << ", corrected (for El) tsys= "<<tsysrefscalar;
    13241322      }
    13251323      else {
     
    13571355{
    13581356  setInsitu(false);
     1357  LogIO os( casa::LogOrigin( "STMath", "donod()"));
    13591358  STSelector sel;
    13601359  std::vector<int> scan1, scan2, beams, types;
     
    14441443
    14451444  msg=String("Processing dototalpower for subset of the data");
    1446   ostringstream oss1;
    1447   oss1 << msg  << endl;
    1448   pushLog(String(oss1));
     1445  os << msg << LogIO::POST;
    14491446  // Debug for IRC CS data
    14501447  //float tcal1=7.0;
     
    14591456  // dosigref calibration
    14601457  msg=String("Processing dosigref for subset of the data");
    1461   ostringstream oss2;
    1462   oss2 << msg  << endl;
    1463   pushLog(String(oss2));
     1458  os << msg  << endl;
    14641459  calb1=dosigref(sig1,ref2,smoothref,tsysv,tau);
    14651460  calb2=dosigref(sig2,ref1,smoothref,tsysv,tau);
     
    21612156                                               const std::string& method)
    21622157{
     2158  LogIO os( LogOrigin( "STMath", "gainElevation", WHERE ) ) ;
    21632159  // Get elevation data from Scantable and convert to degrees
    21642160  CountedPtr< Scantable > out = getScantable(in, false);
     
    22032199      throw(AipsError("There is no known gain-elevation polynomial known for this instrument"));
    22042200    }
    2205     ostringstream oss;
    2206     oss << "Making polynomial correction with " << msg << " coefficients:" << endl;
    2207     oss << "   " <<  coeff;
    2208     pushLog(String(oss));
     2201    os << "Making polynomial correction with " << msg << " coefficients:" << endl;
     2202    os << "   " <<  coeff << LogIO::POST;
    22092203    const uInt nrow = tab.nrow();
    22102204    Vector<Float> factor(nrow);
     
    22172211  } else {
    22182212    // Read and correct
    2219     pushLog("Making correction from ascii Table");
     2213    os << "Making correction from ascii Table" << LogIO::POST;
    22202214    scaleFromAsciiTable(tab, filename, method, x, true);
    22212215  }
     
    22882282                                             float jyperk )
    22892283{
     2284  LogIO os( LogOrigin( "STMath", "convertFlux", WHERE ) ) ;
     2285
    22902286  CountedPtr< Scantable > out = getScantable(in, false);
    22912287  Table& tab = in->table();
     
    22992295
    23002296  if ( fluxUnit == JY ) {
    2301     pushLog("Converting to K");
     2297    os << "Converting to K" << LogIO::POST;
    23022298    Quantum<Double> t(1.0,fluxUnit);
    23032299    Quantum<Double> t2 = t.get(JY);
     
    23072303    out->setFluxUnit("K");
    23082304  } else if ( fluxUnit == K ) {
    2309     pushLog("Converting to Jy");
     2305    os << "Converting to Jy" << LogIO::POST;
    23102306    Quantum<Double> t(1.0,fluxUnit);
    23112307    Quantum<Double> t2 = t.get(K);
     
    23242320    factor *= jyperk;
    23252321    if ( tokelvin ) factor = 1.0 / jyperk;
    2326     ostringstream oss;
    2327     oss << "Jy/K = " << jyperk;
    2328     pushLog(String(oss));
     2322    os << "Jy/K = " << jyperk << LogIO::POST;
    23292323    Vector<Float> factors(outtab.nrow(), factor);
    23302324    scaleByVector(outtab,factors, false);
     
    23382332    }
    23392333    jyperk = STAttr::findJyPerK(etaap, d);
    2340     ostringstream oss;
    2341     oss << "Jy/K = " << jyperk;
    2342     pushLog(String(oss));
     2334    os << "Jy/K = " << jyperk << LogIO::POST;
    23432335    factor *= jyperk;
    23442336    if ( tokelvin ) {
     
    23542346    // change per integration.
    23552347
    2356     pushLog("Looking up conversion factors");
     2348    os <<"Looking up conversion factors" << LogIO::POST;
    23572349    convertBrightnessUnits(out, tokelvin, cfac);
    23582350  }
     
    25472539    if ( ! (*it)->conformant(*out) ) {
    25482540      // non conformant.
    2549       //pushLog(String("Warning: Can't merge scantables as header info differs."));
    25502541      LogIO os( LogOrigin( "STMath", "merge()", WHERE ) ) ;
    25512542      os << LogIO::SEVERE << "Can't merge scantables as header informations (any one of AntennaName, Equinox, and FluxUnit) differ." << LogIO::EXCEPTION ;
     
    27462737                                const std::string & method)
    27472738{
     2739  LogIO os( casa::LogOrigin("STMath", "frequencyAlign()", WHERE));
    27482740  // clone as this is not working insitu
    27492741  bool insitu = insitu_;
     
    27842776  MVTime mvt(refEpoch.getValue());
    27852777  String epochout = mvt.string(MVTime::YMD) + String(" (") + refEpoch.getRefString() + String(")");
    2786   ostringstream oss;
    2787   oss << "Aligned at reference Epoch " << epochout
    2788       << " in frame " << MFrequency::showType(system);
    2789   pushLog(String(oss));
     2778  os << "Aligned at reference Epoch " << epochout
     2779     << " in frame " << MFrequency::showType(system) << LogIO::POST;
    27902780  // set up the iterator
    27912781  Block<String> cols(4);
  • trunk/src/STMath.h

    r2580 r2658  
    2323#include <scimath/Mathematics/InterpolateArray1D.h>
    2424
    25 #include "Logger.h"
    2625#include "Scantable.h"
    2726#include "STDefs.h"
     
    3433        * @author Malte Marquarding
    3534*/
    36 class STMath : private Logger {
     35class STMath {
    3736public:
    3837        // typedef for long method name
  • trunk/src/STSubTable.h

    r894 r2658  
    1616#include <tables/Tables/ScalarColumn.h>
    1717
    18 #include "Logger.h"
     18
    1919
    2020namespace asap {
     
    2828@version $Revision:$
    2929*/
    30 class STSubTable : public Logger {
     30class STSubTable {
    3131public:
    3232  STSubTable() {;}
  • trunk/src/STWriter.cpp

    r2657 r2658  
    3838#include <casa/Utilities/CountedPtr.h>
    3939#include <casa/Utilities/Assert.h>
     40#include <casa/Logging/LogIO.h>
    4041
    4142#include <atnf/PKSIO/PKSrecord.h>
     
    321322    ++scanit;
    322323  }
    323   ostringstream oss;
    324   oss << "STWriter: wrote " << count << " rows to " << filename;
    325   pushLog(String(oss));
    326  
     324  LogIO os( casa::LogOrigin("STWriter"));
     325  os << "STWriter: wrote " << count << " rows to " << filename
     326     << casa::LogIO::POST;
     327
    327328  writer_->close();
    328   //if MS2 delete POINTING table exists and copy the one in the keyword
    329   if ( format_ == "MS2" ) {
    330     replacePtTab(table, filename);
    331   }
     329
    332330  return 0;
    333331}
     
    380378}
    381379
    382 // For writing MS data, if there is the reference to
    383 // original pointing table it replace it by it.
    384 void STWriter::replacePtTab (const Table& tab, const std::string& fname)
    385 {
    386   String oldPtTabName = fname;
    387   oldPtTabName.append("/POINTING");
    388   if ( tab.keywordSet().isDefined("POINTING") ) {
    389     String PointingTab = tab.keywordSet().asString("POINTING");
    390     if ( Table::isReadable(PointingTab) ) {
    391       Table newPtTab(PointingTab, Table::Old);
    392       newPtTab.copy(oldPtTabName, Table::New);
    393       ostringstream oss;
    394       oss << "STWriter: copied  " <<PointingTab  << " to " << fname;
    395       pushLog(String(oss));
    396     }
    397   }
    398 }
    399380
    400381// get obsType string from SRCTYPE value
  • trunk/src/STWriter.h

    r2163 r2658  
    3838#include <casa/BasicSL/String.h>
    3939
    40 #include "Logger.h"
    4140#include "Scantable.h"
    4241
     
    5352  * @version 2.0a
    5453*/
    55 class STWriter : public Logger {
     54class STWriter {
    5655public:
    5756  explicit STWriter(const string &format = "SDFITS");
     
    8281                      const casa::Table& tab);
    8382
    84   void replacePtTab(const casa::Table& tab, const std::string& fname);
    85 
    8683  casa::String getObsTypes( casa::Int srctype ) ;
    8784
  • trunk/src/Scantable.cpp

    r2645 r2658  
    2020#include <casa/OS/File.h>
    2121#include <casa/OS/Path.h>
     22#include <casa/Logging/LogIO.h>
    2223#include <casa/Arrays/Array.h>
    2324#include <casa/Arrays/ArrayAccessor.h>
     
    168169*/
    169170
    170 Scantable::Scantable( const Scantable& other, bool clear ):
    171   Logger()
     171Scantable::Scantable( const Scantable& other, bool clear )
    172172{
    173173  // with or without data
     
    726726
    727727void Scantable::calculateAZEL()
    728 {
     728
     729  LogIO os( LogOrigin( "Scantable", "calculateAZEL()", WHERE ) ) ;
    729730  MPosition mp = getAntennaPosition();
    730731  MEpoch::ROScalarColumn timeCol(table_, "TIME");
    731732  ostringstream oss;
    732   oss << "Computed azimuth/elevation using " << endl
    733       << mp << endl;
     733  oss << mp;
     734  os << "Computed azimuth/elevation using " << endl
     735     << String(oss) << endl;
    734736  for (Int i=0; i<nrow(); ++i) {
    735737    MEpoch me = timeCol(i);
    736738    MDirection md = getDirection(i);
    737     oss  << " Time: " << formatTime(me,False) << " Direction: " << formatDirection(md)
     739    os  << " Time: " << formatTime(me,False)
     740        << " Direction: " << formatDirection(md)
    738741         << endl << "     => ";
    739742    MeasFrame frame(mp, me);
     
    744747    azCol_.put(i,Float(azel[0]));
    745748    elCol_.put(i,Float(azel[1]));
    746     oss << "azel: " << azel[0]/C::pi*180.0 << " "
    747         << azel[1]/C::pi*180.0 << " (deg)" << endl;
    748   }
    749   pushLog(String(oss));
     749    os << "azel: " << azel[0]/C::pi*180.0 << " "
     750       << azel[1]/C::pi*180.0 << " (deg)" << LogIO::POST;
     751  }
    750752}
    751753
     
    885887                                           const std::string& poltype ) const
    886888{
     889  LogIO os( LogOrigin( "Scantable", "getSpectrum()", WHERE ) ) ;
     890
    887891  String ptype = poltype;
    888892  if (poltype == "" ) ptype = getPolType();
     
    907911  }
    908912  if ( arr.nelements() == 0 )
    909     pushLog("Not enough polarisations present to do the conversion.");
     913   
     914    os << "Not enough polarisations present to do the conversion."
     915       << LogIO::POST;
    910916  arr.tovector(out);
    911917  return out;
  • trunk/src/Scantable.h

    r2645 r2658  
    3939#include <tables/Tables/Table.h>
    4040
    41 #include "Logger.h"
     41
    4242#include "MathUtils.h"
    4343#include "STFit.h"
     
    7474  * @version
    7575*/
    76 class Scantable : private Logger
     76class Scantable
    7777{
    7878
  • trunk/src/python_asap.cpp

    r2613 r2658  
    8181  asap::python::python_MSWriter();
    8282  asap::python::python_LineCatalog();
    83   asap::python::python_Logger();
    8483  asap::python::python_LogSink();
    8584  asap::python::python_STCoordinate();
Note: See TracChangeset for help on using the changeset viewer.