source: branches/alma/src/STPol.h@ 2885

Last change on this file since 2885 was 1757, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


File size: 2.8 KB
Line 
1//
2// C++ Interface: STPol
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#ifndef ASAPSTPOL_H
13#define ASAPSTPOL_H
14
15#include <map>
16#include <utility>
17
18#include <casa/aips.h>
19#include <casa/Exceptions/Error.h>
20#include <casa/Arrays/Matrix.h>
21#include <casa/Arrays/Vector.h>
22#include "Factory.h"
23
24namespace asap {
25
26/**
27Convert betweeen the possible polarisations (linear, circular, stokes, stokes2)
28
29@author Malte Marquarding
30@date $Date:$
31
32*/
33class STPol {
34public:
35
36 typedef void (STPol::*polOperation)( casa::Float phase );
37 STPol(): totalangle_(0.0),feedhand_(1.0) {}
38 virtual ~STPol() {}
39
40 typedef FactoryBase<STPol> STPolFactory;
41
42 static STPol* getPolClass( std::map<std::string,STPol::STPolFactory *> factories,
43 const std::string& type )
44 { return factories[type]->create(); }
45
46 casa::Vector<casa::Float> getSpectrum( casa::uInt index, const std::string& mode )
47 {
48 if (mode == "linear")
49 return getLinear(index);
50 else if ( mode == "stokes" )
51 return getStokes(index);
52 else if ( mode == "linpol" )
53 return getLinPol(index);
54 else if ( mode == "circular" )
55 return getCircular(index);
56 else
57 throw(casa::AipsError("Polarisation type unknown"));
58 }
59
60 virtual casa::Vector<casa::Float> getCircular( casa::uInt index ) = 0;
61
62 virtual casa::Vector<casa::Float> getStokes( casa::uInt index ) = 0;
63
64 virtual casa::Vector<casa::Float> getLinPol( casa::uInt index ) = 0;
65
66 virtual casa::Vector<casa::Float> getLinear( casa::uInt index ) = 0;
67
68 virtual void rotatePhase( casa::Float phase ) {}
69 virtual void rotateLinPolPhase( casa::Float phase ) {}
70
71 virtual void invertPhase( casa::Float phase ) {}
72
73 casa::uInt nspec() const { return basespectra_.ncolumn(); }
74
75 const casa::Vector<casa::Float> getSpectrum(casa::uInt index) const
76 { return basespectra_.column(index); }
77
78 casa::Matrix<casa::Float>& getSpectra()
79 { return basespectra_; }
80
81 void setSpectra(const casa::Matrix<casa::Float>& spec)
82 { basespectra_.resize(); basespectra_ = spec; }
83
84
85 void setPhaseCorrections(casa::Float totalang=0.0, casa::Float feedhand=1.0)
86 { totalangle_=totalang;feedhand_=feedhand;}
87
88 casa::Float getTotalPhase() const { return totalangle_; }
89 casa::Float getFeedHand() const { return feedhand_; }
90
91 static std::pair<int, std::string> polFromString(const std::string& key);
92 static std::string getPolLabel(int index, const std::string& type = "linear");
93
94private:
95 static void initPolMap();
96 static void initLabelMap();
97 static std::map<std::string, std::pair<int, std::string> > polmap_;
98 static std::map<std::string, std::map<int, std::string> > labelmap_;
99
100 casa::Float totalangle_,feedhand_;
101 std::string mode_;
102 casa::Matrix<casa::Float> basespectra_;
103
104};
105
106}
107
108#endif
Note: See TracBrowser for help on using the repository browser.