HOPS
HOPS class reference
MHO_ManualChannelDelayCorrection.hh
Go to the documentation of this file.
1 #ifndef MHO_ManualChannelDelayCorrection_HH__
2 #define MHO_ManualChannelDelayCorrection_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_ManualChannelDelayCorrection: 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 
70  void SetChannelToPCDelayMap(const std::map< std::string, double >& map) { fPCDelayMap = map; };
71 
72  protected:
80  virtual bool ExecuteInPlace(visibility_type* in) override;
81 
82  private:
90  bool IsApplicable(std::size_t st_idx, const visibility_type* in);
98  bool PolMatch(std::size_t station_idx, std::string& polprod);
106  bool LabelMatch(std::string expected_chan_label, std::string given_chan_label);
107 
108  //constants
109  std::complex< double > fImagUnit;
110  double fDegToRad;
111  double fNanoSecToSecond;
112  double fMHzToHz;
113  double fPi;
114 
115  //selection
116  std::vector< std::string > fStationIdentities;
117  std::string fPol;
118 
119  //channel label -> pc delay
120  std::map< std::string, double > fPCDelayMap;
121 
122  //keys for tag retrieval
123  std::string fStationKey;
124  std::string fRemStationKey;
125  std::string fRefStationKey;
126  std::string fRemStationMk4IDKey;
127  std::string fRefStationMk4IDKey;
128  std::string fChannelLabelKey;
129  std::string fBandwidthKey;
130 
131  std::string fSidebandLabelKey;
132  std::string fLowerSideband;
133  std::string fUpperSideband;
134 
135  //minor helper function to make sure all strings are compared as upper-case only
136  void make_upper(std::string& s)
137  {
138  for(char& c : s)
139  {
140  c = toupper(c);
141  };
142  }
143 };
144 
145 } // namespace hops
146 
147 #endif
Class MHO_ManualChannelDelayCorrection.
Definition: MHO_ManualChannelDelayCorrection.hh:32
void SetStationIdentifier(const std::string &id)
Setter for station identifier.
Definition: MHO_ManualChannelDelayCorrection.hh:45
void SetChannelToPCDelayMap(const std::map< std::string, double > &map)
Setter for channel to pc_delay map.
Definition: MHO_ManualChannelDelayCorrection.hh:70
virtual bool ExecuteInPlace(visibility_type *in) override
Applies manual channel delay corrections in-place for reference or remote station.
Definition: MHO_ManualChannelDelayCorrection.cc:29
MHO_ManualChannelDelayCorrection()
Definition: MHO_ManualChannelDelayCorrection.cc:6
void SetStationIdentifiers(const std::vector< std::string > &ids)
Definition: MHO_ManualChannelDelayCorrection.hh:47
std::string GetStationIdentifier() const
Definition: MHO_ManualChannelDelayCorrection.hh:49
virtual ~MHO_ManualChannelDelayCorrection()
Definition: MHO_ManualChannelDelayCorrection.cc:27
void SetPolarization(const std::string &pol)
Setter for polarization (associated with these delay corrections)
Definition: MHO_ManualChannelDelayCorrection.hh:59
Class MHO_UnaryOperator.
Definition: MHO_UnaryOperator.hh:24
Definition: MHO_AdhocFlagging.hh:18