HOPS
HOPS class reference
MHO_ManualPolPhaseCorrection.hh
Go to the documentation of this file.
1 #ifndef MHO_ManualPolPhaseCorrection_HH__
2 #define MHO_ManualPolPhaseCorrection_HH__
3 
4 #include <cctype>
5 #include <cmath>
6 #include <complex>
7 #include <map>
8 #include <vector>
9 
10 #include "MHO_Constants.hh"
11 #include "MHO_Message.hh"
12 
14 #include "MHO_TableContainer.hh"
15 #include "MHO_UnaryOperator.hh"
16 
17 namespace hops
18 {
19 
31 class MHO_ManualPolPhaseCorrection: public MHO_UnaryOperator< visibility_type >
32 {
33  public:
36 
37  //treated as follows:
38  //1-char => mk4 id
39  //2-char => 2char station code
45  void SetStationIdentifier(std::string station_id) { fStationIdentity = station_id; }
46 
52  void SetPolarization(const std::string& pol)
53  {
54  fPol = pol;
55  make_upper(fPol);
56  };
57 
63  void SetPCPhaseOffset(const double& pc_phase_offset) { fPhaseOffset = pc_phase_offset; }
64 
65  protected:
73  virtual bool InitializeInPlace(visibility_type* in) override;
82  virtual bool InitializeOutOfPlace(const visibility_type* in, visibility_type* out) override;
83 
91  virtual bool ExecuteInPlace(visibility_type* in) override;
100  virtual bool ExecuteOutOfPlace(const visibility_type* in, visibility_type* out) override;
101 
102  private:
110  bool IsApplicable(std::size_t st_idx, const visibility_type* in);
118  bool PolMatch(std::size_t station_idx, std::string& polprod);
119 
120  //constants
121  std::complex< double > fImagUnit;
122  double fDegToRad;
123 
124  //selection
125  std::string fStationIdentity;
126  std::string fPol;
127 
128  //pc rotation
129  double fPhaseOffset;
130 
131  //keys for tag retrieval
132  std::string fStationKey;
133  std::string fRemStationKey;
134  std::string fRefStationKey;
135  std::string fRemStationMk4IDKey;
136  std::string fRefStationMk4IDKey;
137  std::string fChannelLabelKey;
138 
139  std::string fSidebandLabelKey;
140  std::string fLowerSideband;
141  std::string fUpperSideband;
142 
143  //minor helper function to make sure all strings are compared as upper-case only
144  void make_upper(std::string& s)
145  {
146  for(char& c : s)
147  {
148  c = toupper(c);
149  };
150  }
151 };
152 
153 } // namespace hops
154 
155 #endif
Class MHO_ManualPolPhaseCorrection.
Definition: MHO_ManualPolPhaseCorrection.hh:32
void SetStationIdentifier(std::string station_id)
Setter for station identifier.
Definition: MHO_ManualPolPhaseCorrection.hh:45
virtual bool ExecuteOutOfPlace(const visibility_type *in, visibility_type *out) override
Copies input visibility data and executes in-place correction.
Definition: MHO_ManualPolPhaseCorrection.cc:94
virtual bool ExecuteInPlace(visibility_type *in) override
Applies manual phase correction offsets to visibility data in-place for reference or remote stations.
Definition: MHO_ManualPolPhaseCorrection.cc:28
void SetPCPhaseOffset(const double &pc_phase_offset)
Setter for pc_phase offset.
Definition: MHO_ManualPolPhaseCorrection.hh:63
void SetPolarization(const std::string &pol)
Setter for associated polarization.
Definition: MHO_ManualPolPhaseCorrection.hh:52
MHO_ManualPolPhaseCorrection()
Definition: MHO_ManualPolPhaseCorrection.cc:6
virtual ~MHO_ManualPolPhaseCorrection()
Definition: MHO_ManualPolPhaseCorrection.cc:26
virtual bool InitializeInPlace(visibility_type *in) override
Initializes in-place visibility_type pointer.
Definition: MHO_ManualPolPhaseCorrection.cc:151
virtual bool InitializeOutOfPlace(const visibility_type *in, visibility_type *out) override
Initializes out-of-place visibility data from input pointer.
Definition: MHO_ManualPolPhaseCorrection.cc:156
Class MHO_UnaryOperator.
Definition: MHO_UnaryOperator.hh:24
Definition: MHO_ChannelLabeler.hh:17