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

merge from trunk into release candidate

Location:
tags/asap-4.1.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tags/asap-4.1.0

  • tags/asap-4.1.0/src

  • tags/asap-4.1.0/src/STWriter.cpp

    r2652 r2662  
    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>
    42 #ifndef NOPKSMS
    43 #include <atnf/PKSIO/PKSMS2writer.h>
    44 #endif
    4543#include <atnf/PKSIO/PKSSDwriter.h>
    4644#include <atnf/PKSIO/SrcType.h>
     
    5149#include <tables/Tables/ArrayColumn.h>
    5250
     51#include <fits/FITS/FITSSpectralUtil.h>
     52
    5353#include "STFITSImageWriter.h"
    5454#include "STAsciiWriter.h"
     
    6868  t.upcase();
    6969  if (t == "MS2") {
    70     #ifdef NOPKSMS
    7170    throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED"));
    72     #else
    73     writer_ = new PKSMS2writer();
    74     #endif
    7571  } else if (t == "SDFITS") {
    7672    writer_ = new PKSSDwriter();
     
    9995  t.upcase();
    10096  if (t== "MS2") {
    101     #ifdef NOPKSMS
    10297    throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED"));
    103     #else
    104     writer_ = new PKSMS2writer();
    105     #endif
    10698  } else if (t== "SDFITS") {
    10799    writer_ = new PKSSDwriter();
     
    121113  // in asap on-the-fly.
    122114
     115  String freqframe;
     116  FITSSpectralUtil::specsysFromFrame(freqframe,
     117                                     in->frequencies().getFrame(true));
    123118  CountedPtr<Scantable> inst = in;
    124119  if (in->frequencies().getFrame(true) != in->frequencies().getFrame(false)) {
     120    FITSSpectralUtil::specsysFromFrame(freqframe,
     121                                     in->frequencies().getFrame(false));
     122 
    125123    STMath stm(false);
    126124    inst = stm.frequencyAlign(in);
     
    151149  // before. Need to check with the Offline User Test data
    152150  STHeader hdr = inst->getHeader();
    153   //const Int nPol  = hdr.npol;
    154   //const Int nChan = hdr.nchan;
    155151  std::vector<uint> ifs = inst->getIFNos();
    156152  int nIF = inst->nif();//ifs.size();
     
    177173  // Create the output file and write static data.
    178174  Int status;
    179 //   status = writer_->create(String(filename), hdr.observer, hdr.project,
    180 //                            hdr.antennaname, hdr.antennaposition,
    181 //                            hdr.obstype, hdr.fluxunit,
    182 //                            hdr.equinox, hdr.freqref,
    183 //                            nChan, nPol, havexpol, False);
    184175  status = writer_->create(String(filename), hdr.observer, hdr.project,
    185176                           inst->getAntennaName(), hdr.antennaposition,
    186177                           hdr.obstype, hdr.fluxunit,
    187                            hdr.equinox, hdr.freqref,
     178                           hdr.equinox, freqframe,
    188179                           nChan, nPol, havexpol, False);
    189180  if ( status ) {
     
    331322    ++scanit;
    332323  }
    333   ostringstream oss;
    334   oss << "STWriter: wrote " << count << " rows to " << filename;
    335   pushLog(String(oss));
    336  
     324  LogIO os( casa::LogOrigin("STWriter"));
     325  os << "STWriter: wrote " << count << " rows to " << filename
     326     << casa::LogIO::POST;
     327
    337328  writer_->close();
    338   //if MS2 delete POINTING table exists and copy the one in the keyword
    339   if ( format_ == "MS2" ) {
    340     replacePtTab(table, filename);
    341   }
     329
    342330  return 0;
    343331}
     
    390378}
    391379
    392 // For writing MS data, if there is the reference to
    393 // original pointing table it replace it by it.
    394 void STWriter::replacePtTab (const Table& tab, const std::string& fname)
    395 {
    396   String oldPtTabName = fname;
    397   oldPtTabName.append("/POINTING");
    398   if ( tab.keywordSet().isDefined("POINTING") ) {
    399     String PointingTab = tab.keywordSet().asString("POINTING");
    400     if ( Table::isReadable(PointingTab) ) {
    401       Table newPtTab(PointingTab, Table::Old);
    402       newPtTab.copy(oldPtTabName, Table::New);
    403       ostringstream oss;
    404       oss << "STWriter: copied  " <<PointingTab  << " to " << fname;
    405       pushLog(String(oss));
    406     }
    407   }
    408 }
    409380
    410381// get obsType string from SRCTYPE value
Note: See TracChangeset for help on using the changeset viewer.