CARMA C++
CoherenceStage.h
1 // $Id: CoherenceStage.h,v 1.8 2013/05/15 15:23:00 abeard Exp $
2 #ifndef CARMA_PIPELINE_COHERENCESTAGE_H
3 #define CARMA_PIPELINE_COHERENCESTAGE_H
4 
5 #include "carma/correlator/lib/CorrelatorPolarization.h"
7 #include "carma/monitor/CorrDesignation.h"
8 #include "carma/pipeline/Stage.h"
9 #include "carma/util/SimpleStatisticsAccumulators.h"
10 
11 #include <map>
12 
13 namespace carma {
14 
15 namespace monitor {
16  class AstroSubsystem;
17  class PipelineMonitorInput;
18  class PipelineSubsystem;
19 }
20 
21 namespace pipeline {
22 
23 class CoherenceStage : public carma::pipeline::Stage {
24 public:
25 
26  explicit CoherenceStage(
28  const carma::monitor::PipelineMonitorInput & plmi,
29  carma::monitor::AstroSubsystem & astroMonitor,
30  MonitorCorrelatorDesignation corrDes );
31 
32  ~CoherenceStage( );
33 
34  void preprocess( const carma::correlator::lib::CorrelatorDataPtr cd );
35 
36  void processBand( carma::correlator::lib::CorrelatorBand * cb );
37 
38  carma::correlator::lib::CorrelatorDataPtr
39  postprocess( carma::correlator::lib::CorrelatorDataPtr cd );
40 
41  void fillMonitorData( );
42 
43 private:
44 
45  void setCoherenceMp(
46  int abno,
47  const carma::correlator::lib::AntNoPolPair & antpol,
48  carma::correlator::lib::CorrelatorSideband::Flavor flav,
49  float meanCoherence );
50 
51  bool pipelineSubarrayOwnsAnt( int antNo );
52 
53  // These maps, though complicated, make the implementation trivial.
54  // Essentially, we form up two maps, one for baseline coherence and one
55  // for antenna coherence. Indexing is via astroband number,
56  // antNo & Pol (via automatic pair hashing) or baseline pairs of antpols
57  // and sideband 'flavor'.
58  typedef std::map< carma::correlator::lib::CorrelatorSideband::Flavor,
59  carma::util::ComplexFloatRollingStatAccumulator >
60  SbAccMap;
61  typedef std::pair< carma::correlator::lib::AntNoPolPair,
62  carma::correlator::lib::AntNoPolPair > BaselinePair;
63  typedef std::map< BaselinePair, SbAccMap > BaselineSbAccMap;
64 
65  std::map< int, BaselineSbAccMap > accs_; // Indexed by astroband number.
66 
67  typedef std::map< carma::correlator::lib::CorrelatorSideband::Flavor,
68  carma::util::FloatStatAccumulator >
69  SbFloatAccMap;
70  typedef std::map< carma::correlator::lib::AntNoPolPair,
71  SbFloatAccMap > AntNoSbAccMap;
72  typedef std::map< int, AntNoSbAccMap > AstroBandCoherenceMap;
73 
74  AstroBandCoherenceMap coherence_;
75 
76  typedef std::map< int, std::deque< float > > AntMaxCoherenceDequeMap;
77  AntMaxCoherenceDequeMap max30MinAntCoherence_;
78 
79  std::map< int, std::map< int, unsigned long > > seenBandAntCounter_;
80 
81  carma::monitor::AstroSubsystem & astroMon_;
82  const carma::monitor::PipelineMonitorInput & plmi_;
83  const MonitorCorrelatorDesignation corrDes_;
84 
85 }; // End class CoherenceStage
86 
87 } }
88 #endif
Base interface for a correlator pipeline stage.
Definition: Stage.h:39
Class to hold a Band of Correlator Data.
Tagged: Wed Jun 29 11:00:27 PDT 2005.
Abstract base class for retrieving pipeline monitor system components common between the spectral lin...