HOPS
HOPS class reference
MHO_DiFXVisibilityProcessor.hh
Go to the documentation of this file.
1 #ifndef MHO_DiFXVisibilityProcessor_HH__
2 #define MHO_DiFXVisibilityProcessor_HH__
3 
4 #include <fstream>
5 #include <map>
6 #include <set>
7 #include <string>
8 #include <tuple>
9 #include <utility>
10 #include <vector>
11 
14 #include "MHO_Message.hh"
15 
16 namespace hops
17 {
18 
33 {
34  public:
37 
43  void SetFilename(std::string filename) { fFilename = filename.c_str(); }
44 
45  //needed for processing!
51  void SetDiFXInputData(const mho_json* input) { fInput = input; }
52 
59  void ReadDIFXFile(std::map< int, MHO_DiFXBaselineProcessor >& allBaselineVisibilities);
60 
66  void SetFrequencyBands(std::vector< std::tuple< std::string, double, double > > fbands) { fFreqBands = fbands; }
67 
73  void SetFreqGroups(std::vector< std::string > fgroups) { fOnlyFreqGroups = fgroups; }
74 
80  void SetOnlyBandwidth(double bw)
81  {
82  fOnlyBandwidth = bw;
83  fSelectByBandwidth = true;
84  }
85 
86  void SetZoomFreqIndices(const std::set< int >& zoom_indices) { fZoomFreqIndices = zoom_indices; }
87 
88  //use .flags file
89  void SetApplyFlags(bool val) { fApplyFlags = val; }
90 
91  private:
92  //number of spectral points per record for this freq (nChan/specAvg)
93  int ExpectedNChannels(int freqindex) const;
94 
95  //report truncated record
96  void WarnOnTruncatedRecord(const MHO_DiFXVisibilityRecord& visRecord, std::size_t npoints) const;
97 
98  //needs (mjd1, mjd2, antennaId) flags
99  void LoadFlags();
100  //true if the record time falls in a flag interval of either antenna
101  bool IsRecordFlagged(const MHO_DiFXVisibilityRecord& visRecord) const;
102 
103  const mho_json* fInput;
104 
105  std::string fFilename;
106  //maps the pair(baseline,freqindex) to the number of channels (# of spectral points)
107  std::map< std::pair< int, int >, int > fNChannelsMap;
108 
109  std::vector< std::tuple< std::string, double, double > >
110  fFreqBands; //frequency band/group labels and ranges (code, flow, fhigh)
111  std::vector< std::string > fOnlyFreqGroups; //limit output to matching frequency groups
112  bool fSelectByBandwidth;
113  double fOnlyBandwidth; //limit output to only channels of this bandwidth
114  std::set< int > fZoomFreqIndices; //when non-empty, discard records not in this set (keeps root/vis consistent)
115  bool fApplyFlags;
116  std::vector< std::tuple< double, double, int > > fFlags; //(mjd1, mjd2, antennaId)
117 };
118 
119 } // namespace hops
120 
121 #endif
nlohmann::json mho_json
Definition: MHO_JSONHeaderWrapper.hh:5
Class MHO_DiFXVisibilityProcessor.
Definition: MHO_DiFXVisibilityProcessor.hh:33
void ReadDIFXFile(std::map< int, MHO_DiFXBaselineProcessor > &allBaselineVisibilities)
read the visibilities from Swinburne file and allocate memory to store them as we go memory managemen...
Definition: MHO_DiFXVisibilityProcessor.cc:22
void SetFreqGroups(std::vector< std::string > fgroups)
Setter for (allowed) freq groups/bands.
Definition: MHO_DiFXVisibilityProcessor.hh:73
void SetFrequencyBands(std::vector< std::tuple< std::string, double, double > > fbands)
Setter for frequency bands (label, limits)
Definition: MHO_DiFXVisibilityProcessor.hh:66
virtual ~MHO_DiFXVisibilityProcessor()
Definition: MHO_DiFXVisibilityProcessor.hh:36
void SetOnlyBandwidth(double bw)
Setter for allow channel bandwidth (only channels with this bandwidth will be kept)
Definition: MHO_DiFXVisibilityProcessor.hh:80
void SetDiFXInputData(const mho_json *input)
Setter for difx .input data.
Definition: MHO_DiFXVisibilityProcessor.hh:51
MHO_DiFXVisibilityProcessor()
Definition: MHO_DiFXVisibilityProcessor.cc:10
void SetZoomFreqIndices(const std::set< int > &zoom_indices)
Definition: MHO_DiFXVisibilityProcessor.hh:86
void SetFilename(std::string filename)
Setter for filename.
Definition: MHO_DiFXVisibilityProcessor.hh:43
void SetApplyFlags(bool val)
Definition: MHO_DiFXVisibilityProcessor.hh:89
Class MHO_DiFXVisibilityRecord.
Definition: MHO_DiFXVisibilityRecord.hh:24
Definition: difx2mark4.h:111
Definition: MHO_AdhocFlagging.hh:18