source: trunk/src/STPol.h @ 3106

Last change on this file since 3106 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
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 @date $Date:$
30
31*/
32class STPol {
33public:
34
35  typedef  void (STPol::*polOperation)( casacore::Float phase );
36  STPol(): totalangle_(0.0),feedhand_(1.0) {}
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
45  casacore::Vector<casacore::Float> getSpectrum( casacore::uInt index, const std::string& mode )
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);
53      else if ( mode == "circular" )
54        return getCircular(index);
55      else
56        throw(casacore::AipsError("Polarisation type unknown"));
57    }
58
59  virtual casacore::Vector<casacore::Float> getCircular( casacore::uInt index ) = 0;
60
61  virtual casacore::Vector<casacore::Float> getStokes( casacore::uInt index ) = 0;
62
63  virtual casacore::Vector<casacore::Float> getLinPol( casacore::uInt index ) = 0;
64
65  virtual casacore::Vector<casacore::Float> getLinear( casacore::uInt index ) = 0;
66
67  virtual void rotatePhase( casacore::Float ) {}
68  virtual void rotateLinPolPhase( casacore::Float) {}
69
70  virtual void invertPhase( casacore::Float ) {}
71
72  casacore::uInt nspec() const { return basespectra_.ncolumn(); }
73
74  const casacore::Vector<casacore::Float> getSpectrum(casacore::uInt index) const
75    { return basespectra_.column(index); }
76
77  casacore::Matrix<casacore::Float>& getSpectra()
78    { return basespectra_; }
79
80  void setSpectra(const casacore::Matrix<casacore::Float>& spec)
81    { basespectra_.resize(); basespectra_ = spec; }
82
83
84  void setPhaseCorrections(casacore::Float totalang=0.0, casacore::Float feedhand=1.0)
85    { totalangle_=totalang;feedhand_=feedhand;}
86
87  casacore::Float getTotalPhase() const { return totalangle_; }
88  casacore::Float getFeedHand() const { return feedhand_; }
89
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
99  casacore::Float totalangle_,feedhand_;
100  std::string mode_;
101  casacore::Matrix<casacore::Float> basespectra_;
102
103};
104
105}
106
107#endif
Note: See TracBrowser for help on using the repository browser.