Changeset 2657 for trunk


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

Ticket #280: Use FITSSpectralUtil::specsysFromFrame to write correct FITS output frame

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STFiller.cpp

    r2289 r2657  
    3636#include <atnf/PKSIO/NROReader.h>
    3737#include <casa/Logging/LogIO.h>
     38#include <fits/FITS/FITSSpectralUtil.h>
    3839
    3940#include <time.h>
     
    226227  Vector<Int> start(nIF_, 1);
    227228  Vector<Int> end(nIF_, 0);
    228   reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0], False, getPt);
     229  reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0], False,
     230                  getPt);
    229231  table_->setHeader(*header_);
    230232  //For MS, add the location of POINTING of the input MS so one get
     
    249251  //MS style (as PKSMS2reader converts the original frame
    250252  //in FITS standard style)
    251   if (freqFrame == "TOPOCENT") {
    252     freqFrame = "TOPO";
    253   } else if (freqFrame == "GEOCENER") {
    254     freqFrame = "GEO";
    255   } else if (freqFrame == "BARYCENT") {
    256     freqFrame = "BARY";
    257   } else if (freqFrame == "GALACTOC") {
    258     freqFrame = "GALACTO";
    259   } else if (freqFrame == "LOCALGRP") {
    260     freqFrame = "LGROUP";
    261   } else if (freqFrame == "CMBDIPOL") {
    262     freqFrame = "CMB";
    263   } else if (freqFrame == "SOURCE") {
    264     freqFrame = "REST";
    265   }
     253  MFrequency::Types fframe;
     254  FITSSpectralUtil::frameFromSpecsys(fframe, freqFrame);
    266255  // set both "FRAME" and "BASEFRAME"
    267   table_->frequencies().setFrame(freqFrame, false);
    268   table_->frequencies().setFrame(freqFrame,true);
     256  table_->frequencies().setFrame(fframe, false);
     257  table_->frequencies().setFrame(fframe,true);
     258 
    269259  //table_->focus().setParallactify(true);
    270260}
  • trunk/src/STWriter.cpp

    r2652 r2657  
    4040
    4141#include <atnf/PKSIO/PKSrecord.h>
    42 #ifndef NOPKSMS
    43 #include <atnf/PKSIO/PKSMS2writer.h>
    44 #endif
    4542#include <atnf/PKSIO/PKSSDwriter.h>
    4643#include <atnf/PKSIO/SrcType.h>
     
    5148#include <tables/Tables/ArrayColumn.h>
    5249
     50#include <fits/FITS/FITSSpectralUtil.h>
     51
    5352#include "STFITSImageWriter.h"
    5453#include "STAsciiWriter.h"
     
    6867  t.upcase();
    6968  if (t == "MS2") {
    70     #ifdef NOPKSMS
    7169    throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED"));
    72     #else
    73     writer_ = new PKSMS2writer();
    74     #endif
    7570  } else if (t == "SDFITS") {
    7671    writer_ = new PKSSDwriter();
     
    9994  t.upcase();
    10095  if (t== "MS2") {
    101     #ifdef NOPKSMS
    10296    throw (AipsError("MS2 OUTPUT FORMAT IS NO LONGER SUPPORTED"));
    103     #else
    104     writer_ = new PKSMS2writer();
    105     #endif
    10697  } else if (t== "SDFITS") {
    10798    writer_ = new PKSSDwriter();
     
    121112  // in asap on-the-fly.
    122113
     114  String freqframe;
     115  FITSSpectralUtil::specsysFromFrame(freqframe,
     116                                     in->frequencies().getFrame(true));
    123117  CountedPtr<Scantable> inst = in;
    124118  if (in->frequencies().getFrame(true) != in->frequencies().getFrame(false)) {
     119    FITSSpectralUtil::specsysFromFrame(freqframe,
     120                                     in->frequencies().getFrame(false));
     121 
    125122    STMath stm(false);
    126123    inst = stm.frequencyAlign(in);
     
    151148  // before. Need to check with the Offline User Test data
    152149  STHeader hdr = inst->getHeader();
    153   //const Int nPol  = hdr.npol;
    154   //const Int nChan = hdr.nchan;
    155150  std::vector<uint> ifs = inst->getIFNos();
    156151  int nIF = inst->nif();//ifs.size();
     
    177172  // Create the output file and write static data.
    178173  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);
    184174  status = writer_->create(String(filename), hdr.observer, hdr.project,
    185175                           inst->getAntennaName(), hdr.antennaposition,
    186176                           hdr.obstype, hdr.fluxunit,
    187                            hdr.equinox, hdr.freqref,
     177                           hdr.equinox, freqframe,
    188178                           nChan, nPol, havexpol, False);
    189179  if ( status ) {
Note: See TracChangeset for help on using the changeset viewer.