CARMA C++
DecimatorStage.h
1 // $Id: DecimatorStage.h,v 1.5 2013/05/15 15:23:00 abeard Exp $
2 
3 #ifndef CARMA_PIPELINE_DECIMATORSTAGE_H
4 #define CARMA_PIPELINE_DECIMATORSTAGE_H
5 
6 #include "carma/monitor/PipelineCommon.h"
7 #include "carma/pipeline/Stage.h"
8 #include "carma/pipeline/pipelineUtils.h"
10 
11 #include <pthread.h>
12 #include <set>
13 
14 namespace carma {
15 
16 namespace monitor {
17  class PipelineSubsystem;
18  class PipelineMonitorInput;
19 } // namespace monitor
20 
21 namespace correlator {
22 namespace lib {
23  class CorrelatorBand;
24  class CorrelatorBaseline;
25  class CorrelatorSideband;
26  class CorrelatorData;
27 } // namespace lib
28 } // namespace correlator
29 
30 namespace pipeline {
31 
32  class Decimator : public Stage {
33  public:
34 
40  Decimator( carma::monitor::PipelineSubsystem & monitor,
41  const carma::monitor::PipelineMonitorInput & plmi,
42  carma::pipeline::PipelineType pipelineType );
43 
47  virtual ~Decimator( );
48 
52  void keepEndChannels( bool keep );
53 
58  void keepEndChannels( bool keep, int astroBandNo );
59 
64  void decimation( bool on );
65 
71  void decimation( bool on, int astroBandNo );
72 
77  static ::std::set< carma::util::FftwRealVector::size_type >
78  defaultFftwPlanSizes( );
79 
80  private:
81 
82  void
83  preprocess(const carma::correlator::lib::CorrelatorDataPtr cd);
84 
85  void
86  processBand( carma::correlator::lib::CorrelatorBand * cb );
87 
88  carma::correlator::lib::CorrelatorDataPtr
89  postprocess( carma::correlator::lib::CorrelatorDataPtr cd );
90 
91  void fillMonitorData( );
92 
93  void resetDecimationBandInfo( );
94 
95  struct DecimationBandInfo {
96  DecimationBandInfo();
97  int expectedChans;
98  int outputChans;
99  int numLags;
100  float outBandwidth;
101  float outDeltaFreq;
102  bool keepEndChannels;
103  bool decimate;
104  carma::monitor::Decimation::
105  DecimateMonitorPointEnum::DECIMATE decimateType;
106  carma::monitor::Decimation::
107  WindowMonitorPointEnum::WINDOW windowType;
109  ::pthread_mutex_t mutex;
110  };
111 
112  void calculateNewFrequencyParams(
113  float inBandwidth,
114  DecimationBandInfo & decBand );
115 
116  bool
117  inferInputChannelCount(
119  DecimationBandInfo & decBand );
120 
121  void
122  processBaseline(
124  DecimationBandInfo & decBand );
125 
126  void
127  processSideband(
129  DecimationBandInfo & decBand );
130 
131  void
132  updateAdditionalSidebandParameters(
134  const DecimationBandInfo & decBand );
135 
136  void
137  cacheHannFactorsIfNotAlready( int numLags );
138 
139  typedef unsigned short astroBandNo;
140  typedef ::std::map< astroBandNo,
141  DecimationBandInfo> DecimationInfoMap;
142 
143  DecimationInfoMap decimationInfo_;
144 
145  carma::monitor::PipelineSubsystem & monitorData_;
146 
147  const carma::pipeline::PipelineType plType_;
148  const carma::monitor::PipelineMonitorInput & plmi_;
149 
150  // Keyed by number of lags. Invariant: first == vector.size().
151  typedef std::map< int, std::vector< double > > HannFactorsMap;
152  HannFactorsMap hannFactors_;
153 
154  }; // End class Decimator
155 
156 } // End namespace pipeline
157 } // End namespace carma
158 #endif // End #ifndef CARMA_PIPELINE_DECIMATORSTAGE_H
Class to hold a Band of Correlator Data.
Tagged: Wed Jun 29 11:00:27 PDT 2005.
Facilitate the creation, storage and retrieval of FftwRealToRealPlans.
Class to hold Correlator Baseline data.
Abstract base class for retrieving pipeline monitor system components common between the spectral lin...
Declaration of FftwRealToRealPlanManager class.
Base class for Correlator Sideband data.