HOPS
HOPS class reference
MHO_DiFXChannelNameConstructor.hh
Go to the documentation of this file.
1 #ifndef MHO_DiFXChannelNameConstructor_HH__
2 #define MHO_DiFXChannelNameConstructor_HH__
3 
4 #include <map>
5 #include <sstream>
6 #include <string>
7 #include <tuple>
8 #include <vector>
9 
10 #include "MHO_JSONHeaderWrapper.hh"
11 #include "MHO_Message.hh"
12 #include "MHO_SkyFreqGrid.hh"
13 
14 namespace hops
15 {
16 
30 {
31  public:
34 
42  void AddBandLabel(std::string band_label, double freq_low, double freq_high);
43 
49  void AddChannelNames(mho_json& vex_root);
50 
61  void SetGlobalSkyFreqGrid(const std::vector< double >& grid_MHz, double tol = MHO_SkyFreqGrid::DEFAULT_TOL_MHZ)
62  {
63  fGlobalGrid = MHO_SkyFreqGrid(grid_MHz, tol);
64  fHasGlobalGrid = true;
65  }
66 
75  void SetScanName(std::string scan_id) { fScanID = scan_id; }
76 
77  private:
84  std::string BandLabelFromSkyFreq(double sky_freq);
85 
86  std::vector< std::tuple< std::string, double, double > > fBandRangeLabels; //(label, freq_low, freq_high)
87  std::string fScanID;
88 
89  //scan-wide canonical grid (set by SetGlobalSkyFreqGrid); used by AddChannelNames
90  //when fHasGlobalGrid is true. When a per-station table has no chan_def on the
91  //global grid we temporarily swap in a per-table grid (see AddChannelNames).
92  MHO_SkyFreqGrid fGlobalGrid;
93  bool fHasGlobalGrid; //true if SetGlobalSkyFreqGrid has been called for this scan
94 };
95 
96 } // namespace hops
97 
98 #endif
nlohmann::json mho_json
Definition: MHO_JSONHeaderWrapper.hh:5
Class MHO_DiFXChannelNameConstructor.
Definition: MHO_DiFXChannelNameConstructor.hh:30
void AddChannelNames(mho_json &vex_root)
Adds channel names to VEX experiment data based on scan and mode information.
Definition: MHO_DiFXChannelNameConstructor.cc:25
void SetGlobalSkyFreqGrid(const std::vector< double > &grid_MHz, double tol=MHO_SkyFreqGrid::DEFAULT_TOL_MHZ)
Provide a precomputed global sky-frequency grid (MHz, sorted ascending, deduped). When set,...
Definition: MHO_DiFXChannelNameConstructor.hh:61
void AddBandLabel(std::string band_label, double freq_low, double freq_high)
Adds a frequency range for a specific band label.
Definition: MHO_DiFXChannelNameConstructor.cc:20
void SetScanName(std::string scan_id)
Setter for scan name if the (o)vex file has more than one scan, we may want to specify a specific one...
Definition: MHO_DiFXChannelNameConstructor.hh:75
virtual ~MHO_DiFXChannelNameConstructor()
Definition: MHO_DiFXChannelNameConstructor.cc:17
MHO_DiFXChannelNameConstructor()
Definition: MHO_DiFXChannelNameConstructor.cc:11
Creates a sorted, tolerance-deduplicated list of sky frequencies (MHz) with indexed lookup....
Definition: MHO_SkyFreqGrid.hh:23
static constexpr double DEFAULT_TOL_MHZ
Definition: MHO_SkyFreqGrid.hh:25
Definition: MHO_AdhocFlagging.hh:18