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
00028 #ifndef IMAGES_IMAGEPOL_H
00029 #define IMAGES_IMAGEPOL_H
00030
00031 #include <imageanalysis/ImageAnalysis/ImagePolarimetry.h>
00032
00033 namespace casa {
00034
00035
00036 class LogIO;
00037 class String;
00038 class Record;
00039 class Normal;
00040 template<class T> class ImageInterface;
00041
00042
00043
00044
00045 class ImagePol
00046 {
00047
00048 public:
00049
00050 ImagePol();
00051 ImagePol(ImageInterface<Float>& im);
00052 virtual ~ImagePol();
00053
00054
00055 Bool imagepoltestimage(const String& outFile = "imagepol.iquv",
00056 const Vector<Double>& rm = Vector<Double>(1, 0.0),
00057 Bool rmDefault = True,
00058 Double pa0 = 0.0, Double sigma = 0.01,
00059 Int nx = 32, Int ny = 32, Int nf = 32,
00060 Double f0 = 1.4e9, Double df = 128.0e6);
00061
00062 Bool open(ImageInterface<Float>& im);
00063 Bool open(const String& infile);
00064
00065
00066
00067
00068 Bool depolratio(ImageInterface<Float>*& rtnim, const String& infile,
00069 Bool debias = False,
00070 Double clip = 10.0, Double sigma = -1,
00071 const String& oufile="");
00072
00073
00074 Bool complexlinpol(const String& outfile);
00075
00076
00077
00078 void summary() const;
00079
00080
00081 Float sigma(Float clip = 10.0) const;
00082
00083
00084 Bool stokesI(ImageInterface<Float>*& rtnim, const String& outfile="");
00085 Float sigmaStokesI(Float clip = 10.0) const;
00086
00087
00088 Bool stokesQ(ImageInterface<Float>*& rtnim, const String& outfile="");
00089 Float sigmaStokesQ(Float clip = 10.0) const;
00090
00091
00092 Bool stokesU(ImageInterface<Float>*& rtnim, const String& outfile="");
00093 Float sigmaStokesU(Float clip = 10.0) const;
00094
00095
00096 Bool stokesV(ImageInterface<Float>*& rtnim, const String& outfile="");
00097 Float sigmaStokesV(Float clip = 10.0) const;
00098
00099
00100 Bool linPolInt(ImageInterface<Float>*& rtnim, Bool debias = False,
00101 Float clip = 10.0,
00102 Float sigma = -1, const String& outfile = "");
00103 Float sigmaLinPolInt(Float clip = 10.0, Float sigma = -1) const;
00104
00105
00106 Bool totPolInt(ImageInterface<Float>*& rtnim, Bool debias = False,
00107 Float clip = 10.0,
00108 Float sigma = -1, const String& outfile = "");
00109 Float sigmaTotPolInt(Float clip = 10.0, Float sigma = -1) const;
00110
00111
00112 void complexLinearPolarization (const String& outfile);
00113
00114
00115 void complexFractionalLinearPolarization (const String& outfile);
00116
00117
00118 Bool linPolPosAng(ImageInterface<Float>*& rtnim,
00119 const String& outfile = "");
00120 Bool sigmaLinPolPosAng(ImageInterface<Float>*& rtnim, Float clip = 10.0,
00121 Float sigma = -1, const String& outfile = "");
00122
00123
00124 Bool fracLinPol(ImageInterface<Float>*& rtnim, Bool debias = False,
00125 Float clip = 10.0,
00126 Float sigma = -1, const String& outfile = "");
00127 Bool sigmaFracLinPol(ImageInterface<Float>*& rtnim, Float clip = 10.0,
00128 Float sigma = -1, const String& outfile = "");
00129
00130
00131 Bool fracTotPol(ImageInterface<Float>*& rtnim, Bool debias = False,
00132 Float clip = 10.0,
00133 Float sigma = -1, const String& outfile = "");
00134 Bool sigmaFracTotPol(ImageInterface<Float>*& rtnim, Float clip = 10.0,
00135 Float sigma = -1, const String& outfile = "");
00136
00137
00138 Bool depolarizationRatio (ImageInterface<Float>*& rtnim,
00139 const String& infile,
00140 Bool debias = False, Float clip = 10.0,
00141 Float sigma = -1, const String& outfile = "");
00142 Bool sigmaDepolarizationRatio (ImageInterface<Float>*& rtnim,
00143 const String& infile,
00144 Bool debias = False, Float clip = 10.0,
00145 Float sigma = -1, const String& outfile = "");
00146
00147
00148 void fourierRotationMeasure(const String& outfile = "",
00149 const String& outfileAmp = "",
00150 const String& outfilePA = "",
00151 const String& outfileReal = "",
00152 const String& outfileImag = "",
00153 Bool zeroZeroLag = False);
00154
00155
00156 void rotationMeasure(const String& outRM = "", const String& outRMErr = "",
00157 const String& outPA0 = "", const String& outPA0Err = "",
00158 const String& outNTurns = "",
00159 const String& outChiSq = "",
00160 Int axis = -1, Float varQU = -1, Float rmFg = 0.0,
00161 Float rmMax = 0.0, Float maxPaErr = 1e30
00162
00163 );
00164
00165
00166 void makeComplex (const String& complex, const String& real = "",
00167 const String& imag = "", const String& amp = "",
00168 const String& phase = "");
00169
00170 private:
00171 LogIO *itsLog;
00172 ImagePolarimetry *itsImPol;
00173
00174 Bool copyImage(ImageInterface<Float>*& out, const ImageInterface<Float>&in,
00175 const String& outfile="", Bool overwrite=true);
00176
00177 void copyMiscellaneous (ImageInterface<Complex>& out,
00178 const ImageInterface<Float>& in);
00179 void copyMiscellaneous (ImageInterface<Float>& out,
00180 const ImageInterface<Float>& in);
00181 void fiddleStokesCoordinate(ImageInterface<Float>& ie,
00182 Stokes::StokesTypes type);
00183 void fiddleStokesCoordinate(ImageInterface<Complex>& ie,
00184 Stokes::StokesTypes type);
00185
00186 Bool makeImage (ImageInterface<Complex>*& out,
00187 const String& outfile, const CoordinateSystem& cSys,
00188 const IPosition& shape, Bool isMasked=False,
00189 Bool tempAllowed=True);
00190 Bool makeImage (ImageInterface<Float>*& out,
00191 const String& outfile, const CoordinateSystem& cSys,
00192 const IPosition& shape, Bool isMasked=False,
00193 Bool tempAllowed=True);
00194
00195 Bool makeIQUVImage (ImageInterface<Float>*& pImOut, const String& outfile,
00196 Double sigma,
00197 Double pa0, const Vector<Float>& rm,
00198 const IPosition& shape,
00199 Double f0, Double dF);
00200
00201 Bool fillIQUV (ImageInterface<Float>& im, uInt stokesAxis,
00202 uInt spectralAxis, const Vector<Float>& rm,
00203 Float pa0);
00204
00205 void addNoise (Array<Float>& slice, Normal& noiseGen);
00206
00207 void centreRefPix (CoordinateSystem& cSys, const IPosition& shape);
00208
00209 Bool makeMask(ImageInterface<Float>& out, Bool init=False);
00210 Bool makeMask(ImageInterface<Complex>& out, Bool init=False);
00211
00212 Stokes::StokesTypes stokesType(const CoordinateSystem& cSys);
00213
00214
00215 };
00216
00217 }
00218
00219 #endif