HOPS
HOPS class reference
MHO_ManualChannelPhaseCorrection.hh
Go to the documentation of this file.
1 #ifndef MHO_ManualChannelPhaseCorrection_HH__
2 #define MHO_ManualChannelPhaseCorrection_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_ManualChannelPhaseCorrection: public MHO_UnaryOperator< visibility_type >
32 {
33  public:
36 
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 
58  //channel label -> pc_phases
64  void SetChannelToPCPhaseMap(const std::map< std::string, double >& map) { fPCMap = map; };
65 
66  protected:
74  virtual bool InitializeInPlace(visibility_type* in) override;
83  virtual bool InitializeOutOfPlace(const visibility_type* in, visibility_type* out) override;
84 
92  virtual bool ExecuteInPlace(visibility_type* in) override;
101  virtual bool ExecuteOutOfPlace(const visibility_type* in, visibility_type* out) override;
102 
103  private:
111  bool IsApplicable(std::size_t st_idx, const visibility_type* in);
119  bool PolMatch(std::size_t station_idx, std::string& polprod);
127  bool LabelMatch(std::string expected_chan_label, std::string given_chan_label);
128 
129  //constants
130  std::complex< double > fImagUnit;
131  double fDegToRad;
132 
133  //selection
134  std::string fStationIdentity;
135  std::string fPol;
136 
137  //channel label -> pcal phases
138  std::map< std::string, double > fPCMap;
139 
140  //keys for tag retrieval and matching
141  std::string fStationKey;
142  std::string fRemStationKey;
143  std::string fRefStationKey;
144  std::string fRemStationMk4IDKey;
145  std::string fRefStationMk4IDKey;
146  std::string fChannelLabelKey;
147  std::string fSidebandLabelKey;
148  std::string fLowerSideband;
149  std::string fUpperSideband;
150 
151  //minor helper function to make sure all strings are compared as upper-case only
152  void make_upper(std::string& s)
153  {
154  for(char& c : s)
155  {
156  c = toupper(c);
157  };
158  }
159 };
160 
161 } // namespace hops
162 
163 #endif
Class MHO_ManualChannelPhaseCorrection.
Definition: MHO_ManualChannelPhaseCorrection.hh:32
MHO_ManualChannelPhaseCorrection()
Definition: MHO_ManualChannelPhaseCorrection.cc:6
virtual bool ExecuteOutOfPlace(const visibility_type *in, visibility_type *out) override
Copies input visibility data and executes in-place correction.
Definition: MHO_ManualChannelPhaseCorrection.cc:98
virtual bool InitializeInPlace(visibility_type *in) override
Initializes in-place visibility_type pointer.
Definition: MHO_ManualChannelPhaseCorrection.cc:195
virtual bool InitializeOutOfPlace(const visibility_type *in, visibility_type *out) override
Initializes out-of-place data from input visibility_type pointer.
Definition: MHO_ManualChannelPhaseCorrection.cc:200
void SetPolarization(const std::string &pol)
Setter for polarization.
Definition: MHO_ManualChannelPhaseCorrection.hh:52
void SetStationIdentifier(std::string station_id)
Setter for station identifier.
Definition: MHO_ManualChannelPhaseCorrection.hh:45
void SetChannelToPCPhaseMap(const std::map< std::string, double > &map)
Setter for channel to pc_phase map.
Definition: MHO_ManualChannelPhaseCorrection.hh:64
virtual bool ExecuteInPlace(visibility_type *in) override
Applies phase correction to visibility data in-place for reference or remote station.
Definition: MHO_ManualChannelPhaseCorrection.cc:25
virtual ~MHO_ManualChannelPhaseCorrection()
Definition: MHO_ManualChannelPhaseCorrection.cc:23
Class MHO_UnaryOperator.
Definition: MHO_UnaryOperator.hh:24
Definition: MHO_ChannelLabeler.hh:17