source: trunk/src/STPol.h@ 923

Last change on this file since 923 was 904, checked in by mar637, 19 years ago

Polarimetry handling and conversion

File size: 2.7 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() {}
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 == "cicular" )
55 return getLinPol(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 void setPhaseCorrections(casa::Float, casa::Float, casa::Float) {}
85
86 static std::pair<int, std::string> polFromString(const std::string& key);
87 static std::string getPolLabel(int index, const std::string& type = "linear");
88
89private:
90 static void initPolMap();
91 static void initLabelMap();
92 static std::map<std::string, std::pair<int, std::string> > polmap_;
93 static std::map<std::string, std::map<int, std::string> > labelmap_;
94
95 casa::Vector<casa::Float> phaseCorrections_;
96 std::string mode_;
97 casa::Matrix<casa::Float> basespectra_;
98
99};
100
101}
102
103#endif
Note: See TracBrowser for help on using the repository browser.