source: trunk/src/STPolCircular.cpp@ 3149

Last change on this file since 3149 was 3106, checked in by Takeshi Nakazato, 8 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes/No

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...


Check-in asap modifications from Jim regarding casacore namespace conversion.

File size: 2.3 KB
RevLine 
[1189]1//
2// C++ Implementation: STPolCircular
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 "STPolCircular.h"
18
[3106]19using namespace casacore;
[1189]20
21namespace asap {
22
23Factory<STPol,STPolCircular> STPolCircular::myFactory;
24
25STPolCircular::~STPolCircular()
26{
27}
28
29
30Vector<Float> asap::STPolCircular::getStokes( uint index )
31{
32 /// @todo implement full stokes support when circular cross pols are available
33 Vector<Float> out;
34 if (nspec() == 2) {
35 if ( index == 0 )
36 out = Vector<Float>(getSpectrum(0) + getSpectrum(1));
[1259]37 else if ( index == 3 )
38 out = Vector<Float>(getSpectrum(0) - getSpectrum(1));
[1189]39 }
40 return out;
41}
42
43Vector<Float> asap::STPolCircular::getLinPol( uInt index )
44{
45 if (nspec() != 4) {
46 throw(AipsError("You must have 4 circular polarisations to run this function"));
47 }
[3080]48// if ( index < 0 || index >4 ) throw(AipsError("LinPol index out of range"));
49 if ( index >= 4 ) throw(AipsError("LinPol index out of range"));
[1189]50 Vector<Float> out,q,u;
51 if ( nspec() == 4) {
52 switch(index) {
53 case 1:
54 q = getStokes(1);
55 u = getStokes(2);
56 out = Vector<Float>(sqrt(pow(q,Float(2.0))+pow(u, Float(2.0))));
57 break;
58 case 2:
59 q = getStokes(1);
60 u = getStokes(2);
61 out = Vector<Float>(Float(180.0/C::pi/2.0) * atan2(u,q));
62 break;
63 default:
64 out = getStokes(index);
65 }
66 }
67 return out;
68}
69
70Vector<Float> asap::STPolCircular::getCircular(uInt index )
71{
72 return getSpectrum(index);
73}
74
75Vector<Float> asap::STPolCircular::getLinear(uInt index )
76{
77 // convert to stokes I/ V first
78 //
79 // We use the convention
80 // I = (XX+YY) // definition changed
81
82 if (nspec() != 4) {
83 throw(AipsError("You must have 4 circular polarisations to run this function"));
84 }
85 if ( index == 2 || index ==3 ) throw(AipsError("Re/Imag XY not implemented"));
86 Vector<Float> I,V,out;
87 I = getStokes(0);
88 V = getStokes(3);
89 switch(index) {
90 case 0:
91 out = (I + V)/Float(2.0);
92 break;
93 case 1:
94 out = (I - V)/Float(2.0);
95 break;
96 default:
97 out = Vector<Float>();
98 }
99 return out;
100}
101
102}
Note: See TracBrowser for help on using the repository browser.