Ignore:
Timestamp:
02/15/05 11:59:01 (19 years ago)
Author:
kil064
Message:

add stokes conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDFITSImageWriter.cc

    r414 r443  
    5252
    5353#include <measures/Measures/MEpoch.h>
     54#include <measures/Measures/Stokes.h>
    5455
    5556#include <tables/Tables/Table.h>
     
    6061#include "SDContainer.h"
    6162#include "SDMemTable.h"
     63#include "SDPol.h"
    6264
    6365using namespace casa;
     
    7375
    7476Bool SDFITSImageWriter::write(const SDMemTable& sdTable,
    75                               const String& dirName, Bool verbose)
     77                              const String& dirName, Bool toStokes,
     78                              Bool verbose)
    7679{
    7780
     
    131134   Vector<Double> refPixLonLat(2,0.0);
    132135
     136// Do we have linear or circular ?  No way to know yet...
     137
     138   Bool linear = True;
     139
    133140// Loop over rows
    134141
     
    147154   for (uInt iRow=0; iRow<nRows; iRow++) {
    148155
    149 // Get data
    150 
    151       const MaskedArray<Float>& dataIn(sdTable.rowAsMaskedArray(iRow));
     156// Get data converted to Stokes
     157
     158      const MaskedArray<Float>& dataIn(sdTable.rowAsMaskedArray(iRow,False,toStokes));
    152159      const Array<Float>& values = dataIn.getArray();
    153160      const Array<Bool>& mask = dataIn.getMask();
     
    196203                               refPixLonLat[0], refPixLonLat[1]);
    197204
    198 // Form Stokes Coordinate (no true Stokes info yet);
    199 
    200          whichStokes(0) = convertStokes(pos(stokesAxis));
     205// Form Stokes Coordinate (Stokes info still sketchy);
     206
     207         Stokes::StokesTypes stokes = SDPolUtil::convertStokes(pos(stokesAxis), toStokes, linear);
     208         String stokesName = Stokes::name(stokes);
     209         whichStokes(0) = Int(stokes);
    201210         StokesCoordinate stC(whichStokes);
    202211
     
    226235         ostringstream oss;
    227236         oss << "row" << iRow << "_beam" << pos(0) << "_if"
    228              << pos(1) << "_pol" << pos(2) << "_" << srcCol(iRow) << ".fits";
     237             << pos(1) << "_" << stokesName << "_" << srcCol(iRow) << ".fits";
    229238         String tS(oss);
    230239         String fileName = dirName2 + String("/") + tS;
     
    256265
    257266
    258 Int SDFITSImageWriter::convertStokes(Int val)
    259 {
    260    Stokes::StokesTypes stokes = Stokes::RR;
    261    if (val==0) {
    262       stokes = Stokes::XX;
    263    } else if (val==1) {
    264       stokes = Stokes::YY;
    265    } else if (val==2) {
    266       stokes = Stokes::XY;
    267    } else if (val==3) {
    268       stokes = Stokes::YX;
    269    } else {
    270       stokes = Stokes::Undefined;
    271    }
    272 //
    273    return Int(stokes);
    274 }
Note: See TracChangeset for help on using the changeset viewer.