Ignore:
Timestamp:
06/09/10 19:03:06 (14 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


Location:
branches/alma
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/alma

  • branches/alma/src/STWriter.cpp

    r1683 r1757  
    4242#include <atnf/PKSIO/PKSMS2writer.h>
    4343#include <atnf/PKSIO/PKSSDwriter.h>
     44#include <atnf/PKSIO/SrcType.h>
    4445
    4546#include <tables/Tables/Table.h>
     
    5152#include "STAsciiWriter.h"
    5253#include "STHeader.h"
     54#include "STMath.h"
     55
    5356
    5457#include "STWriter.h"
     
    104107                    const std::string &filename)
    105108{
     109  // If we write out foreign formats we have to convert the frequency system
     110  // into the output frame, as we do everything related to SPectarlCoordinates
     111  // in asap on-the-fly.
     112
     113  CountedPtr<Scantable> inst = in;
     114  if (in->frequencies().getFrame(true) != in->frequencies().getFrame(false)) {
     115    STMath stm(false);
     116    inst = stm.frequencyAlign(in);
     117  }
    106118
    107119  if (format_=="ASCII") {
    108120    STAsciiWriter iw;
     121    // ASCII calls SpectralCoordinate::toWorld so no freqAlign use 'in'
    109122    if (iw.write(*in, filename)) {
    110123      return 0;
     
    117130      iw.setClass(True);
    118131    }
    119     if (iw.write(*in, filename)) {
     132    if (iw.write(*inst, filename)) {
    120133      return 0;
    121134    }
     
    127140  // this is a little different from what I have done
    128141  // before. Need to check with the Offline User Test data
    129   STHeader hdr = in->getHeader();
     142  STHeader hdr = inst->getHeader();
    130143  //const Int nPol  = hdr.npol;
    131144  //const Int nChan = hdr.nchan;
    132   std::vector<uint> ifs = in->getIFNos();
    133   int nIF = in->nif();//ifs.size();
     145  std::vector<uint> ifs = inst->getIFNos();
     146  int nIF = inst->nif();//ifs.size();
    134147  Vector<uInt> nPol(nIF),nChan(nIF);
    135148  Vector<Bool> havexpol(nIF);
    136149  String fluxUnit = hdr.fluxunit;
    137 
     150  fluxUnit.upcase();
    138151  nPol = 0;nChan = 0; havexpol = False;
    139152  for (uint i=0;i<ifs.size();++i) {
    140     nPol(ifs[i]) = in->npol();
    141     nChan(ifs[i]) = in->nchan(ifs[i]);
     153    nPol(ifs[i]) = inst->npol();
     154    nChan(ifs[i]) = inst->nchan(ifs[i]);
    142155    havexpol(ifs[i]) = nPol(ifs[i]) > 2;
    143156  }
    144 
    145   const Table table = in->table();
     157//   Vector<String> obstypes(2);
     158//   obstypes(0) = "TR";//on
     159//   obstypes(1) = "RF TR";//off
     160  const Table table = inst->table();
     161
    146162
    147163  // Create the output file and write static data.
     
    155171    throw(AipsError("Failed to create output file"));
    156172  }
    157 
    158173
    159174  Int count = 0;
     
    206221          String tcalt;
    207222          Vector<String> stmp0, stmp1;
    208           in->frequencies().getEntry(crpix,crval, pksrec.freqInc,
     223          inst->frequencies().getEntry(crpix,crval, pksrec.freqInc,
    209224                                     rec.asuInt("FREQ_ID"));
    210           in->focus().getEntry(pksrec.focusAxi, pksrec.focusTan,
    211                                pksrec.focusRot, tmp0,tmp1,tmp2,tmp3,tmp4,
    212                                rec.asuInt("FOCUS_ID"));
    213           in->molecules().getEntry(pksrec.restFreq,stmp0,stmp1,
     225          inst->focus().getEntry(pksrec.parAngle, pksrec.focusAxi, pksrec.focusTan,
     226                                 pksrec.focusRot, tmp0,tmp1,tmp2,tmp3,tmp4,
     227                                 rec.asuInt("FOCUS_ID"));
     228          inst->molecules().getEntry(pksrec.restFreq,stmp0,stmp1,
    214229                                   rec.asuInt("MOLECULE_ID"));
    215           in->tcal().getEntry(pksrec.tcalTime, pksrec.tcal,
     230          inst->tcal().getEntry(pksrec.tcalTime, pksrec.tcal,
    216231                              rec.asuInt("TCAL_ID"));
    217           in->weather().getEntry(pksrec.temperature, pksrec.pressure,
     232          inst->weather().getEntry(pksrec.temperature, pksrec.pressure,
    218233                                 pksrec.humidity, pksrec.windSpeed,
    219234                                 pksrec.windAz, rec.asuInt("WEATHER_ID"));
     
    230245          pksrec.fieldName = rec.asString("FIELDNAME");
    231246          pksrec.srcName   = rec.asString("SRCNAME");
    232           pksrec.obsType   = hdr.obstype;
     247          //pksrec.obsType   = obstypes[rec.asInt("SRCTYPE")];
     248          pksrec.obsType = getObsTypes( rec.asInt("SRCTYPE") ) ;
    233249          pksrec.bandwidth = nchan * abs(pksrec.freqInc);
    234250          pksrec.azimuth   = rec.asFloat("AZIMUTH");
    235251          pksrec.elevation = rec.asFloat("ELEVATION");
    236           pksrec.parAngle  = rec.asFloat("PARANGLE");
    237252          pksrec.refBeam   = rec.asInt("REFBEAMNO") + 1;
    238253          pksrec.sigma.resize(npol);
     
    293308{
    294309  String poltype = tab.keywordSet().asString("POLTYPE");
    295   if ( poltype == "stokes") {
     310// Full stokes is not supported. Just allow stokes I
     311  if ( poltype == "stokes" && tab.nrow() != 1) {
    296312    String msg = "poltype = " + poltype + " not yet supported in output.";
    297313    throw(AipsError(msg));
     
    340356}
    341357
    342 }
     358// get obsType string from SRCTYPE value
     359String STWriter::getObsTypes( Int srctype )
     360{
     361  String obsType ;
     362  switch( srctype ) {
     363  case Int(SrcType::PSON):
     364    obsType = "PSON" ;
     365    break ;
     366  case Int(SrcType::PSOFF):
     367    obsType = "PSOFF" ;
     368    break ;
     369  case Int(SrcType::NOD):
     370    obsType = "NOD" ;
     371    break ;
     372  case Int(SrcType::FSON):
     373    obsType = "FSON" ;
     374    break ;
     375  case Int(SrcType::FSOFF):
     376    obsType = "FSOFF" ;
     377    break ;
     378  case Int(SrcType::SKY):
     379    obsType = "SKY" ;
     380    break ;
     381  case Int(SrcType::HOT):
     382    obsType = "HOT" ;
     383    break ;
     384  case Int(SrcType::WARM):
     385    obsType = "WARM" ;
     386    break ;
     387  case Int(SrcType::COLD):
     388    obsType = "COLD" ;
     389    break ;
     390  case Int(SrcType::PONCAL):
     391    obsType = "PSON:CALON" ;
     392    break ;
     393  case Int(SrcType::POFFCAL):
     394    obsType = "PSOFF:CALON" ;
     395    break ;
     396  case Int(SrcType::NODCAL):
     397    obsType = "NOD:CALON" ;
     398    break ;
     399  case Int(SrcType::FONCAL):
     400    obsType = "FSON:CALON" ;
     401    break ;
     402  case Int(SrcType::FOFFCAL):
     403    obsType = "FSOFF:CALOFF" ;
     404    break ;
     405  case Int(SrcType::FSLO):
     406    obsType = "FSLO" ;
     407    break ;
     408  case Int(SrcType::FLOOFF):
     409    obsType = "FS:LOWER:OFF" ;
     410    break ;
     411  case Int(SrcType::FLOSKY):
     412    obsType = "FS:LOWER:SKY" ;
     413    break ;
     414  case Int(SrcType::FLOHOT):
     415    obsType = "FS:LOWER:HOT" ;
     416    break ;
     417  case Int(SrcType::FLOWARM):
     418    obsType = "FS:LOWER:WARM" ;
     419    break ;
     420  case Int(SrcType::FLOCOLD):
     421    obsType = "FS:LOWER:COLD" ;
     422    break ;
     423  case Int(SrcType::FSHI):
     424    obsType = "FSHI" ;
     425    break ;
     426  case Int(SrcType::FHIOFF):
     427    obsType = "FS:HIGHER:OFF" ;
     428    break ;
     429  case Int(SrcType::FHISKY):
     430    obsType = "FS:HIGHER:SKY" ;
     431    break ;
     432  case Int(SrcType::FHIHOT):
     433    obsType = "FS:HIGHER:HOT" ;
     434    break ;
     435  case Int(SrcType::FHIWARM):
     436    obsType = "FS:HIGHER:WARM" ;
     437    break ;
     438  case Int(SrcType::FHICOLD):
     439    obsType = "FS:HIGHER:COLD" ;
     440    break ;
     441  default:
     442    obsType = "NOTYPE" ;
     443  }
     444
     445  return obsType ;
     446}
     447
     448}
Note: See TracChangeset for help on using the changeset viewer.