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(const std::string& id) { fStationIdentities = {id}; }
46 
47  void SetStationIdentifiers(const std::vector< std::string >& ids) { fStationIdentities = ids; }
48 
49  std::string GetStationIdentifier() const
50  {
51  return fStationIdentities.empty() ? std::string("") : fStationIdentities[0];
52  }
53 
59  void SetPolarization(const std::string& pol)
60  {
61  fPol = pol;
62  make_upper(fPol);
63  };
64 
65  //channel label -> pc_phases
71  void SetChannelToPCPhaseMap(const std::map< std::string, double >& map) { fPCMap = map; };
72 
73  protected:
81  virtual bool ExecuteInPlace(visibility_type* in) override;
82 
83  private:
91  bool IsApplicable(std::size_t st_idx, const visibility_type* in);
99  bool PolMatch(std::size_t station_idx, std::string& polprod);
107  bool LabelMatch(std::string expected_chan_label, std::string given_chan_label);
108 
109  //constants
110  std::complex< double > fImagUnit;
111  double fDegToRad;
112 
113  //selection
114  std::vector< std::string > fStationIdentities;
115  std::string fPol;
116 
117  //channel label -> pcal phases
118  std::map< std::string, double > fPCMap;
119 
120  //keys for tag retrieval and matching
121  std::string fStationKey;
122  std::string fRemStationKey;
123  std::string fRefStationKey;
124  std::string fRemStationMk4IDKey;
125  std::string fRefStationMk4IDKey;
126  std::string fChannelLabelKey;
127  std::string fSidebandLabelKey;
128  std::string fLowerSideband;
129  std::string fUpperSideband;
130 
131  //minor helper function to make sure all strings are compared as upper-case only
132  void make_upper(std::string& s)
133  {
134  for(char& c : s)
135  {
136  c = toupper(c);
137  };
138  }
139 };
140 
141 } // namespace hops
142 
143 #endif
Class MHO_ManualChannelPhaseCorrection.
Definition: MHO_ManualChannelPhaseCorrection.hh:32
MHO_ManualChannelPhaseCorrection()
Definition: MHO_ManualChannelPhaseCorrection.cc:6
void SetStationIdentifiers(const std::vector< std::string > &ids)
Definition: MHO_ManualChannelPhaseCorrection.hh:47
void SetStationIdentifier(const std::string &id)
Setter for station identifier.
Definition: MHO_ManualChannelPhaseCorrection.hh:45
void SetPolarization(const std::string &pol)
Setter for polarization.
Definition: MHO_ManualChannelPhaseCorrection.hh:59
void SetChannelToPCPhaseMap(const std::map< std::string, double > &map)
Setter for channel to pc_phase map.
Definition: MHO_ManualChannelPhaseCorrection.hh:71
virtual bool ExecuteInPlace(visibility_type *in) override
Applies phase correction to visibility data in-place for reference or remote station.
Definition: MHO_ManualChannelPhaseCorrection.cc:24
virtual ~MHO_ManualChannelPhaseCorrection()
Definition: MHO_ManualChannelPhaseCorrection.cc:22
std::string GetStationIdentifier() const
Definition: MHO_ManualChannelPhaseCorrection.hh:49
Class MHO_UnaryOperator.
Definition: MHO_UnaryOperator.hh:24
Definition: MHO_AdhocFlagging.hh:18