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 and every baseline target
61  //(output) freq built from zoom bands. Use this to set the visibility processor's zoom
62  //selection so native records are discarded.
63  std::set< int > CollectZoomFreqIndices() const;
64 
65  //rewrite vex_root["$FREQ"], $BBC, $IF and the station links under $MODE[mode_name]
66  //for every station whose datastream uses zoom bands.
67  void RebuildFreqSections(mho_json& vex_root, const std::string& mode_name);
68 
69  private:
70  std::set< int > CollectZoomTargetFreqIndices() const;
71 
72  std::map< int, std::vector< std::string > > CollectDatastreamTargetPols(int ds_idx,
73  const std::set< int >& targets) const;
74 
75  std::map< int, std::vector< std::string > > CollectDatastreamZoomPols(const mho_json& ds) const;
76 
77  const mho_json* fInput;
78 
79  bool fSelectByBandwidth;
80  double fOnlyBandwidth;
81 
82  std::vector< std::tuple< std::string, double, double > > fFreqBands;
83  std::map< std::string, std::string > fDiFX2VexStationCodes;
84 };
85 
86 } // namespace hops
87 
88 #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:17
std::set< int > CollectZoomFreqIndices() const
Definition: MHO_DiFXZoomBandRebuilder.cc:63
void SetDiFX2VexStationCodes(const std::map< std::string, std::string > &m)
Definition: MHO_DiFXZoomBandRebuilder.hh:51
bool WantZoomChannels() const
Definition: MHO_DiFXZoomBandRebuilder.cc:33
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:203
void ClearSelectionByBandwidth()
Definition: MHO_DiFXZoomBandRebuilder.hh:45
Definition: difx2mark4.h:111
Definition: MHO_AdhocFlagging.hh:18