Changeset 443


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

add stokes conversion

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDAsciiWriter.cc

    r414 r443  
    6969
    7070
    71 Bool SDAsciiWriter::write(const SDMemTable& sdTable, const String& fileName)
     71Bool SDAsciiWriter::write(const SDMemTable& sdTable, const String& fileName, Bool toStokes)
    7272{
    7373
     
    112112// Get data
    113113
    114       const MaskedArray<Float>& dataIn(sdTable.rowAsMaskedArray(iRow));
     114      const MaskedArray<Float>& dataIn(sdTable.rowAsMaskedArray(iRow,False,toStokes));
    115115      const Array<Float>& values = dataIn.getArray();
    116116      const Array<Bool>& mask = dataIn.getMask();
     
    181181
    182182
    183 Int SDAsciiWriter::convertStokes(Int val)
    184 {
    185    Stokes::StokesTypes stokes = Stokes::RR;
    186    if (val==0) {
    187       stokes = Stokes::RR;
    188    } else if (val==1) {
    189       stokes = Stokes::LL;
    190    } else if (val==2) {
    191       stokes = Stokes::RL;
    192    } else if (val==3) {
    193       stokes = Stokes::LR;
    194    } else {
    195       stokes = Stokes::Undefined;
    196    }
    197 //
    198    return Int(stokes);
    199 }
    200 
    201183
    202184String SDAsciiWriter::formatDirection(const Vector<Double>& lonLat)
  • trunk/src/SDAsciiWriter.h

    r209 r443  
    5050
    5151// Write out ascii table
    52   casa::Bool write(const SDMemTable& table, const casa::String& name);
     52  casa::Bool write(const SDMemTable& table, const casa::String& name, casa::Bool toStokes);
    5353
    5454private:
  • 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 }
  • trunk/src/SDFITSImageWriter.h

    r209 r443  
    4949// Write out lots of FITS images, one per row, beam, IF and polarization
    5050  casa::Bool write(const SDMemTable& table, const casa::String& rootName,
    51                    casa::Bool verbose=casa::True);
     51                   casa::Bool toStokes, casa::Bool verbose=casa::True);
    5252
    5353private:
    54    casa::Int convertStokes(casa::Int val);
     54   casa::Int convertStokes(casa::Int val, casa::Bool toStokes, casa::Bool linear) const;
    5555};
    5656
Note: See TracChangeset for help on using the changeset viewer.