Changeset 988


Ignore:
Timestamp:
04/05/06 14:31:47 (18 years ago)
Author:
mar637
Message:

implemented data export for the asap2 Scantable as in Ticket #4.

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile

    r962 r988  
    9393             STFrequencies.o \
    9494             STHistory.o \
    95              STWriter.o \
    9695             STSelector.o \
    9796             STLineFinder.o \
     
    102101             STPolLinear.o \
    103102             STPolStokes.o \
     103             STWriter.o \
     104             STAsciiWriter.o \
    104105             Scantable.o \
    105106             Templates.o
     
    112113             python_STLineFinder.o \
    113114             python_STFitEntry.o \
     115             python_STWriter.o \
    114116             python_asap.o
    115117
     
    142144             STPol.h \
    143145             STPolStokes.h \
    144              STPolLinear.h
     146             STPolLinear.h \
     147             STWriter.h \
     148             STAsciiWriter.h
    145149
    146150STATICCCLIB := libasap.a
  • trunk/src/STAsciiWriter.cpp

    r823 r988  
    11//#---------------------------------------------------------------------------
    2 //# SDAsciiWriter.cc: ASAP class to write out single dish spectra as FITS images
     2//# STAsciiWriter.cc: ASAP class to write out single dish spectra as FITS images
    33//#---------------------------------------------------------------------------
    44//# Copyright (C) 2004
     
    3232#include <casa/aips.h>
    3333#include <casa/Arrays/Array.h>
     34#include <casa/Arrays/Matrix.h>
    3435#include <casa/Arrays/Vector.h>
    3536#include <casa/Arrays/VectorIter.h>
     
    3940#include <casa/Utilities/Assert.h>
    4041
    41 #include <casa/iostream.h>
    4242#include <casa/fstream.h>
    4343#include <casa/sstream.h>
    44 
    45 #include <coordinates/Coordinates/CoordinateUtil.h>
    46 #include <coordinates/Coordinates/SpectralCoordinate.h>
    47 #include <coordinates/Coordinates/DirectionCoordinate.h>
    48 #include <coordinates/Coordinates/StokesCoordinate.h>
     44#include <casa/iomanip.h>
    4945
    5046#include <measures/Measures/MEpoch.h>
    5147
    5248#include <tables/Tables/Table.h>
     49#include <tables/Tables/TableIter.h>
     50#include <tables/Tables/TableRecord.h>
     51#include <casa/Containers/RecordField.h>
     52#include <tables/Tables/TableRow.h>
    5353#include <tables/Tables/ScalarColumn.h>
    5454#include <tables/Tables/ArrayColumn.h>
    5555
    56 #include "SDDefs.h"
    57 #include "SDContainer.h"
    58 #include "SDMemTable.h"
    59 #include "SDAsciiWriter.h"
     56#include "STDefs.h"
     57#include "STHeader.h"
     58#include "Scantable.h"
     59#include "STAsciiWriter.h"
    6060
    6161using namespace casa;
     
    6363
    6464
    65 SDAsciiWriter::SDAsciiWriter()
     65STAsciiWriter::STAsciiWriter()
    6666{;}
    6767
    68 SDAsciiWriter::~SDAsciiWriter()
     68STAsciiWriter::~STAsciiWriter()
    6969{;}
    7070
    7171
    72 Bool SDAsciiWriter::write(const SDMemTable& sdTable, const String& fileName, Bool toStokes)
     72Bool STAsciiWriter::write(const Scantable& stable, const String& fileName)
    7373{
    7474
    7575// Get global Header from Table
    7676
    77    SDHeader header = sdTable.getSDHeader();
    78    MEpoch::Ref timeRef(MEpoch::UTC);              // Should be in header   
    79    MDirection::Types dirRef(MDirection::J2000);   // Should be in header   
     77   STHeader hdr = stable.getHeader();
    8078
    8179// Column keywords
    8280
    83    Table tab = sdTable.table();
    84    ROArrayColumn<Double> dir(tab, String("DIRECTION"));
    85    ROScalarColumn<Double> time(tab, "TIME");
    86    ROArrayColumn<uInt> freqid(tab, "FREQID");
    87    ROScalarColumn<String> src(tab, "SRCNAME");
     81   Table tab = stable.table();
    8882
    8983// Temps
    9084
    91    Vector<Int> whichStokes(1,1);
    92    Array<Double> whichDir;
    93    Vector<Double> lonLat(2);
    94    IPosition posDir(2,0);
    9585   const Unit RAD(String("rad"));
    9686
     
    9989   String rootName(fileName);
    10090   if (rootName.length()==0) rootName = String("ascii");
    101    {
    102       String fName = String(rootName) + String("_header.txt");
    103       pushLog("Writing header to "+fName);
    104       ofstream of(fName.chars(), ios::trunc);
    105       std::string summary = sdTable.summary(true);
    106       of << summary;
    107       of.close();
    108    }
    10991
    110 // Open data file
     92  Block<String> cols(4);
     93  cols[0] = String("SCANNO");
     94  cols[1] = String("CYCLENO");
     95  cols[2] = String("BEAMNO");
     96  cols[3] = String("IFNO");
     97  TableIterator iter(tab, cols);
     98  // Open data file
     99  while ( !iter.pastEnd() ) {
     100    Table t = iter.table();
     101    ROTableRow row(t);
     102    const TableRecord& rec = row.get(0);
     103    String dirtype = stable.getDirectionRefString();
     104    ostringstream onstr;
     105    onstr << "SCAN" << rec.asuInt("SCANNO")
     106    << "_CYCLE" << rec.asuInt("CYCLENO")
     107    << "_BEAM" << rec.asuInt("BEAMNO")
     108    << "_IF" << rec.asuInt("IFNO");
     109    String fName = rootName + String(onstr) + String(".txt");
     110    ofstream of(fName.chars(), ios::trunc);
     111    int row0 = t.rowNumbers()[0];
     112    MDirection mdir = stable.getDirection(row0);
     113    of << setfill('#') << setw(70) << "" << setfill(' ') << endl;
     114    addLine(of, "Name", rec.asString("SRCNAME"));
     115    addLine(of, "Position", String(dirtype+ " "+formatDirection(mdir)));
     116    addLine(of, "Time", stable.getTime(row0,true));
     117    addLine(of, "Flux Unit", hdr.fluxunit);
     118    addLine(of, "Pol Type", stable.getPolType());
     119    addLine(of, "Abcissa", stable.getAbcissaLabel(row0));
     120    addLine(of, "Beam No", rec.asuInt("BEAMNO"));
     121    addLine(of, "IF No", rec.asuInt("IFNO"));
     122    of << setfill('#') << setw(70) << "" << setfill(' ') << endl;
    111123
    112    String fName = rootName + String(".txt");
    113    ofstream of(fName.chars(), ios::trunc);
    114 
    115 // Write header
    116 
    117    of << "row beam IF pol source longitude latitude time nchan spectrum mask"
    118       << endl;
    119    
    120 // Loop over rows
    121 
    122    const uInt nRows = sdTable.nRow();
    123    for (uInt iRow=0; iRow<nRows; iRow++) {
    124 
    125 // Get data
    126 
    127       const MaskedArray<Float>& dataIn(sdTable.rowAsMaskedArray(iRow,toStokes));
    128       const Array<Float>& values = dataIn.getArray();
    129       const Array<Bool>& mask = dataIn.getMask();
    130 
    131 // Get abcissa
    132 
    133       std::vector<double> abcissa = sdTable.getAbcissa(Int(iRow));
    134       const uInt n = abcissa.size();
    135 
    136 // Iterate through data in this row by spectra
    137 
    138       ReadOnlyVectorIterator<Float> itData(values, asap::ChanAxis);
    139       ReadOnlyVectorIterator<Bool> itMask(mask, asap::ChanAxis);
    140       while (!itData.pastEnd()) {
    141          const IPosition& pos = itData.pos();
    142          AlwaysAssert(itData.vector().nelements()==n,AipsError);
    143 
    144 // FreqID
    145 
    146          Vector<uInt> iTmp;
    147          freqid.get(iRow, iTmp);
    148 
    149 // Direction
    150  
    151          dir.get(iRow, whichDir);
    152          posDir(0) = pos(asap::BeamAxis);
    153          posDir(1) = 0;
    154          lonLat[0] = whichDir(posDir);
    155 //
    156          posDir(0) = pos(asap::BeamAxis);
    157          posDir(1) = 1;
    158          lonLat[1] = whichDir(posDir);
    159 
    160 // Write preamble
    161 
    162          of << iRow << "  " << pos(asap::BeamAxis) << " " <<  pos(asap::IFAxis) << " " <<
    163                pos(asap::PolAxis) << " " <<
    164                src(iRow) <<  " " << formatDirection(lonLat) << " " <<
    165                sdTable.getTime(iRow,True) << " " << n << " ";
    166 
    167 // Write abcissa
    168 
    169          of.setf(ios::fixed, ios::floatfield);
    170          of.precision(4);
    171          for (uInt i=0; i<n; i++) {
    172             of << abcissa[i] << " ";
    173          }
    174 
    175 // Write data
    176 
    177          const Vector<Float>& data = itData.vector();
    178          const Vector<Bool>& mask = itMask.vector();
    179          for (uInt i=0; i<n; i++) {
    180             of << data[i] << " ";
    181          }
    182 // Write mask
    183 
    184          for (uInt i=0; i<n; i++) {
    185             of << mask[i] << " ";
    186          }
    187          of << endl;
    188 
    189 // Next spectrum
    190 
    191          itData.next();
    192          itMask.next();
     124    of << std::left << setw(16) << "x";
     125    for ( int i=0; i<t.nrow(); ++i ) {
     126      String y = "y"+ String(i);
     127      String ym = "yflag"+ String(i);
     128      of << setw(16) << y;
     129      of << setw(7) << ym;
     130    }
     131    of << endl;
     132    std::vector<double> abc = stable.getAbcissa(row0);
     133    ROArrayColumn<Float> specCol(t,"SPECTRA");
     134    ROArrayColumn<uChar> flagCol(t,"FLAGTRA");
     135    Matrix<Float> specs = specCol.getColumn();
     136    Matrix<uChar> flags = flagCol.getColumn();
     137    for ( int i=0; i<specs.nrow(); ++i ) {
     138      of << setw(16) << setprecision(8) << abc[i] ;
     139      for ( int j=0; j<specs.ncolumn(); ++j ) {
     140        of << setw(16) << setprecision(8) << specs(i,j) ;
     141        of << setw(7) << Int(flags(i,j));
    193142      }
    194    }
    195 
    196    of.close();
    197    ostringstream oss;
    198    oss << "Wrote " << nRows << " rows into file " << fileName;
    199    pushLog(String(oss));
    200    return True;
     143      of << endl;
     144    }
     145    of.close();
     146    ostringstream oss;
     147    oss << "Wrote " << fName;
     148    pushLog(String(oss));
     149    ++iter;
     150  }
     151  return True;
    201152}
    202153
    203154
     155String STAsciiWriter::formatDirection(const MDirection& md) const
     156{
     157  Vector<Double> t = md.getAngle(Unit(String("rad"))).getValue();
     158  Int prec = 7;
    204159
    205 String SDAsciiWriter::formatDirection(const Vector<Double>& lonLat)
    206 {
    207    MVAngle x1(lonLat(0));
    208    String s1 = x1.string(MVAngle::TIME, 12);
    209 
    210    MVAngle x2(lonLat(1));
    211    String s2 = x2.string(MVAngle::ANGLE, 12);
    212 
    213    String ss = s1 + String(" ") + s2;
    214    return ss;
     160  MVAngle mvLon(t[0]);
     161  String sLon = mvLon.string(MVAngle::TIME,prec);
     162  uInt tp = md.getRef().getType();
     163  if (tp == MDirection::GALACTIC ||
     164      tp == MDirection::SUPERGAL ) {
     165    sLon = mvLon(0.0).string(MVAngle::ANGLE_CLEAN,prec);
     166  }
     167  MVAngle mvLat(t[1]);
     168  String sLat = mvLat.string(MVAngle::ANGLE+MVAngle::DIG2,prec);
     169  return sLon + String(" ") + sLat;
    215170}
    216171
     172template <class T>
     173void STAsciiWriter::addLine(ostream& of, const String& lbl, const T& value)
     174{
     175  String label = lbl+String(": ");
     176  of << std::right << "# " << setw(15) << label << std::left
     177     << setw(52) << value << setw(0) << "#"<< endl;
     178}
  • trunk/src/STAsciiWriter.h

    r823 r988  
    11//#---------------------------------------------------------------------------
    2 //# SDAsciiWriter.h: ASAP class to write out single dish spectra as image FITS
     2//# STAsciiWriter.h: ASAP class to write out single dish spectra as image FITS
    33//#---------------------------------------------------------------------------
    44//# Copyright (C) 2004
     
    2929//# $Id$
    3030//#---------------------------------------------------------------------------
    31 #ifndef SDASCIIWRITER_H
    32 #define SDASCIIWRITER_H
     31#ifndef STASCIIWRITER_H
     32#define STASCIIWRITER_H
    3333
    3434#include <casa/aips.h>
    3535#include <casa/BasicSL/String.h>
    36 #include <SDMemTable.h>
     36#include <casa/ostream.h>
    3737
    38 #include "SDLog.h"
     38#include "Scantable.h"
     39#include "Logger.h"
    3940
    4041template<class T> class casa::Vector;
    41 
     42class casa::MDirection;
    4243
    4344namespace asap {
    4445
    45 class SDAsciiWriter : public SDLog {
     46class STAsciiWriter : public Logger {
    4647public:
    4748// Constructor
    48   SDAsciiWriter();
     49  STAsciiWriter();
    4950
    5051// Destructor
    51   ~SDAsciiWriter();
     52  ~STAsciiWriter();
    5253
    5354// Write out ascii table
    54   casa::Bool write(const SDMemTable& table, const casa::String& name, casa::Bool toStokes);
     55  casa::Bool write(const Scantable& table, const casa::String& name);
    5556
    5657private:
    57    casa::Int convertStokes(casa::Int val);
    58    casa::String formatDirection(const casa::Vector<casa::Double>& lonLat);
     58  casa::String formatDirection(const casa::MDirection& md) const;
     59  template <class T>
     60  void addLine(std::ostream& of, const casa::String& lbl,
     61               const T& value);
    5962};
    6063
  • trunk/src/STWriter.cpp

    r901 r988  
    4848
    4949//#include "SDFITSImageWriter.h"
    50 //#include "STAsciiWriter.h"
     50#include "STAsciiWriter.h"
    5151#include "STHeader.h"
    5252
     
    5858STWriter::STWriter(const std::string &format)
    5959{
    60   cFormat = format;
    61   String t(cFormat);
     60  format_ = format;
     61  String t(format_);
    6262  t.upcase();
    6363  if (t== "MS2") {
    64     cWriter = new PKSMS2writer();
     64    writer_ = new PKSMS2writer();
    6565  } else if (t== "SDFITS") {
    66     cWriter = new PKSSDwriter();
     66    writer_ = new PKSSDwriter();
    6767  } else if (t== "FITS") {
    68     cWriter = 0;
     68    writer_ = 0;
    6969  } else if (t== "ASCII") {
    70     cWriter = 0;
     70    writer_ = 0;
     71  } else {
     72    throw (AipsError("Unrecognized export format"));
     73  }
     74}
     75
     76STWriter::~STWriter()
     77{
     78   if (writer_) {
     79     delete writer_;
     80   }
     81}
     82
     83Int STWriter::setFormat(const std::string &format)
     84{
     85  if (format != format_) {
     86    if (writer_) delete writer_;
     87  }
     88
     89  format_ = format;
     90  String t(format_);
     91  t.upcase();
     92  if (t== "MS2") {
     93    writer_ = new PKSMS2writer();
     94  } else if (t== "SDFITS") {
     95    writer_ = new PKSSDwriter();
     96  } else if (t== "FITS") {
     97    writer_ = 0;
     98  } else if (t== "ASCII") {
     99    writer_ = 0;
    71100  } else {
    72101    throw (AipsError("Unrecognized Format"));
    73102  }
    74 }
    75 
    76 STWriter::~STWriter()
    77 {
    78    if (cWriter) {
    79      delete cWriter;
    80    }
    81 }
    82 
    83 Int STWriter::setFormat(const std::string &format)
    84 {
    85   if (format != cFormat) {
    86     if (cWriter) delete cWriter;
    87   }
    88 
    89   cFormat = format;
    90   String t(cFormat);
    91   t.upcase();
    92   if (t== "MS2") {
    93     cWriter = new PKSMS2writer();
    94   } else if (t== "SDFITS") {
    95     cWriter = new PKSSDwriter();
    96   } else if (t== "FITS") {
    97     cWriter = 0;
    98   } else if (t== "ASCII") {
    99     cWriter = 0;
    100   } else {
    101     throw (AipsError("Unrecognized Format"));
    102   }
    103103  return 0;
    104104}
     
    110110// Image FITS
    111111
    112   if (cFormat=="FITS") {
     112  if (format_=="FITS") {
    113113//      Bool verbose = True;
    114114//      SDFITSImageWriter iw;
     
    118118//         return 1;
    119119//      }
    120   } else if (cFormat=="ASCII") {
    121      /*SDAsciiWriter iw;
     120  } else if (format_=="ASCII") {
     121     STAsciiWriter iw;
    122122     if (iw.write(*in, filename)) {
    123123        return 0;
    124124     } else {
    125125        return 1;
    126      }*/
     126     }
    127127  }
    128128
     
    140140  // Create the output file and write static data.
    141141  Int status;
    142   if (status = cWriter->create(filename, hdr.observer, hdr.project,
     142  Bool havexpol = Bool(in->npol() > 2);
     143  if (status = writer_->create(filename, hdr.observer, hdr.project,
    143144                               hdr.antennaname, hdr.antennaposition,
    144145                               hdr.obstype, hdr.equinox, hdr.freqref,
    145                                nChan, nPol, False, False)) {
     146                               nChan, nPol, False, havexpol)) {
    146147    throw(AipsError("Failed to create output file"));
    147148  }
     
    161162  while (!scanit.pastEnd() ) {
    162163    Table stable = scanit.table();
    163     TableIterator beamit(table, "BEAMNO");
     164    TableIterator beamit(stable, "BEAMNO");
    164165    Int beamno = 1;
    165166    while (!beamit.pastEnd() ) {
     
    168169      MDirection::ScalarColumn dirCol(btable, "DIRECTION");
    169170      Vector<Double> direction = dirCol(0).getAngle("rad").getValue();
    170       TableIterator ifit(btable, "IFNO");
    171       Int ifno = 1;
    172       while (!ifit.pastEnd() ) {
    173         Table itable = ifit.table();
    174         TableIterator cycit(itable, "CYCLENO");
    175         Int cycno = 1;
    176         while (!cycit.pastEnd() ) {
    177           Table ctable = cycit.table();
    178           TableRow row(ctable);
     171      TableIterator cycit(btable, "CYCLENO");
     172      Int cycno = 1;
     173      while (!cycit.pastEnd() ) {
     174        Table ctable = cycit.table();
     175        TableIterator ifit(ctable, "IFNO");
     176        Int ifno = 1;
     177        while (!ifit.pastEnd() ) {
     178          Table itable = ifit.table();
     179          TableRow row(itable);
    179180          // use the first row to fill in all the "metadata"
    180181          const TableRecord& rec = row.get(0);
    181           ROArrayColumn<Float> specCol(ctable, "SPECTRA");
     182          ROArrayColumn<Float> specCol(itable, "SPECTRA");
    182183          uInt nchan = specCol(0).nelements();
    183184          Double cdelt,crval,crpix, restfreq;
    184185          Float focusAxi, focusTan, focusRot,
    185186                temperature, pressure, humidity, windSpeed, windAz;
     187          Float tmp0,tmp1,tmp2,tmp3,tmp4;
    186188          Vector<Float> tcalval;
    187           String tmp,tmp2, tcalt;
     189          String stmp0,stmp1, tcalt;
    188190          in->frequencies().getEntry(crpix,crval,cdelt, rec.asuInt("FREQ_ID"));
    189           in->molecules().getEntry(restfreq,tmp,tmp2,rec.asuInt("RESTFREQ_ID"));
     191          in->focus().getEntry(focusAxi, focusTan, focusRot,
     192                               tmp0,tmp1,tmp2,tmp3,tmp4,
     193                               rec.asuInt("FOCUS_ID"));
     194          in->molecules().getEntry(restfreq,stmp0,stmp1,rec.asuInt("MOLECULE_ID"));
    190195          in->tcal().getEntry(tcalt,tcalval,rec.asuInt("TCAL_ID"));
    191196          in->weather().getEntry(temperature, pressure, humidity,
     
    198203          Matrix<uChar> flags;
    199204          Vector<Complex> xpol;
    200           polConversion(specs, flags, xpol, ctable);
    201           Vector<Float> tsys = tsysFromTable(ctable);
     205          polConversion(specs, flags, xpol, itable);
     206          Vector<Float> tsys = tsysFromTable(itable);
    202207          // dummy data
    203208          uInt npol = specs.ncolumn();
     209
    204210          Matrix<Float>   baseLin(npol,2, 0.0f);
    205211          Matrix<Float>   baseSub(npol,9, 0.0f);
     
    208214          Vector<Float>   sigma(npol, 0.0f);
    209215          Vector<Float>   calFctr(npol, 0.0f);
    210 
    211 
    212           if (status = cWriter->write(scanno, cycno, rec.asDouble("TIME"),
     216          if (status = writer_->write(scanno, cycno, rec.asDouble("TIME"),
    213217                                      rec.asDouble("INTERVAL"),
    214218                                      rec.asString("FIELDNAME"),
     
    224228                                      rec.asFloat("ELEVATION"),
    225229                                      rec.asFloat("PARANGLE"),
    226                                       focusAxi, focusTan, focusRot,//
     230                                      focusAxi, focusTan, focusRot,
    227231                                      temperature,
    228232                                      pressure, humidity, windSpeed, windAz,
    229                                       rec.asInt("REFBEAM"), beamno,
     233                                      rec.asInt("REFBEAMNO")+1, beamno,
    230234                                      direction,
    231235                                      scanRate,// not in scantable
     
    237241                                      xpol)
    238242                                      ) {
    239             cerr << "Error writing output file." << endl;
    240             return 1;
     243            writer_->close();
     244            throw(AipsError("STWriter: Failed to export Scantable."));
    241245          }
    242246
    243           ++cycno;
    244           ++cycit;
     247          ++ifno;
     248          ++ifit;
    245249        }
    246         ++ifno;
    247         ++ifit;
     250        ++cycno;
     251        ++cycit;
    248252      }
    249253      ++beamno;
     
    256260  oss << "STWriter: wrote " << count << " rows to " << filename << endl;
    257261  pushLog(String(oss));
    258   cWriter->close();
     262  writer_->close();
    259263
    260264  return 0;
     
    267271  Vector<Float> tmp;
    268272  for (uInt i=0; i<tab.nrow(); ++i) {
     273    tmp.resize();
    269274    tmp = tsysCol(i);
    270275    out[i] = tmp[0];
    271276  }
     277  return out;
    272278}
    273279
     
    277283  TableRow row(tab);
    278284  String poltype = tab.keywordSet().asString("POLTYPE");
    279   if ( poltype != "linear")
     285  if ( poltype != "linear") {
    280286    String msg = "poltype = " + poltype + " not yet supported in output.";
    281     throw(AipsError("msg"));
     287    throw(AipsError(msg));
     288  }
    282289  // use the first row to fill in all the "metadata"
    283290  const TableRecord& rec = row.get(0);
     
    285292  ROArrayColumn<uChar> flagCol(tab, "FLAGTRA");
    286293  uInt nchan = specCol(0).nelements();
    287   uInt ncols = (tab.nrow()==1 ? 1: 2 );
    288   specs.resize(nchan, ncols);
    289   flags.resize(nchan, ncols);
     294  uInt ncol = (tab.nrow()==1 ? 1: 2 );
     295  specs.resize(nchan, ncol);
     296  flags.resize(nchan, ncol);
    290297  // the linears
    291   for (uInt i=0; i<ncols; ++i) {
     298  for (uInt i=0; i<ncol; ++i) {
    292299    specs.column(i) = specCol(i);
    293300    flags.column(i) = flagCol(i);
  • trunk/src/STWriter.h

    r894 r988  
    5050  * @brief Export of ASAP data container into foreign formats
    5151  * @author Malte Marquarding
    52   * @date $Date$
     52  * @date 2006-03-08
    5353  * @version 2.0a
    5454*/
     
    8181                      casa::Vector<casa::Complex>& xpol,
    8282                      const casa::Table& tab);
    83   std::string     cFormat;
    84   PKSwriter *cWriter;
     83  std::string     format_;
     84  PKSwriter* writer_;
    8585};
    8686
  • trunk/src/STWriterWrapper.h

    r982 r988  
    2727//#                        AUSTRALIA
    2828//#
    29 //# $Id:
     29//# $Id:$
    3030//#---------------------------------------------------------------------------
    31 #ifndef SDWRITERWRAPPER_H
    32 #define SDWRITERWRAPPER_H
     31#ifndef STWRITERWRAPPER_H
     32#define STWRITERWRAPPER_H
    3333
    3434#include <vector>
    3535#include <string>
     36
     37#include "ScantableWrapper.h"
    3638
    3739#include "STWriter.h"
     
    3941namespace asap {
    4042
    41 class SDMemTableWrapper;
    42 
    4343class STWriterWrapper : public STWriter {
    4444public:
    45   STWriterWrapper(const string &format = "SDFITS") : STWriter(format) {;}
     45  STWriterWrapper(const string& format = "SDFITS") : STWriter(format) {;}
    4646
    47   casa::Int write(const SDMemTableWrapper &table, const string &filename, bool toStokes) {
    48     return STWriter::write(table.getCP(), filename, toStokes);
     47  casa::Int write(const ScantableWrapper& table, const string &filename) {
     48    return STWriter::write(table.getCP(), filename);
    4949  }
    5050};
  • trunk/src/python_STWriter.cpp

    r892 r988  
    11//#---------------------------------------------------------------------------
    2 //# python_SDWriter.cc: Python binding to C++ SDWriter class.
     2//# python_STWriter.cc: Python binding to C++ SDWriter class.
    33//#---------------------------------------------------------------------------
    44//# Copyright (C) 2004
     
    3131#include <boost/python.hpp>
    3232
    33 #include "SDWriterWrapper.h"
     33#include "STWriterWrapper.h"
    3434
    3535using namespace boost::python;
     
    3838  namespace python  {
    3939
    40 void python_SDWriter() {
    41   class_<SDWriterWrapper>("sdwriter")
    42     .def(init <> ())
    43     .def(init <std::string> ())
    44     .def("setformat", &SDWriterWrapper::setFormat,
    45         (boost::python::arg("format")="SDFITS"))
    46     .def("write",     &SDWriterWrapper::write);
    47   ;
    48 };
    49 
     40    void python_STWriter() {
     41      class_<STWriterWrapper>("stwriter")
     42        .def(init <> ())
     43        .def(init <std::string> ())
     44        .def("setformat", &STWriterWrapper::setFormat,
     45        (boost::python::arg("format")="STFITS"))
     46        .def("write",     &STWriterWrapper::write);
     47      ;
     48    };
    5049  } // namespace python
    5150} // namespace asap
  • trunk/src/python_asap.cpp

    r960 r988  
    6363  asap::python::python_STLineFinder();
    6464  asap::python::python_STFitEntry();
    65   /*
    66   asap::python::python_SDWriter();
    67   */
     65
     66  asap::python::python_STWriter();
     67
    6868  asap::python::python_Logger();
    6969  register_exception_translator<casa::AipsError>(&asap::python::translate_ex);
  • trunk/src/python_asap.h

    r960 r988  
    4444    void python_STLineFinder();
    4545    void python_STFitEntry();
    46     /*
    47     void python_SDWriter();
    48     */
     46
     47    void python_STWriter();
    4948    void python_Logger();
    5049
Note: See TracChangeset for help on using the changeset viewer.