DDMapper.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
00024
00025
00026
00027 #ifndef FLAGGING_DDMAPPER_H
00028 #define FLAGGING_DDMAPPER_H
00029
00030 #include <casa/Arrays/Vector.h>
00031 #include <casa/Arrays/Cube.h>
00032 #include <casa/Exceptions/Error.h>
00033 #include <measures/Measures/Stokes.h>
00034
00035 namespace casa {
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 class DDMapper
00063 {
00064 protected:
00065 Bool valid;
00066 uShort corrmask;
00067
00068 public:
00069 DDMapper () { valid=False; }
00070 virtual ~DDMapper () {};
00071
00072
00073
00074 virtual Bool reset ( const Vector<Int> &corr ) =0;
00075
00076
00077
00078 virtual Float map ( const Cube<Complex> &vis,uInt ich,uInt irow ) const =0;
00079
00080
00081
00082 uShort corrMask () const { return corrmask; }
00083
00084
00085 Bool masked (uInt icorr) const { return (corrmask&(1<<icorr)) != 0; }
00086
00087
00088 Bool isValid () { return valid; }
00089 };
00090
00091
00092
00093
00094
00095 class DDDummy : public DDMapper
00096 {
00097 public:
00098 DDDummy ();
00099 ~DDDummy ();
00100
00101 virtual void puke () const
00102 { throw(AipsError("Uninitialized DDMapper used")); }
00103
00104 virtual Bool reset ( const Vector<Int> & )
00105 { puke(); return False; }
00106 virtual Float map ( const Cube<Complex> &,uInt,uInt ) const
00107 { puke(); return 0.; }
00108
00109 };
00110
00111
00112
00113
00114
00115 class DDFunc : public DDMapper
00116 {
00117 public:
00118 typedef Float (*FuncSignature)(const Complex &);
00119
00120 DDFunc ( FuncSignature fsig,const String &corr );
00121 ~DDFunc() {};
00122
00123 virtual Bool reset ( const Vector<Int> &corr );
00124 virtual Float map ( const Cube<Complex> &vis,uInt ich,uInt irow ) const;
00125
00126
00127
00128 static Float real (const Complex&);
00129 static Float imag (const Complex&);
00130
00131
00132
00133 static FuncSignature getFunction( const String &name );
00134
00135
00136
00137
00138
00139
00140
00141
00142 static DDMapper * getMapper ( String &desc,const Vector<String> &expr,Bool throw_excp=False );
00143
00144 protected:
00145 Int icorr;
00146 Stokes::StokesTypes corrtype;
00147 FuncSignature func;
00148 };
00149
00150
00151
00152
00153
00154 class DDSumFunc : public DDFunc
00155 {
00156 public:
00157 DDSumFunc ( FuncSignature fsig,const String &corr1,const String &corr2 );
00158 virtual ~DDSumFunc() {};
00159
00160 virtual Bool reset ( const Vector<Int> &corr );
00161 virtual Float map ( const Cube<Complex> &vis,uInt ich,uInt irow ) const;
00162
00163 protected:
00164 Int icorr2;
00165 Stokes::StokesTypes corrtype2;
00166 };
00167
00168
00169
00170
00171
00172 class DDFuncSum : public DDSumFunc
00173 {
00174 public:
00175 DDFuncSum ( FuncSignature fsig,const String &corr1,const String &corr2 );
00176 virtual ~DDFuncSum() {};
00177
00178 virtual Float map ( const Cube<Complex> &vis,uInt ich,uInt irow ) const;
00179 };
00180
00181
00182
00183
00184
00185 class DDFuncDiff : public DDSumFunc
00186 {
00187 public:
00188 DDFuncDiff ( FuncSignature fsig,const String &corr1,const String &corr2 );
00189 virtual ~DDFuncDiff() {};
00190
00191 virtual Float map ( const Cube<Complex> &vis,uInt ich,uInt irow ) const;
00192 };
00193
00194
00195
00196
00197
00198 class DDDiffFunc : public DDSumFunc
00199 {
00200 public:
00201 DDDiffFunc ( FuncSignature fsig,const String &corr1,const String &corr2 );
00202 virtual ~DDDiffFunc() {};
00203
00204 virtual Float map ( const Cube<Complex> &vis,uInt ich,uInt irow ) const;
00205 };
00206
00207
00208 Vector<String> splitExpression( const Vector<String> &expr0 );
00209
00210
00211 }
00212
00213 #endif