ImagePolProxy.h

Go to the documentation of this file.
00001 //# ImagePolProxy.h: a casa namespace class for imagepol tool
00002 //# Copyright (C) 2007
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 #ifndef _IMAGEPOL__H__
00028 #define _IMAGEPOL__H__
00029 
00030 #include <images/Images/ImagePolarimetry.h>
00031 
00032 // Implementation of the image polarimetry functionality
00033 // available from casapy.
00034 
00035 namespace casa {
00036 
00037 class LogIO;
00038 class String;
00039 class Record;
00040 class Normal;
00041 template<class T> class ImageInterface;
00042 
00043 class ImagePol
00044 {
00045 
00046  public:
00047   // "imagepol" constructors 
00048   ImagePol();
00049   ImagePol(ImageInterface<Float>& im);
00050   virtual ~ImagePol();
00051 
00052   // Make test image
00053   Bool imagepoltestimage(const String& outFile = "imagepol.iquv",
00054                          const Vector<Double>& rm = Vector<Double>(1, 0.0),
00055                          Bool rmDefault = True,
00056                          Double pa0 = 0.0, Double sigma = 0.01,
00057                          Int nx = 32, Int ny = 32, Int nf = 32,
00058                          Double f0 = 1.4e9, Double df = 128.0e6);
00059 
00060   Bool open(ImageInterface<Float>& im);
00061   Bool open(const String& infile);
00062 
00063   // Depolarization ratio
00064   // The image containing the delpolratio is in the returnrec 
00065   // Can be recovered using ImageInterface::fromRecord
00066   Bool depolratio(ImageInterface<Float>*& rtnim, const String& infile, 
00067                   const Bool debias = False,
00068                   const Double clip = 10.0, const Double sigma = -1, 
00069                   const String& oufile="");  
00070 
00071   //Complex linear polarization image is stored in outfile
00072   Bool complexlinpol(const String& outfile);
00073 
00074 
00075   // Summary
00076   void summary() const;
00077 
00078   // sigma
00079   Float sigma(Float clip = 10.0) const;
00080 
00081   // Stokes I
00082   Bool stokesI(ImageInterface<Float>*& rtnim, const String& outfile="");
00083   Float sigmaStokesI(Float clip = 10.0) const;
00084 
00085   // Stokes Q
00086   Bool stokesQ(ImageInterface<Float>*& rtnim, const String& outfile="");
00087   Float sigmaStokesQ(Float clip = 10.0) const;
00088 
00089   // Stokes U
00090   Bool stokesU(ImageInterface<Float>*& rtnim, const String& outfile="");
00091   Float sigmaStokesU(Float clip = 10.0) const;
00092 
00093   // Stokes V
00094   Bool stokesV(ImageInterface<Float>*& rtnim, const String& outfile="");
00095   Float sigmaStokesV(Float clip = 10.0) const;
00096 
00097   // Linearly polarized intensity
00098   Bool linPolInt(ImageInterface<Float>*& rtnim, Bool debias = False,
00099                  Float clip = 10.0,
00100                  Float sigma = -1, const String& outfile = "");
00101   Float sigmaLinPolInt(Float clip = 10.0, Float sigma = -1) const;
00102 
00103   // Total polarized intensity.
00104   Bool totPolInt(ImageInterface<Float>*& rtnim, Bool debias = False,
00105                  Float clip = 10.0,
00106                  Float sigma = -1, const String& outfile = "");
00107   Float sigmaTotPolInt(Float clip = 10.0, Float sigma = -1) const;
00108 
00109   // Complex linear polarization
00110   void complexLinearPolarization (const String& outfile);
00111 
00112   // Complex linear polarization
00113   void complexFractionalLinearPolarization (const String& outfile);
00114 
00115   // Linearly polarized position angle
00116   Bool linPolPosAng(ImageInterface<Float>*& rtnim,
00117                     const String& outfile = "");
00118   Bool sigmaLinPolPosAng(ImageInterface<Float>*& rtnim, Float clip = 10.0,
00119                          Float sigma = -1, const String& outfile = "");
00120 
00121   // Fractional linearly polarized intensity
00122   Bool fracLinPol(ImageInterface<Float>*& rtnim, Bool debias = False,
00123                   Float clip = 10.0,
00124                   Float sigma = -1, const String& outfile = "");
00125   Bool sigmaFracLinPol(ImageInterface<Float>*& rtnim, Float clip = 10.0,
00126                        Float sigma = -1, const String& outfile = "");
00127 
00128   // Fractional total polarized intensity
00129   Bool fracTotPol(ImageInterface<Float>*& rtnim, Bool debias = False,
00130                   Float clip = 10.0,
00131                   Float sigma = -1, const String& outfile = "");
00132   Bool sigmaFracTotPol(ImageInterface<Float>*& rtnim, Float clip = 10.0,
00133                        Float sigma = -1, const String& outfile = "");
00134 
00135   // Depolarization ratio
00136   Bool depolarizationRatio (ImageInterface<Float>*& rtnim, 
00137                             const String& infile,
00138                             Bool debias = False, Float clip = 10.0,
00139                             Float sigma = -1, const String& outfile = "");
00140   Bool sigmaDepolarizationRatio (ImageInterface<Float>*& rtnim,
00141                                  const String& infile,
00142                                  Bool debias = False, Float clip = 10.0,
00143                                  Float sigma = -1, const String& outfile = "");
00144 
00145   // Find Rotation Measure from Fourier method
00146   void fourierRotationMeasure(const String& outfile = "",
00147                               const String& outfileAmp = "",
00148                               const String& outfilePA = "",
00149                               const String& outfileReal = "",
00150                               const String& outfileImag = "",
00151                               Bool zeroZeroLag = False);
00152 
00153   // Find Rotation Measure from traditional method
00154   void rotationMeasure(const String& outRM = "", const String& outRMErr = "",
00155                        const String& outPA0 = "", const String& outPA0Err = "",
00156                        const String& outNTurns = "",
00157                        const String& outChiSq = "",
00158                        Int axis = -1, Float varQU = -1, Float rmFg = 0.0,
00159                        Float rmMax = 0.0, Float maxPaErr = 1e30,
00160                        const String& plotter = "",
00161                        Int nx = 5, Int ny = 5);
00162 
00163   // Make a complex image
00164   void makeComplex (const String& complex, const String& real = "",
00165                     const String& imag = "", const String& amp = "",
00166                     const String& phase = "");
00167 
00168  private:
00169   LogIO *itsLog;
00170   ImagePolarimetry *itsImPol;
00171   
00172   Bool copyImage(ImageInterface<Float>*& out, const ImageInterface<Float>&in, 
00173             const String& outfile="", Bool overwrite=true);
00174   // Copy miscellaneous (MiscInfo, ImageInfo, history, units)
00175   void copyMiscellaneous (ImageInterface<Complex>& out,
00176                           const ImageInterface<Float>& in);
00177   void copyMiscellaneous (ImageInterface<Float>& out,
00178                          const ImageInterface<Float>& in);
00179   void fiddleStokesCoordinate(ImageInterface<Float>& ie,
00180                               Stokes::StokesTypes type);
00181   void fiddleStokesCoordinate(ImageInterface<Complex>& ie,
00182                               Stokes::StokesTypes type);
00183   // Make a PagedImage or TempImage output
00184   Bool makeImage (ImageInterface<Complex>*& out, 
00185                   const String& outfile, const CoordinateSystem& cSys,
00186                   const IPosition& shape, const Bool isMasked=False,
00187                   const Bool tempAllowed=True);
00188   Bool makeImage (ImageInterface<Float>*& out, 
00189                   const String& outfile, const CoordinateSystem& cSys,
00190                   const IPosition& shape, const Bool isMasked=False,
00191                   const Bool tempAllowed=True);
00192   // Make an IQUV image with some dummy RM data
00193   Bool  makeIQUVImage (ImageInterface<Float>*& pImOut, const String& outfile, 
00194                        Double sigma, 
00195                        Double pa0, const Vector<Float>& rm, 
00196                        const IPosition& shape,
00197                        Double f0, Double dF);
00198   // Fill IQUV image with Stokes values from RM data
00199   Bool fillIQUV (ImageInterface<Float>& im, uInt stokesAxis,
00200                  uInt spectralAxis, const Vector<Float>& rm, 
00201                  Float pa0);
00202   // Add noise to Array
00203   void addNoise (Array<Float>& slice, Normal& noiseGen);
00204   // Centre reference pixelin image
00205   void centreRefPix (CoordinateSystem& cSys, const IPosition& shape);
00206   // Make and define a mask
00207   Bool makeMask(ImageInterface<Float>& out, Bool init=False);
00208   Bool makeMask(ImageInterface<Complex>& out, Bool init=False);
00209   // What Stokes type?  Exception if more than one.
00210   Stokes::StokesTypes stokesType(const CoordinateSystem& cSys);
00211 
00212 
00213 };
00214 
00215 } // casa namespace
00216 
00217 #endif

Generated on Mon Sep 1 22:34:43 2008 for NRAOCASA by  doxygen 1.5.1