SynthesisImager.h

Go to the documentation of this file.
00001 //# SynthesisImager.h: Imager functionality sits here; 
00002 //# Copyright (C) 2012-2013
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 //#
00025 //# $Id$
00026 
00027 #ifndef SYNTHESIS_VB2_SYNTHESISIMAGER_H
00028 #define SYNTHESIS_VB2_SYNTHESISIMAGER_H
00029 
00030 #include <casa/aips.h>
00031 #include <casa/OS/Timer.h>
00032 #include <casa/Containers/Record.h>
00033 #include <ms/MeasurementSets/MeasurementSet.h>
00034 #include <casa/Arrays/IPosition.h>
00035 #include <casa/Quanta/Quantum.h>
00036 #include <measures/Measures/MDirection.h>
00037 #include<synthesis/ImagerObjects/SynthesisUtilMethods.h>
00038 
00039 #include<synthesis/ImagerObjects/SIMapperCollection.h>
00040 #include <msvis/MSVis/ViFrequencySelection.h>
00041 
00042 #include <msvis/MSVis/VisibilityIterator2.h>
00043 #include <synthesis/TransformMachines2/FTMachine.h>
00044 #include <synthesis/TransformMachines2/ATerm.h>
00045 
00046 namespace casa { //# NAMESPACE CASA - BEGIN
00047 // Forward declarations
00048 class MeasurementSet;
00049 template<class T> class ImageInterface;
00050  class SIIterBot;
00051  class VisImagingWeight;
00052 
00053 // <summary> Class that contains functions needed for imager </summary>
00054   namespace refim { //# NAMESPACE refim - BEGIN
00055 
00056 class SynthesisImager 
00057 {
00058  public:
00059   // Default constructor
00060 
00061   SynthesisImager();
00062   virtual ~SynthesisImager();
00063 
00064   // Copy constructor and assignment operator
00065   //Imager(const Imager&);
00066   //Imager& operator=(const Imager&);
00067 
00068   virtual Bool selectData(const SynthesisParamsSelect& selpars);
00069 
00070   // make all pure-inputs const
00071   virtual Bool selectData(const String& msname, 
00072                           const String& spw="*", 
00073                           const String& freqBeg="", 
00074                           const String& freqEnd="",
00075                           const MFrequency::Types freqFrame=MFrequency::LSRK, 
00076                           const String& field="*", 
00077                           const String& antenna="",  
00078                           const String& timestr="", 
00079                           const String& scan="", 
00080                           const String& obs="",
00081                           const String& state="",
00082                           const String& uvdist="", 
00083                           const String& taql="",
00084                           const Bool usescratch=False, 
00085                           const Bool readonly=False, 
00086                           const Bool incrementModel=False);
00087 
00088   virtual Bool defineImage(SynthesisParamsImage& impars, const SynthesisParamsGrid& gridpars);
00089 
00090   //When having a facetted image ...call with (facets > 1)  first and  once only ..
00091   //Easier to keep track of the imstores that way
00093   virtual Bool defineImage(const String& imagename, const Int nx, const Int ny,
00094                            const Quantity& cellx, const Quantity& celly,
00095                            const String& stokes,
00096                            const MDirection& phaseCenter, 
00097                            const Int nchan,
00098                            const Quantity& freqStart,
00099                            const Quantity& freqStep, 
00100                            const Vector<Quantity>& restFreq,
00101                            const Int facets=1,
00102                            const String ftmachine="GridFT",
00103                            const Int nTaylorTerms=1,
00104                            const Quantity& refFreq = Quantity(0,"Hz"),
00105                            const Projection& projection=Projection::SIN,
00106                            const Quantity& distance=Quantity(0,"m"),
00107                            const MFrequency::Types& freqFrame=MFrequency::LSRK,
00108                            const Bool trackSource=False, 
00109                            const MDirection& trackDir=MDirection(Quantity(0.0, "deg"), Quantity(90.0, "deg")), 
00110                            const Bool overwrite=False,
00111                            const Float padding=1.0, 
00112                            const Bool useAutocorr=False, 
00113                            const bool useDoublePrec=True, 
00114                            const Int wprojplanes=1, 
00115                            const String convFunc="SF", 
00116                            const String startmodel="",
00117                            // The extra params for WB-AWP
00118                            const Bool aTermOn    = True,
00119                            const Bool psTermOn   = True,
00120                            const Bool mTermOn    = False,
00121                            const Bool wbAWP      = True,
00122                            const String cfCache  = "",
00123                            const Bool doPointing = False,
00124                            const Bool doPBCorr   = True,
00125                            const Bool conjBeams  = True,
00126                            const Float computePAStep=360.0,
00127                            const Float rotatePAStep=5.0
00128                            );
00129   //Define image via a predefine SIImageStore object
00130   virtual Bool defineImage(CountedPtr<SIImageStore> imstor, 
00131                            const String& ftmachine);
00132   //Defining componentlist to use while degriding
00133   //This should be called once...if multiple lists are used..they can be merged in one
00134   //if sdgrid=True then image plane degridding is done
00135   virtual void setComponentList(const ComponentList& cl, 
00136                                 Bool sdgrid=False);
00137   Bool weight(const String& type="natural", 
00138               const String& rmode="norm",
00139               const Quantity& noise=Quantity(0.0, "Jy"), 
00140               const Double robust=0.0,
00141               const Quantity& fieldofview=Quantity(0.0, "arcsec"),
00142               const Int npixels=0, 
00143               const Bool multiField=False,
00144               const String& filtertype=String("Gaussian"),
00145               const Quantity& filterbmaj=Quantity(0.0,"deg"),
00146               const Quantity& filterbmin=Quantity(0.0,"deg"),
00147               const Quantity& filterbpa=Quantity(0.0,"deg")  );
00148 
00149   //the following get rid of the mappers in this object
00150   void resetMappers();
00151 
00152   CountedPtr<SIImageStore> imageStore(const Int id=0);
00153 
00154   //Record getMajorCycleControls();
00155   void executeMajorCycle(Record& controls);
00156 
00157   // make the psf images  i.e grid weight rather than data
00158   void makePSF();
00159 
00160   void predictModel();
00161   /* Access method to the Loop Controller held in this class */
00162   //SIIterBot& getLoopControls();
00163 
00164  
00165 
00166 protected:
00167  
00169 
00170   // Choose between different types of FTMs
00171   void createFTMachine(CountedPtr<refim::FTMachine>& theFT, 
00172                        CountedPtr<refim::FTMachine>& theIFT,  
00173                        const String& ftname,
00174                        const uInt nTaylorTerms=1, 
00175                        const String mType="default",
00176                        const Int facets=1,
00177                        //------------------------------
00178                        const Int wprojplane=1,
00179                        const Float padding=1.0,
00180                        const Bool useAutocorr=False,
00181                        const Bool useDoublePrec=True,
00182                        const String gridFunction=String("SF"),
00183                        //------------------------------
00184                        const Bool aTermOn    = True,
00185                        const Bool psTermOn   = True,
00186                        const Bool mTermOn    = False,
00187                        const Bool wbAWP      = True,
00188                        const String cfCache  = "",
00189                        const Bool doPointing = False,
00190                        const Bool doPBCorr   = True,
00191                        const Bool conjBeams  = True,
00192                        const Float computePAStep   = 360.0,
00193                        const Float rotatePAStep    = 5.0,
00194                        const String interpolation = String("linear"),
00195                        const Bool freqFrameValid = True,
00196                        const Int cache=1000000000,
00197                        const Int tile=16);
00198 
00199   // Choose between different types of ImageStore types (single term, multiterm, faceted)
00200   CountedPtr<SIImageStore> createIMStore(String imageName, 
00201                                          CoordinateSystem& cSys,
00202                                          IPosition imShape, 
00203                                          const Bool overwrite,
00204                                          String mappertype="default", 
00205                                          uInt ntaylorterms=1,
00206                                          Quantity distance=Quantity(0.0, "m"),
00207                                          uInt facets=1,
00208                                          Bool useweightimage=False);
00209   
00210   // Choose between different types of Mappers (single term, multiterm, imagemosaic, faceted)
00211   CountedPtr<SIMapper> createSIMapper(String mappertype,  
00212                                           CountedPtr<SIImageStore> imagestore, 
00213                                       CountedPtr<refim::FTMachine> ftmachine,
00214                                       CountedPtr<refim::FTMachine> iftmachine,
00215                                           uInt ntaylorterms=1);
00216 
00217   Block<CountedPtr<SIImageStore> > createFacetImageStoreList(
00218                                                              CountedPtr<SIImageStore> imagestore,
00219                                                              Int facets);
00220   void setPsfFromOneFacet();
00221 
00222   Bool toUseWeightImage(CountedPtr<refim::FTMachine>& ftm, String mappertype);
00223 
00224   void createVisSet(const Bool writeaccess=False);
00225   
00226   void createAWPFTMachine(CountedPtr<FTMachine>& theFT, CountedPtr<FTMachine>& theIFT, 
00227                           const String& ftmName,
00228                           const Int facets,          
00229                           //----------------------------
00230                           const Int wprojPlane,     
00231                           const Float padding,      
00232                           const Bool useAutocorr,   
00233                           const Bool useDoublePrec, 
00234                           const String gridFunction,
00235                           //---------------------------
00236                           const Bool aTermOn,      
00237                           const Bool psTermOn,     
00238                           const Bool mTermOn,      
00239                           const Bool wbAWP,        
00240                           const String cfCache,    
00241                           const Bool doPointing,   
00242                           const Bool doPBCorr,     
00243                           const Bool conjBeams,    
00244                           const Float computePAStep,
00245                           const Float rotatePAStep, 
00246                           const Int cache,          
00247                           const Int tile);
00248   refim::ATerm* createTelescopeATerm(const MeasurementSet& ms, const Bool& isATermOn);
00249 
00250   void runMajorCycle(const Bool dopsf=False, const Bool savemodel=False);
00251 
00256   //  void appendToMapperList(String imagename, CoordinateSystem& csys, String ftmachine,
00257   //                      Quantity distance=Quantity(0.0, "m"), Int facets=1, const Bool overwrite=False);
00258 
00259   void appendToMapperList(String imagename, 
00260                           CoordinateSystem& csys, 
00261                           IPosition imshape,
00262                           CountedPtr<refim::FTMachine>& ftm,
00263                           CountedPtr<refim::FTMachine>& iftm,
00264                           Quantity distance=Quantity(0.0, "m"), 
00265                           Int facets=1, 
00266                           const Bool overwrite=False,
00267                           String mappertype=String("default"),
00268                           uInt ntaylorterms=1);
00270 
00271   SIMapperCollection itsMappers;
00273   CountedPtr<SIImageStore> unFacettedImStore_p;
00274 
00275 
00276   CoordinateSystem itsMaxCoordSys;
00277   IPosition itsMaxShape;
00278 
00279 
00281 
00282   // Data Selection
00283   // Image Definition
00284   // Imaging/Gridding
00285 
00286   // Other Options
00287   Block<const MeasurementSet *> mss_p;
00288   vi::FrequencySelections fselections_p;
00289   CountedPtr<vi::VisibilityIterator2>  vi_p;
00290 
00292   Bool writeAccess_p;
00293   MPosition mLocation_p;
00294   MDirection phaseCenter_p;
00295   Int facetsStore_p;
00296   VisImagingWeight imwgt_p;
00297   Bool imageDefined_p;
00298   Bool useScratch_p,readOnly_p;
00299   //
00300   //  Bool freqFrameValid_p;
00301 
00302   refim::FTMachine::Type datacol_p;
00303 
00304 };
00305 
00306   }//# NAMESPACE refim - END
00307 } //# NAMESPACE CASA - END
00308 
00309 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1