HOPS
HOPS class reference
MHO_StationModel.hh
Go to the documentation of this file.
1 #ifndef MHO_StationModel_HH__
2 #define MHO_StationModel_HH__
3 
5 #include "MHO_TableContainer.hh"
6 
7 namespace hops
8 {
9 
22 {
23  public:
25  virtual ~MHO_StationModel();
26 
32  void SetEvaluationTimeVexString(std::string time_string) { fEvalTimeString = time_string; };
33 
39  void SetStationData(station_coord_type* ref_data) { fData = ref_data; };
40 
44  void ComputeModel();
45 
51  double GetDelay() { return fDelay; }
52 
58  double GetAzimuth() { return fAzimuth; }
59 
65  double GetElevation() { return fElevation; };
66 
72  double GetParallacticAngle() { return fParAngle; };
73 
79  double GetUCoordinate() { return fU; };
80 
86  double GetVCoordinate() { return fV; };
87 
93  double GetWCoordinate() { return fW; };
94 
95  private:
96  //evalute the coordinate model (az, el, u, v, etc) from the spline coefficients
97  //only does this a single coordinate at a time!
98  //XCoeffVectorType is expected to be an MHO_NDArrayView type
107  template< typename XCoeffVectorType >
108  void EvaluateSpline(const XCoeffVectorType& coeff, double delta_t, double& results);
109 
110  //clamp selected interval between [0, n_intervals-1]
119  void CheckSplineInterval(int n_intervals, double tdiff, int& int_no, std::string station_id);
120 
128  template< typename XTagType > XTagType RetrieveTag(station_coord_type* data, std::string key);
129 
130  //necessary data
131  std::string fEvalTimeString;
132  station_coord_type* fData;
133 
134  double fDelay;
135  double fAzimuth;
136  double fElevation;
137  double fParAngle;
138  double fU;
139  double fV;
140  double fW;
141 };
142 
151 template< typename XCoeffVectorType >
152 void MHO_StationModel::EvaluateSpline(const XCoeffVectorType& coeff, double delta_t, double& result)
153 {
154  //evaluates the spline at the given time delta_t,
155  //does this a single coordinate at a time
156  result = 0.0;
157  int n_coeff = coeff.GetSize();
158  double tp, c;
159  for(int p = 0; p < n_coeff; p++)
160  {
161  c = coeff(p);
162  tp = std::pow(delta_t, p);
163  result += c * tp;
164  }
165 }
166 
174 template< typename XTagType > XTagType MHO_StationModel::RetrieveTag(station_coord_type* data, std::string key)
175 {
176  //get the ref/rem station codes
177  XTagType value;
178  bool ok = data->Retrieve(key, value);
179  if(!ok)
180  {
181  msg_fatal("calibration", "data tag with key: " << key << " is missing from station data." << eom);
182  std::exit(1);
183  }
184  return value;
185 }
186 
187 } // namespace hops
188 
189 #endif
#define msg_fatal(xKEY, xCONTENT)
Definition: MHO_Message.hh:234
std::size_t GetSize() const
get the total size of the array
Definition: MHO_NDArrayWrapper.hh:119
Class MHO_StationModel.
Definition: MHO_StationModel.hh:22
double GetUCoordinate()
Getter for u coordinate.
Definition: MHO_StationModel.hh:79
double GetWCoordinate()
Getter for w coordinate.
Definition: MHO_StationModel.hh:93
double GetParallacticAngle()
Getter for parallactic angle.
Definition: MHO_StationModel.hh:72
double GetVCoordinate()
Getter for v coordinate.
Definition: MHO_StationModel.hh:86
double GetDelay()
Getter for delay.
Definition: MHO_StationModel.hh:51
MHO_StationModel()
Definition: MHO_StationModel.cc:15
void ComputeModel()
Calculates station model parameters such as delay, azimuth, elevation, etc.
Definition: MHO_StationModel.cc:30
virtual ~MHO_StationModel()
Definition: MHO_StationModel.cc:28
double GetAzimuth()
Getter for azimuth.
Definition: MHO_StationModel.hh:58
double GetElevation()
Getter for elevation.
Definition: MHO_StationModel.hh:65
void SetStationData(station_coord_type *ref_data)
Setter for station data.
Definition: MHO_StationModel.hh:39
void SetEvaluationTimeVexString(std::string time_string)
Setter for (model) evaluation time vex string.
Definition: MHO_StationModel.hh:32
Class MHO_TableContainer.
Definition: MHO_TableContainer.hh:36
Definition: MHO_ChannelLabeler.hh:17
MHO_TableContainer< spline_coeff_type, station_coord_axis_pack > station_coord_type
Definition: MHO_StationContainers.hh:26
Definition: vex.h:175