HOPS
HOPS class reference
MHO_DiFXPCalProcessor.hh
Go to the documentation of this file.
1 #ifndef MHO_DiFXPCalProcessor_HH__
2 #define MHO_DiFXPCalProcessor_HH__
3 
4 #include <complex>
5 #include <string>
6 #include <utility>
7 #include <vector>
8 
10 #include "MHO_Tokenizer.hh"
11 #include "MHO_DiFXTimeUtilities.hh"
12 
13 namespace hops
14 {
15 
28 {
29  public:
31  virtual ~MHO_DiFXPCalProcessor();
32 
38  void SetFilename(std::string filename);
39 
45  void SetAccumulationPeriod(double ap_sec) { fAPLength = ap_sec; }
46 
52  std::string GetStationCode() const { return fStationCode; }
53 
57  void ReadPCalFile();
58 
62  void Organize();
63 
69  multitone_pcal_type* GetPCalData() { return &fPCal; }
70 
71  private:
72 
78  bool IsComment();
79 
83  void TokenizeLine();
84 
88  void ProcessTokens();
89 
90  std::string fFilename;
91  std::string fLine;
92  MHO_Tokenizer fTokenizer;
93  std::vector< std::string > fTokens;
94  double fAPLength;
95  bool fValid;
96 
97  std::string fType;
98  std::string fMJD_day;
99  std::string fMJD_frac;
100  std::string fStationCode;
101 
102  //TODO this constant isn't used directly for conversion
103  //(just a tolerance check), but we should put this somewhere sensible
104  double fSecondsPerDay;
105  double fTolerance;
106 
107  //single pcal tone
108  struct pcal_phasor
109  {
110  double tone_freq;
112  };
113 
114  //container for pcal data from a single AP
115  struct pcal_period
116  {
117  std::string station;
118  double mjd;
119  double mjd_period;
120  int ap;
121  std::map< std::string, std::vector< pcal_phasor > > pc_phasors;
122  };
123 
124  //pcal data in various forms on the way to getting it organized
125  std::vector< pcal_period > fPCalData;
126  std::vector< pcal_period > fSortedPCalData;
127  std::set< std::string > fPolSet;
128 
129  //fully organized pcal data
130  multitone_pcal_type fPCal;
131 
132  //for sorting phasors by tone frequency
133  struct ToneFreqLess
134  {
135  bool operator()(const pcal_phasor& a, const pcal_phasor& b) const { return (a.tone_freq < b.tone_freq); }
136  };
137 
138  ToneFreqLess fPhasorToneComp;
139 
140  //for sorting APs by time
141  struct APIndexLess
142  {
143  bool operator()(const pcal_period& a, const pcal_period& b) const { return (a.ap < b.ap); }
144  };
145 
146  APIndexLess fAPIndexComp;
147 };
148 
149 } // namespace hops
150 
151 #endif
Class MHO_DiFXPCalProcessor.
Definition: MHO_DiFXPCalProcessor.hh:28
multitone_pcal_type * GetPCalData()
Getter for (organized) pcal data.
Definition: MHO_DiFXPCalProcessor.hh:69
MHO_DiFXPCalProcessor()
Definition: MHO_DiFXPCalProcessor.cc:14
void Organize()
Organizes p-cal data by merging tone/phasor data from the same time period and stores them in a table...
Definition: MHO_DiFXPCalProcessor.cc:153
void SetFilename(std::string filename)
Setter for (PCAL) filename.
Definition: MHO_DiFXPCalProcessor.cc:26
std::string GetStationCode() const
Getter for station code.
Definition: MHO_DiFXPCalProcessor.hh:52
void SetAccumulationPeriod(double ap_sec)
Setter for pcal accumulation period.
Definition: MHO_DiFXPCalProcessor.hh:45
void ReadPCalFile()
Reads and processes a PCal file.
Definition: MHO_DiFXPCalProcessor.cc:57
virtual ~MHO_DiFXPCalProcessor()
Definition: MHO_DiFXPCalProcessor.cc:23
Class MHO_Tokenizer.
Definition: MHO_Tokenizer.hh:24
Definition: MHO_ChannelLabeler.hh:17
MHO_TableContainer< pcal_phasor_type, multitone_pcal_axis_type > multitone_pcal_type
Definition: MHO_StationContainers.hh:30
std::complex< PCFP_TYPE > pcal_phasor_type
Definition: MHO_ElementTypes.hh:33
Definition: type_212.h:10