HOPS
HOPS class reference
MHO_DelayRate.hh
Go to the documentation of this file.
1 #ifndef MHO_DelayRate_HH__
2 #define MHO_DelayRate_HH__
3 
4 #include <cmath>
5 #include <complex>
6 
8 #include "MHO_TableContainer.hh"
9 
10 #include "MHO_BinaryOperator.hh"
13 
14 #ifdef HOPS_USE_FFTW3
16 #endif
17 
18 namespace hops
19 {
20 
47 class MHO_DelayRate: public MHO_BinaryOperator< visibility_type, weight_type, sbd_type >
48 {
49  public:
50  MHO_DelayRate();
51  virtual ~MHO_DelayRate();
52 
58  void SetReferenceFrequency(double ref_freq) { fRefFreq = ref_freq; };
59 
65  int GetDelayRateSearchSpaceSize() const { return fDRSPSize; }
66 
73  unsigned int CalculateSearchSpaceSize(unsigned int input_size);
74 
75  protected:
79 
89  virtual bool InitializeImpl(const XArgType1* in1, const XArgType2* in2, XArgType3* out) override;
99  virtual bool ExecuteImpl(const XArgType1* in1, const XArgType2* in2, XArgType3* out) override;
100 
101  private:
102  std::size_t fInDims[VIS_NDIM];
103 
104  //One resampling instruction: output rate bin k of channel c is the linear interpolation out:
105  //(1-frac)*spectrum[lo] + frac*spectrum[hi], the interp parameters are precomputed per (ch,dr) so the hot loop
106  //carries no fmod or index arithmetic.
107  struct InterpEntry
108  {
109  int lo, hi;
110  double frac;
111  };
112 
119  void ApplyDataWeights(const XArgType2* in2, XArgType3* out);
127  void ConditionallyResizeOutput(const std::size_t* dims, std::size_t size, XArgType3* out);
128 
136  void BuildResamplingTable(const XArgType1* in1);
137 
149  void ApplyInterpolation(const XArgType1* in1, XArgType3* out);
150 
151 #ifdef HOPS_USE_FFTW3
153 #else
155 #endif
156 
158  FFT_ENGINE_TYPE fFFTEngine;
159 
160  int fDRSPSize;
161  double fRefFreq;
162 
163  bool fInitialized;
164 
165  //Resampling instructions, indexed [ch*fDRSPSize + dr]. The lo/hi indices already
166  //include the half-length shift that centres zero rate, so they address the raw
167  //post-FFT array directly and no separate fftshift pass is needed.
168  std::vector< InterpEntry > fInterpTable;
169 
170  //staging buffer for ApplyInterpolation: fDRSPSize rows x nsbd columns
171  std::vector< sbd_type::value_type > fInterpWorkspace;
172 };
173 
174 } // namespace hops
175 
176 #endif
#define VIS_NDIM
Definition: MHO_BaselineContainers.hh:43
An operator that takes two array types as input (XArgType1 and XArgType2) and writes to a single outp...
Definition: MHO_BinaryOperator.hh:22
Class MHO_DelayRate.
Definition: MHO_DelayRate.hh:48
sbd_type XArgType3
Definition: MHO_DelayRate.hh:78
weight_type XArgType2
Definition: MHO_DelayRate.hh:77
void SetReferenceFrequency(double ref_freq)
Setter for reference frequency.
Definition: MHO_DelayRate.hh:58
virtual ~MHO_DelayRate()
Definition: MHO_DelayRate.cc:21
MHO_DelayRate()
Definition: MHO_DelayRate.cc:16
virtual bool ExecuteImpl(const XArgType1 *in1, const XArgType2 *in2, XArgType3 *out) override
Executes MHO_DelayRate operations: zero padding, weighting, FFT, and resampling.
Definition: MHO_DelayRate.cc:81
virtual bool InitializeImpl(const XArgType1 *in1, const XArgType2 *in2, XArgType3 *out) override
Initializes MHO_DelayRate with input data and prepares for delay rate calculation.
Definition: MHO_DelayRate.cc:23
unsigned int CalculateSearchSpaceSize(unsigned int input_size)
Calculates the search space size based on input size.
Definition: MHO_DelayRate.cc:170
visibility_type XArgType1
Definition: MHO_DelayRate.hh:76
int GetDelayRateSearchSpaceSize() const
Getter for delay rate search space size.
Definition: MHO_DelayRate.hh:65
Class MHO_EndZeroPadderOptimized.
Definition: MHO_EndZeroPadderOptimized.hh:29
Class MHO_MultidimensionalFastFourierTransformFFTW.
Definition: MHO_MultidimensionalFastFourierTransformFFTW.hh:37
Definition: MHO_AdhocFlagging.hh:18
visibility_type sbd_type
Definition: MHO_BaselineContainers.hh:54
MHO_TableContainer< weight_element_type, baseline_axis_pack > weight_type
Definition: MHO_BaselineContainers.hh:53
MHO_TableContainer< visibility_element_type, baseline_axis_pack > visibility_type
Definition: MHO_BaselineContainers.hh:52