[910] | 1 | //
|
---|
| 2 | // C++ Implementation: STPolStokes
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
| 7 | // Author: Malte Marquarding <Malte.Marquarding@csiro.au>, (C) 2006
|
---|
| 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
| 12 |
|
---|
| 13 | #include <casa/Arrays/ArrayMath.h>
|
---|
| 14 | #include <casa/BasicMath/Math.h>
|
---|
| 15 | #include <casa/Exceptions/Error.h>
|
---|
| 16 | #include <casa/BasicSL/Constants.h>
|
---|
| 17 | #include "STPolStokes.h"
|
---|
| 18 |
|
---|
| 19 | using namespace casa;
|
---|
| 20 |
|
---|
| 21 | namespace asap {
|
---|
| 22 |
|
---|
| 23 | Factory<STPol,STPolStokes> STPolStokes::myFactory;
|
---|
| 24 |
|
---|
| 25 | STPolStokes::~STPolStokes()
|
---|
| 26 | {
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | Vector<Float> asap::STPolStokes::getStokes( uint index )
|
---|
| 31 | {
|
---|
| 32 | return getSpectrum(index);
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | Vector<Float> asap::STPolStokes::getLinPol( uInt index )
|
---|
| 36 | {
|
---|
| 37 | if ( index < 0 || index >4 ) throw(AipsError("LinPol index out of range"));
|
---|
| 38 | Vector<Float> out;
|
---|
| 39 | if ( nspec() == 4) {
|
---|
| 40 | switch(index) {
|
---|
| 41 | case 1:
|
---|
| 42 | out = Vector<Float>(sqrt(pow(getSpectrum(1),Float(2.0))
|
---|
| 43 | +pow(getSpectrum(2), Float(2.0))));
|
---|
| 44 | break;
|
---|
| 45 | case 2:
|
---|
| 46 | out = Vector<Float>(Float(180.0/C::pi/2.0)
|
---|
| 47 | * atan2(getSpectrum(2),getSpectrum(1)));
|
---|
| 48 | break;
|
---|
| 49 | default:
|
---|
| 50 | out = getSpectrum(index);
|
---|
| 51 | }
|
---|
| 52 | }
|
---|
| 53 | return out;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | Vector<Float> asap::STPolStokes::getLinear(uInt index )
|
---|
| 57 | {
|
---|
| 58 | Vector<Float> out;
|
---|
| 59 | switch(index) {
|
---|
| 60 | case 0:
|
---|
| 61 | case 1:
|
---|
| 62 | out = getSpectrum(0)/Float(2.0);
|
---|
| 63 | break;
|
---|
| 64 | default:
|
---|
| 65 | out = Vector<Float>();
|
---|
| 66 | }
|
---|
| 67 | return out;
|
---|
| 68 |
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | Vector<Float> asap::STPolStokes::getCircular(uInt index )
|
---|
| 72 | {
|
---|
| 73 | // convert to stokes I/ V first
|
---|
| 74 | //
|
---|
| 75 | // We use the convention
|
---|
| 76 | // I = (RR+LL) // definition changed
|
---|
| 77 |
|
---|
| 78 | if ( index == 2 || index ==3 ) throw(AipsError("Re/Imag RL not implemented"));
|
---|
| 79 | Vector<Float> out;
|
---|
| 80 | switch(index) {
|
---|
| 81 | case 0:
|
---|
[957] | 82 | out = (getSpectrum(0) + getSpectrum(3));
|
---|
[910] | 83 | break;
|
---|
| 84 | case 1:
|
---|
[957] | 85 | out = (getSpectrum(0) - getSpectrum(3));
|
---|
[910] | 86 | break;
|
---|
| 87 | default:
|
---|
| 88 | out = Vector<Float>();
|
---|
| 89 | }
|
---|
| 90 | return out;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | }
|
---|