source: trunk/src/STPol.h@ 3144

Last change on this file since 3144 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: 3.0 KB
RevLine 
[904]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
[3106]29@author Malte Marquarding @date $Date:$
[904]30
31*/
32class STPol {
33public:
34
[3106]35 typedef void (STPol::*polOperation)( casacore::Float phase );
[1586]36 STPol(): totalangle_(0.0),feedhand_(1.0) {}
[904]37 virtual ~STPol() {}
38
39 typedef FactoryBase<STPol> STPolFactory;
40
41 static STPol* getPolClass( std::map<std::string,STPol::STPolFactory *> factories,
42 const std::string& type )
43 { return factories[type]->create(); }
44
[3106]45 casacore::Vector<casacore::Float> getSpectrum( casacore::uInt index, const std::string& mode )
[904]46 {
47 if (mode == "linear")
48 return getLinear(index);
49 else if ( mode == "stokes" )
50 return getStokes(index);
51 else if ( mode == "linpol" )
52 return getLinPol(index);
[957]53 else if ( mode == "circular" )
54 return getCircular(index);
[904]55 else
[3106]56 throw(casacore::AipsError("Polarisation type unknown"));
[904]57 }
58
[3106]59 virtual casacore::Vector<casacore::Float> getCircular( casacore::uInt index ) = 0;
[904]60
[3106]61 virtual casacore::Vector<casacore::Float> getStokes( casacore::uInt index ) = 0;
[904]62
[3106]63 virtual casacore::Vector<casacore::Float> getLinPol( casacore::uInt index ) = 0;
[904]64
[3106]65 virtual casacore::Vector<casacore::Float> getLinear( casacore::uInt index ) = 0;
[904]66
[3106]67 virtual void rotatePhase( casacore::Float ) {}
68 virtual void rotateLinPolPhase( casacore::Float) {}
[904]69
[3106]70 virtual void invertPhase( casacore::Float ) {}
[904]71
[3106]72 casacore::uInt nspec() const { return basespectra_.ncolumn(); }
[904]73
[3106]74 const casacore::Vector<casacore::Float> getSpectrum(casacore::uInt index) const
[904]75 { return basespectra_.column(index); }
76
[3106]77 casacore::Matrix<casacore::Float>& getSpectra()
[904]78 { return basespectra_; }
79
[3106]80 void setSpectra(const casacore::Matrix<casacore::Float>& spec)
[904]81 { basespectra_.resize(); basespectra_ = spec; }
82
83
[3106]84 void setPhaseCorrections(casacore::Float totalang=0.0, casacore::Float feedhand=1.0)
[1586]85 { totalangle_=totalang;feedhand_=feedhand;}
[957]86
[3106]87 casacore::Float getTotalPhase() const { return totalangle_; }
88 casacore::Float getFeedHand() const { return feedhand_; }
[957]89
[904]90 static std::pair<int, std::string> polFromString(const std::string& key);
91 static std::string getPolLabel(int index, const std::string& type = "linear");
92
93private:
94 static void initPolMap();
95 static void initLabelMap();
96 static std::map<std::string, std::pair<int, std::string> > polmap_;
97 static std::map<std::string, std::map<int, std::string> > labelmap_;
98
[3106]99 casacore::Float totalangle_,feedhand_;
[904]100 std::string mode_;
[3106]101 casacore::Matrix<casacore::Float> basespectra_;
[904]102
103};
104
105}
106
107#endif
Note: See TracBrowser for help on using the repository browser.