Ignore:
Timestamp:
01/18/05 17:31:59 (19 years ago)
Author:
mar637
Message:
  • now using asap::AxisNo? enum instead of fixed axis indeces
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDAsciiWriter.cc

    r198 r209  
    3030//#---------------------------------------------------------------------------
    3131
    32 #include "SDAsciiWriter.h"
    33 
    3432#include <casa/aips.h>
    3533#include <casa/Arrays/Array.h>
     
    4038#include <casa/Quanta/MVAngle.h>
    4139
     40
     41#include <casa/iostream.h>
     42#include <casa/fstream.h>
     43
    4244#include <coordinates/Coordinates/CoordinateUtil.h>
    4345#include <coordinates/Coordinates/SpectralCoordinate.h>
     
    5153#include <tables/Tables/ArrayColumn.h>
    5254
     55#include "Definitions.h"
    5356#include "SDContainer.h"
    5457#include "SDMemTable.h"
    55 
    56 #include <casa/iostream.h>
    57 #include <casa/fstream.h>
    58 
     58#include "SDAsciiWriter.h"
    5959
    6060using namespace casa;
     
    6969
    7070
    71 Bool SDAsciiWriter::write(const SDMemTable& sdTable,  const String& fileName)
     71Bool SDAsciiWriter::write(const SDMemTable& sdTable, const String& fileName)
    7272{
    7373
     
    8686   ROScalarColumn<String> src(tab, "SRCNAME");
    8787
    88 // Axes (should be in header)
    89 
    90    const uInt beamAxis = 0;
    91    const uInt ifAxis = 1;
    92    const uInt polAxis = 2;
    93    const uInt chanAxis = 3;
    94 
    9588// Temps
    9689
     
    109102// Write header
    110103
    111    of << "row beam IF pol source longitude latitude time nchan spectrum mask" << endl;
    112 
     104   of << "row beam IF pol source longitude latitude time nchan spectrum mask"
     105      << endl;
     106   
    113107// Loop over rows
    114108
     
    131125// Iterate through data in this row by spectra
    132126
    133       ReadOnlyVectorIterator<Float> itData(values, chanAxis);
    134       ReadOnlyVectorIterator<Bool> itMask(mask, chanAxis);
     127      ReadOnlyVectorIterator<Float> itData(values, asap::ChanAxis);
     128      ReadOnlyVectorIterator<Bool> itMask(mask, asap::ChanAxis);
    135129      while (!itData.pastEnd()) {
    136130         const IPosition& pos = itData.pos();
     
    144138 
    145139         dir.get(iRow, whichDir);
    146          posDir(0) = pos(beamAxis);
     140         posDir(0) = pos(asap::BeamAxis);
    147141         posDir(1) = 0;
    148142         lonLat[0] = whichDir(posDir);
    149143//
    150          posDir(0) = pos(beamAxis);
     144         posDir(0) = pos(asap::BeamAxis);
    151145         posDir(1) = 1;
    152146         lonLat[1] = whichDir(posDir);
    153147
    154 // Write.  This formats the vectors as [,,,,]  which we probably don't want.
    155 
    156          of << iRow << "  " << pos(beamAxis) << " " <<  pos(ifAxis) << " " << pos(polAxis) << " " <<
    157                src(iRow) <<  " " << formatDirection(lonLat) << " " << dTmp << " " <<
    158                itData.vector().nelements() << " " << itData.vector() << "  " << itMask.vector() << endl;
     148         // Write.  This formats the vectors as [,,,,] which we
     149         // probably don't want.
     150         uInt ba = uInt(asap::BeamAxis);
     151         uInt ia = uInt(asap::IFAxis);
     152         uInt pa = uInt(asap::PolAxis);
     153
     154         of << iRow << "  " << pos(ba) << " "
     155            << pos(ia) << " " << pos(pa) << " "
     156            << src(iRow) <<  " " << formatDirection(lonLat) << " "
     157            << dTmp << " "
     158            << itData.vector().nelements() << " " << itData.vector()
     159            << "  " << itMask.vector() << endl;
    159160
    160161// Next spectrum
     
    172173
    173174
    174 Int SDAsciiWriter::convertStokes (Int val)
     175Int SDAsciiWriter::convertStokes(Int val)
    175176{
    176177   Stokes::StokesTypes stokes = Stokes::RR;
     
    191192
    192193
    193 String SDAsciiWriter::formatDirection (const Vector<Double>& lonLat)
     194String SDAsciiWriter::formatDirection(const Vector<Double>& lonLat)
    194195{
    195196   MVAngle x1(lonLat(0));
Note: See TracChangeset for help on using the changeset viewer.