CARMA C++
AstroBandListener.h
Go to the documentation of this file.
1 // $Id: AstroBandListener.h,v 1.1 2012/08/14 22:03:11 eml Exp $
2 
3 #ifndef SZA_ANTENNA_CORBA_ASTROBANDLISTENER_H
4 #define SZA_ANTENNA_CORBA_ASTROBANDLISTENER_H
5 
16 #include "carma/correlator/lib/CorrelatorBand.h"
18 
20 
21 #include "carma/szautil/Complex.h"
22 
24 
25 namespace sza {
26  namespace antenna {
27  namespace corba {
28 
29  class AstroBandGather;
30 
31  class AstroBandListener : public sza::util::RunnableTask,
33  public:
34 
35  // Constructor.
36 
37  AstroBandListener(AstroBandGatherer* parent,
38  std::string imr,
39  unsigned astroBandNo,
40  sza::util::NetMonitorFrame* nmf,
41  unsigned nFrameAvg,
42  double coherenceLevelThreshold=0.0,
43  double coherenceMjdThreshold=0.0);
44 
45  // Destructor.
46 
47  virtual ~AstroBandListener();
48 
49  void initialize(AstroBandGatherer* parent,
50  std::string imr,
51  unsigned astroBandNo,
52  sza::util::NetMonitorFrame* nmf,
53  unsigned nFrameAvg,
54  double coherenceLevelThreshold=0.0,
55  double coherenceMjdThreshold=0.0);
56 
57  void processData(carma::correlator::lib::CorrelatorData * cd);
58 
59  void run();
60 
61  void setupRegisterPointers(sza::util::NetMonitorFrame* nmf);
62 
63  unsigned nCorrChan_;
64  unsigned nAnt_;
65  unsigned nBase_;
66 
67  void incrementBufferCounters();
68 
69  void clearCoherenceBuffers();
70 
71  void packCoherence(double mjd,
72  unsigned iBase,
73  unsigned antIndex1,
74  unsigned antIndex2,
75  std::vector<float>& coherence,
76  std::vector<sza::util::Complex<float>::Data>& avg,
77  std::vector<sza::util::Complex<float>::Data>& avgSum,
78  std::vector<std::vector<sza::util::Complex<float>::Data> >& avgSamples,
79  std::vector<double>& mjdLastCoherence,
80  std::vector<unsigned char>& isCoherent,
81  std::vector<float>& antCoherence,
82  std::vector<unsigned>& nBaseline,
83  bool printDebug=false);
84 
85  private:
86 
87  bool coherenceMonitor_;
88  std::vector<SzaMonitorSystemReg> regs_;
89  AstroBandGatherer* parent_;
90  std::string doName_;
91  std::string imr_;
92  unsigned astroBandNo_;
93  unsigned char rcvd_;
94 
95  // A map of antenna number <--> baseline indices for
96  // cross-correlations
97 
98  std::map<unsigned int, std::map<unsigned int, unsigned int> > crossBaselineIndex_;
99 
100  std::vector<float> usbAmplitude_;
101  std::vector<float> lsbAmplitude_;
102 
103  std::vector<float> usbAvgAmplitude_;
104  std::vector<float> lsbAvgAmplitude_;
105 
106  std::vector<float> lsbFrequencyGHz_;
107  std::vector<float> usbFrequencyGHz_;
108  std::vector<float> autoFrequencyGHz_;
109 
110  std::vector<sza::util::Complex<float>::Data> usbAvg_;
111  std::vector<sza::util::Complex<float>::Data> lsbAvg_;
112  std::vector<sza::util::Complex<float>::Data> usbVar_;
113  std::vector<sza::util::Complex<float>::Data> lsbVar_;
114 
115  std::vector<float> autoAvg_;
116  std::vector<float> autoVar_;
117  std::vector<float> auto_;
118 
119  std::vector<sza::util::Complex<float>::Data> usb_;
120  std::vector<sza::util::Complex<float>::Data> lsb_;
121 
122  // Used only for coherence monitor
123 
124  std::vector<float> usbCoherence_;
125  std::vector<float> lsbCoherence_;
126 
127  std::vector<float> usbAntCoherence_;
128  std::vector<float> lsbAntCoherence_;
129 
130  std::vector<unsigned> usbNBaseline_;
131  std::vector<unsigned> lsbNBaseline_;
132 
133  std::vector<sza::util::Complex<float>::Data> usbAvgSum_;
134  std::vector<sza::util::Complex<float>::Data> lsbAvgSum_;
135  std::vector<std::vector<sza::util::Complex<float>::Data > > usbAvgSamples_;
136  std::vector<std::vector<sza::util::Complex<float>::Data > > lsbAvgSamples_;
137  std::vector<double> usbMjdLastCoherence_;
138  std::vector<double> lsbMjdLastCoherence_;
139  std::vector<unsigned char> usbIsCoherent_;
140  std::vector<unsigned char> lsbIsCoherent_;
141  double coherenceLevelThreshold_;
142  double coherenceMjdThreshold_;
143  unsigned nSamp_;
144  unsigned nFrameAvg_;
145  int iNextSample_;
146  int iOldestSample_;
147  bool bufferFull_;
148 
149  void packSideband(double mjd, carma::correlator::lib::CorrelatorSideband& sideband, unsigned antNo1, unsigned antNo2);
150  void writeData(double mjd, std::string abName);
151 
152  }; // End class AstroBandListener
153 
154  } // End namespace corba
155  } // End namespace antenna
156 } // End namespace sza
157 
158 
159 
160 #endif // End #ifndef SZA_ANTENNA_CORBA_ASTROBANDLISTENER_H
Class used to represents bands of Correlator Data.
Abstract base class for listener called back by CorbaCorrConsumer.
Tagged: Fri Jan 26 17:59:28 NZDT 2007.
Tagged: Fri Aug 12 17:24:16 PDT 2011.
Tagged: Tue Oct 12 10:25:49 PDT 2004.
Base class for Correlator Sideband data.