// // C++ Implementation: STPolStokes // // Description: // // // Author: Malte Marquarding , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include #include #include #include #include "STPolStokes.h" using namespace casa; namespace asap { Factory STPolStokes::myFactory; STPolStokes::~STPolStokes() { } Vector asap::STPolStokes::getStokes( uint index ) { return getSpectrum(index); } Vector asap::STPolStokes::getLinPol( uInt index ) { // if ( index < 0 || index >4 ) throw(AipsError("LinPol index out of range")); if ( index >= 4 ) throw(AipsError("LinPol index out of range")); Vector out; if ( nspec() == 4) { switch(index) { case 1: out = Vector(sqrt(pow(getSpectrum(1),Float(2.0)) +pow(getSpectrum(2), Float(2.0)))); break; case 2: out = Vector(Float(180.0/C::pi/2.0) * atan2(getSpectrum(2),getSpectrum(1))); break; default: out = getSpectrum(index); } } return out; } Vector asap::STPolStokes::getLinear(uInt index ) { Vector out; switch(index) { case 0: out = (getSpectrum(0)+getSpectrum(1))/Float(2.0); break; case 1: out = (getSpectrum(0)-getSpectrum(1))/Float(2.0); break; case 2: out = getSpectrum(2)/Float(2.0); break; case 3: out = getSpectrum(3)/Float(2.0); break; default: out = Vector(); } return out; } Vector asap::STPolStokes::getCircular(uInt index ) { // convert to stokes I/ V first // // We use the convention // I = (RR+LL) // definition changed if ( index == 2 || index ==3 ) throw(AipsError("Re/Imag RL not implemented")); Vector out; switch(index) { case 0: out = (getSpectrum(0) + getSpectrum(3))/Float(2.0); break; case 1: out = (getSpectrum(0) - getSpectrum(3))/Float(2.0); break; default: out = Vector(); } return out; } }