ChannelAverageTVI.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef ChannelAverageTVI_H_
00024 #define ChannelAverageTVI_H_
00025 
00026 
00027 #include <mstransform/TVI/FreqAxisTVI.h>
00028 
00029 
00030 namespace casa { 
00031 
00032 namespace vi { 
00033 
00035 
00037 
00038 class ChannelAverageTVI : public FreqAxisTVI
00039 {
00040 
00041 public:
00042 
00043         ChannelAverageTVI(ViImplementation2 * inputVii,const Record &configuration);
00044 
00045         
00046         virtual String ViiType() const { return String("ChannelAverage( ")+getVii()->ViiType()+" )"; };
00047 
00048 
00049     void flag(Cube<Bool>& flagCube) const;
00050     void floatData (Cube<Float> & vis) const;
00051     void visibilityObserved (Cube<Complex> & vis) const;
00052     void visibilityCorrected (Cube<Complex> & vis) const;
00053     void visibilityModel (Cube<Complex> & vis) const;
00054     void weightSpectrum(Cube<Float> &weightSp) const;
00055     void sigmaSpectrum (Cube<Float> &sigmaSp) const;
00056 
00057     Bool weightSpectrumExists () const {return True;}
00058     Bool sigmaSpectrumExists () const {return True;}
00059 
00060     Vector<Double> getFrequencies (     Double time, Int frameOfReference,
00061                                                                 Int spectralWindowId, Int msId) const;
00062 
00063     void writeFlag (const Cube<Bool> & flag);
00064 
00065 protected:
00066 
00067     void propagateChanAvgFlags (const Cube<Bool> &avgFlagCube, Cube<Bool> &expandedFlagCube);
00068     Bool parseConfiguration(const Record &configuration);
00069     void initialize();
00070 
00071         Vector<Int> chanbin_p;
00072         mutable map<Int,uInt > spwChanbinMap_p; 
00073 };
00074 
00076 
00078 
00079 class ChannelAverageTVIFactory : public ViFactory
00080 {
00081 
00082 public:
00083 
00084         ChannelAverageTVIFactory(Record &configuration,ViImplementation2 *inputVII);
00085 
00086 protected:
00087 
00088         vi::ViImplementation2 * createVi (VisibilityIterator2 *) const;
00089         vi::ViImplementation2 * createVi () const;
00090 
00091         Record configuration_p;
00092         ViImplementation2 *inputVii_p;;
00093 };
00094 
00096 
00098 
00099 class ChannelAverageTVILayerFactory : public ViiLayerFactory
00100 {
00101 
00102 public:
00103 
00104   ChannelAverageTVILayerFactory(Record &configuration);
00105 
00106   virtual ~ChannelAverageTVILayerFactory() {};
00107 
00108 protected:
00109 
00110   
00111   virtual ViImplementation2 * createInstance(ViImplementation2* vii0) const;
00112 
00113   const Record configuration_p;
00114 
00115 };
00116 
00118 
00120 
00121 
00122 template<class T> class ChannelAverageKernel; 
00123 
00124 template<class T> class ChannelAverageTransformEngine : public FreqAxisTransformEngine2<T>
00125 {
00126 
00127         using FreqAxisTransformEngine2<T>::inputData_p;
00128         using FreqAxisTransformEngine2<T>::outputData_p;
00129 
00130 public:
00131 
00132         ChannelAverageTransformEngine   (       ChannelAverageKernel<T> *kernel,
00133                                                                                 DataCubeMap *inputData,
00134                                                                                 DataCubeMap *outputData,
00135                                                                                 uInt width);
00136 
00137         void transform();
00138 
00139 protected:
00140 
00141         uInt width_p;
00142         
00143         
00144         
00145         ChannelAverageKernel<T> *chanAvgKernel_p;
00146 };
00147 
00149 
00151 
00152 template<class T> class ChannelAverageKernel
00153 {
00154 
00155 public:
00156 
00157         virtual void kernel(DataCubeMap *inputData,
00158                                                 DataCubeMap *outputData,
00159                                                 uInt startInputPos,
00160                                                 uInt outputPos,
00161                                                 uInt width) = 0;
00162 };
00163 
00165 
00167 
00168 template<class T> class PlainChannelAverageKernel : public ChannelAverageKernel<T>
00169 {
00170 
00171 public:
00172 
00173         void kernel(    DataCubeMap *inputData,
00174                                         DataCubeMap *outputData,
00175                                         uInt startInputPos,
00176                                         uInt outputPos,
00177                                         uInt width);
00178 
00179 };
00180 
00182 
00184 
00185 template<class T> class WeightedChannelAverageKernel : public ChannelAverageKernel<T>
00186 {
00187 
00188 public:
00189 
00190         void kernel(DataCubeMap *inputData,
00191                                 DataCubeMap *outputData,
00192                                 uInt startInputPos,
00193                                 uInt outputPos,
00194                                 uInt width);
00195 };
00196 
00198 
00200 
00201 template<class T> class LogicalANDKernel : public ChannelAverageKernel<T>
00202 {
00203 
00204 public:
00205 
00206         void kernel(DataCubeMap *inputData,
00207                                 DataCubeMap *outputData,
00208                                 uInt startInputPos,
00209                                 uInt outputPos,
00210                                 uInt width);
00211 };
00212 
00214 
00216 
00217 template<class T> class ChannelAccumulationKernel : public ChannelAverageKernel<T>
00218 {
00219 
00220 public:
00221 
00222         void kernel(DataCubeMap *inputData,
00223                                 DataCubeMap *outputData,
00224                                 uInt startInputPos,
00225                                 uInt outputPos,
00226                                 uInt width);
00227 };
00228 
00229 } 
00230 
00231 } 
00232 
00233 #endif 
00234