HOPS
HOPS class reference
MHO_DiFXZoomBandRebuilder.hh
Go to the documentation of this file.
1 #ifndef MHO_DiFXZoomBandRebuilder_HH__
2 #define MHO_DiFXZoomBandRebuilder_HH__
3 
4 #include <map>
5 #include <set>
6 #include <string>
7 #include <tuple>
8 #include <vector>
9 
10 #include "MHO_JSONHeaderWrapper.hh"
11 
12 namespace hops
13 {
14 
33 {
34  public:
35  MHO_DiFXZoomBandRebuilder(): fInput(nullptr), fSelectByBandwidth(false), fOnlyBandwidth(0.0) {}
36 
37  void SetDiFXInputData(const mho_json* input) { fInput = input; }
38 
39  void SetSelectionByBandwidth(double bw)
40  {
41  fSelectByBandwidth = true;
42  fOnlyBandwidth = bw;
43  }
44 
45  void ClearSelectionByBandwidth() { fSelectByBandwidth = false; }
46 
47  //frequency-band labels (e.g. {"X", 8000, 9000}); used as chan_def.band_id link values
48  void SetFrequencyBands(const std::vector< std::tuple< std::string, double, double > >& fbands) { fFreqBands = fbands; }
49 
50  //DiFX uppercase 2-char station code -> VEX (mixed-case) 2-char station code
51  void SetDiFX2VexStationCodes(const std::map< std::string, std::string >& m) { fDiFX2VexStationCodes = m; }
52 
53  //true if any datastream has nZoomFreq > 0
54  bool HasZoomBands() const;
55 
56  //true if no bandwidth filter is active, or the active filter matches the zoom bandwidth.
57  //If false, the rebuild should be skipped (native channels will be used).
58  bool WantZoomChannels() const;
59 
60  //union of all global zoom-freq indices across every datastream. Use this to set the
61  //visibility processor's zoom selection so native records are discarded.
62  std::set< int > CollectZoomFreqIndices() const;
63 
64  //rewrite vex_root["$FREQ"], $BBC, $IF and the station links under $MODE[mode_name]
65  //for every station whose datastream uses zoom bands.
66  void RebuildFreqSections(mho_json& vex_root, const std::string& mode_name);
67 
68  private:
69  const mho_json* fInput;
70 
71  bool fSelectByBandwidth;
72  double fOnlyBandwidth;
73 
74  std::vector< std::tuple< std::string, double, double > > fFreqBands;
75  std::map< std::string, std::string > fDiFX2VexStationCodes;
76 };
77 
78 } // namespace hops
79 
80 #endif
nlohmann::json mho_json
Definition: MHO_JSONHeaderWrapper.hh:5
Creates new $FREQ/$BBC/$IF VEX sections for stations that DiFX correlated via zoom bands (zoomFreqId/...
Definition: MHO_DiFXZoomBandRebuilder.hh:33
bool HasZoomBands() const
Definition: MHO_DiFXZoomBandRebuilder.cc:13
std::set< int > CollectZoomFreqIndices() const
Definition: MHO_DiFXZoomBandRebuilder.cc:53
void SetDiFX2VexStationCodes(const std::map< std::string, std::string > &m)
Definition: MHO_DiFXZoomBandRebuilder.hh:51
bool WantZoomChannels() const
Definition: MHO_DiFXZoomBandRebuilder.cc:29
void SetSelectionByBandwidth(double bw)
Definition: MHO_DiFXZoomBandRebuilder.hh:39
MHO_DiFXZoomBandRebuilder()
Definition: MHO_DiFXZoomBandRebuilder.hh:35
void SetDiFXInputData(const mho_json *input)
Definition: MHO_DiFXZoomBandRebuilder.hh:37
void SetFrequencyBands(const std::vector< std::tuple< std::string, double, double > > &fbands)
Definition: MHO_DiFXZoomBandRebuilder.hh:48
void RebuildFreqSections(mho_json &vex_root, const std::string &mode_name)
Definition: MHO_DiFXZoomBandRebuilder.cc:71
void ClearSelectionByBandwidth()
Definition: MHO_DiFXZoomBandRebuilder.hh:45
Definition: difx2mark4.h:111
Definition: MHO_AdhocFlagging.hh:18