Changeset 2662 for tags/asap-4.1.0/src/STWriter.cpp
- Timestamp:
- 10/10/12 14:53:53 (12 years ago)
- Location:
- tags/asap-4.1.0
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/asap-4.1.0
-
tags/asap-4.1.0/src
- Property svn:mergeinfo changed
/trunk/src (added) merged: 2657-2658
- Property svn:mergeinfo changed
-
tags/asap-4.1.0/src/STWriter.cpp
r2652 r2662 38 38 #include <casa/Utilities/CountedPtr.h> 39 39 #include <casa/Utilities/Assert.h> 40 #include <casa/Logging/LogIO.h> 40 41 41 42 #include <atnf/PKSIO/PKSrecord.h> 42 #ifndef NOPKSMS43 #include <atnf/PKSIO/PKSMS2writer.h>44 #endif45 43 #include <atnf/PKSIO/PKSSDwriter.h> 46 44 #include <atnf/PKSIO/SrcType.h> … … 51 49 #include <tables/Tables/ArrayColumn.h> 52 50 51 #include <fits/FITS/FITSSpectralUtil.h> 52 53 53 #include "STFITSImageWriter.h" 54 54 #include "STAsciiWriter.h" … … 68 68 t.upcase(); 69 69 if (t == "MS2") { 70 #ifdef NOPKSMS71 70 throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED")); 72 #else73 writer_ = new PKSMS2writer();74 #endif75 71 } else if (t == "SDFITS") { 76 72 writer_ = new PKSSDwriter(); … … 99 95 t.upcase(); 100 96 if (t== "MS2") { 101 #ifdef NOPKSMS102 97 throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED")); 103 #else104 writer_ = new PKSMS2writer();105 #endif106 98 } else if (t== "SDFITS") { 107 99 writer_ = new PKSSDwriter(); … … 121 113 // in asap on-the-fly. 122 114 115 String freqframe; 116 FITSSpectralUtil::specsysFromFrame(freqframe, 117 in->frequencies().getFrame(true)); 123 118 CountedPtr<Scantable> inst = in; 124 119 if (in->frequencies().getFrame(true) != in->frequencies().getFrame(false)) { 120 FITSSpectralUtil::specsysFromFrame(freqframe, 121 in->frequencies().getFrame(false)); 122 125 123 STMath stm(false); 126 124 inst = stm.frequencyAlign(in); … … 151 149 // before. Need to check with the Offline User Test data 152 150 STHeader hdr = inst->getHeader(); 153 //const Int nPol = hdr.npol;154 //const Int nChan = hdr.nchan;155 151 std::vector<uint> ifs = inst->getIFNos(); 156 152 int nIF = inst->nif();//ifs.size(); … … 177 173 // Create the output file and write static data. 178 174 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);184 175 status = writer_->create(String(filename), hdr.observer, hdr.project, 185 176 inst->getAntennaName(), hdr.antennaposition, 186 177 hdr.obstype, hdr.fluxunit, 187 hdr.equinox, hdr.freqref,178 hdr.equinox, freqframe, 188 179 nChan, nPol, havexpol, False); 189 180 if ( status ) { … … 331 322 ++scanit; 332 323 } 333 ostringstream oss;334 os s << "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 337 328 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 342 330 return 0; 343 331 } … … 390 378 } 391 379 392 // For writing MS data, if there is the reference to393 // 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 }409 380 410 381 // get obsType string from SRCTYPE value
Note: See TracChangeset
for help on using the changeset viewer.