casa
$Rev:20696$
|
00001 #if ! defined (Msvis_AveragingTvi2_H_121211_1236) 00002 #define Msvis_AveragingTvi2_H_121211_1236 00003 00004 #include <casa/aips.h> 00005 #include <synthesis/MSVis/TransformingVi2.h> 00006 00007 namespace casa { 00008 00009 namespace vi { 00010 00011 class WeightFunction; 00012 00013 namespace avg { 00014 00015 class VbSet; 00016 00017 } 00018 00019 class AveragingTvi2 : public TransformingVi2 { 00020 00021 public: 00022 00023 AveragingTvi2 (ViImplementation2 * inputVii, Double averagingInterval, 00024 Int nAveragesPerChunk, WeightFunction * weightFunction); 00025 ~AveragingTvi2 (); 00026 00028 // 00029 // Chunk/Subchunk structure in the AveragingTvi2 00030 // 00031 // The averaging interval, in seconds, is specified at construction time. 00032 // The interval (i.e., the size of the chunk in time) is also specified 00033 // at creation time; the interval must be an integer multiple of the 00034 // averaging interval. 00035 // 00036 // The input VI's setting must be compatible with those of the 00037 // AveragingTvi2. This means that the chunk size of the input VI must 00038 // have the same duration as the averaging VI. Although the input VI 00039 // and the averaging VI have the same duration, the averaging VI will 00040 // have fewer subchunks since N input subchunks will be averaged down 00041 // to create a single output subchunk. 00042 // 00043 // The input VI will also define the averaging boundaries by its 00044 // definition of a chunk. For example, if the input VI allows data with 00045 // different scans to be in the same chunk, then they will potentially 00046 // be averaged together. 00047 // 00048 // The input VI must use the data description ID as a sort column so that 00049 // a chunk will only contain data from a single DDID setting. 00050 00051 void originChunks (); 00052 void nextChunk (); 00053 Bool moreChunks () const; 00054 00055 void origin (); 00056 void next (); 00057 Bool more () const; 00058 00059 protected: 00060 00061 void advanceInputVii (); 00062 Int determineDdidToUse () const; 00063 void produceSubchunk (); 00064 void processInputSubchunk (const VisBuffer2 *); 00065 Bool reachedAveragingBoundary(); 00066 bool subchunksReady () const; 00067 void validateInputVi (ViImplementation2 *); 00068 00069 private: 00070 00071 const Double averagingInterval_p; // averaging interval in seconds 00072 Int ddidLastUsed_p; // ddId last used to produce a subchunk. 00073 Bool inputViiAdvanced_p; // true if input VII was advanced but data not used 00074 const Int nAveragesPerChunk_p; // number of subchunks per chunk on output 00075 Bool subchunkExists_p; 00076 avg::VbSet * vbSet_p; 00077 }; 00078 00079 } // end namespace vi 00080 00081 } // end namespace casa 00082 00083 #endif // ! defined (Msvis_AveragingTvi2_H_121211_1236)