casa
$Rev:20696$
|
00001 //# CubeSkyEquation.h: CubeSkyEquation definition 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 adressed 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 SYNTHESIS_CUBESKYEQUATION_H 00028 #define SYNTHESIS_CUBESKYEQUATION_H 00029 00030 #include <synthesis/MeasurementEquations/SkyEquation.h> 00031 //#include <synthesis/Utilities/ThreadTimers.h> 00032 00033 00034 namespace casa { //# NAMESPACE CASA - BEGIN 00035 00036 //Forward 00037 00038 template <class T> class ImageInterface; 00039 template <class T> class TempImage; 00040 template <class T> class SubImage; 00041 template <class T> class Block; 00042 class VisibilityIterator; 00043 class ROVisibilityIterator; 00044 00045 class CubeSkyEquation : public SkyEquation { 00046 00047 public: 00048 CubeSkyEquation(SkyModel& sm, VisSet& vs, FTMachine& ft, ComponentFTMachine& cft, Bool noModelCol=False); 00049 00050 //Read only iterator...hence no scratch col 00051 CubeSkyEquation(SkyModel& sm, ROVisibilityIterator& vi, FTMachine& ft, ComponentFTMachine& cft, Bool noModelCol=False); 00052 00053 virtual ~CubeSkyEquation(); 00054 virtual void predict(Bool incremental=False, MS::PredefinedColumns Type=MS::MODEL_DATA); 00055 virtual void gradientsChiSquared(Bool incremental, Bool commitModel=False); 00056 00057 virtual void initializePutSlice(const VisBuffer& vb, Bool dopsf, Int cubeSlice=0, Int nCubeSlice=1); 00058 virtual void newInitializePutSlice(const VisBuffer& vb, Bool dopsf, Int cubeSlice=0, Int nCubeSlice=1); 00059 virtual void oldInitializePutSlice(const VisBuffer& vb, Bool dopsf, Int cubeSlice=0, Int nCubeSlice=1); 00060 virtual void putSlice(VisBuffer& vb, Bool dopsf, 00061 FTMachine::Type col,Int cubeSlice=0, 00062 Int nCubeSlice=1); 00063 virtual void finalizePutSlice(const VisBuffer& vb, Bool dopsf, 00064 Int cubeSlice=0, Int nCubeSlice=1); 00065 virtual void newFinalizePutSlice(const VisBuffer& vb, Bool dopsf, 00066 Int cubeSlice=0, Int nCubeSlice=1); 00067 virtual void oldFinalizePutSlice(const VisBuffer& vb, Bool dopsf, 00068 Int cubeSlice=0, Int nCubeSlice=1); 00069 void initializeGetSlice(const VisBuffer& vb, Int row, 00070 Bool incremental, Int cubeSlice=0, 00071 Int nCubeSlice=1); 00072 void newInitializeGetSlice(const VisBuffer& vb, Int row, 00073 Bool incremental, Int cubeSlice=0, 00074 Int nCubeSlice=1); 00075 void oldInitializeGetSlice(const VisBuffer& vb, Int row, 00076 Bool incremental, Int cubeSlice=0, 00077 Int nCubeSlice=1); 00078 virtual VisBuffer& getSlice(VisBuffer& vb, 00079 Bool incremental, Int cubeSlice=0, 00080 Int nCubeSlice=1); 00081 void finalizeGetSlice(); 00082 void isLargeCube(ImageInterface<Complex>& theIm, Int& nCubeSlice); 00083 //void makeApproxPSF(Int model, ImageInterface<Float>& psf); 00084 //virtual void makeApproxPSF(Int model, ImageInterface<Float>& psf); 00085 void makeApproxPSF(PtrBlock<ImageInterface<Float> * >& psfs); 00086 00087 //Get the flux scale that the ftmachines have if they have 00088 virtual void getCoverageImage(Int model, ImageInterface<Float>& im); 00089 00090 //get the weight image from the ftmachines 00091 virtual void getWeightImage(const Int model, ImageInterface<Float>& weightim); 00092 void tmpWBNormalizeImage(Bool& dopsf, const Float& pbLimit); 00093 00094 Bool isNewFTM(); 00095 00096 protected: 00097 00098 void configureAsyncIo (ROVisibilityIterator * & oldRvi, VisibilityIterator * & oldWvi); 00099 00100 //Different versions of psf making 00101 void makeSimplePSF(PtrBlock<ImageInterface<Float> * >& psfs); 00102 void makeMosaicPSF(PtrBlock<ImageInterface<Float> * >& psfs); 00103 virtual void fixImageScale(); 00104 Block<CountedPtr<ImageInterface<Complex> > >imGetSlice_p; 00105 Block<CountedPtr<ImageInterface<Complex> > >imPutSlice_p; 00106 Block<Matrix<Float> >weightSlice_p; 00107 Slicer sl_p; 00108 Int nchanPerSlice_p; 00109 // Type of copy 00110 // 0 => a independent image just with coordinates gotten from cImage 00111 // 1 => a subImage referencing cImage ...no image copy 00112 void sliceCube(CountedPtr<ImageInterface<Complex> >& slice,Int model, Int cubeSlice, Int nCubeSlice, Int typeOfCopy=0); 00113 void sliceCube(SubImage<Float>*& slice,ImageInterface<Float>& image, Int cubeSlice, Int nCubeSlice); 00114 //frequency range from image 00115 Bool getFreqRange(ROVisibilityIterator& vi, const CoordinateSystem& coords, 00116 Int slice, Int nslice); 00117 00118 Bool isNewFTM(FTMachine *); 00119 private: 00120 // if skyjones changed in get or put we need to tell put or get respectively 00121 // about it 00122 void init(FTMachine& ft); 00123 00124 Bool destroyVisibilityIterator_p; 00125 00126 Bool internalChangesPut_p; 00127 Bool internalChangesGet_p; 00128 Bool firstOneChangesPut_p; 00129 Bool firstOneChangesGet_p; 00130 00131 Block< Vector<Int> >blockNumChanGroup_p, blockChanStart_p; 00132 Block< Vector<Int> > blockChanWidth_p, blockChanInc_p; 00133 Block<Vector<Int> > blockSpw_p; 00134 Block<CountedPtr<FTMachine> > ftm_p; 00135 Block<CountedPtr<FTMachine> > iftm_p; 00136 00137 // DT aInitGrad, aGetChanSel, aCheckVisRows, aGetFreq, aOrigChunks, aVBInValid, aInitGetSlice, aInitPutSlice, aPutSlice, aFinalizeGetSlice, aFinalizePutSlice, aChangeStokes, aInitModel, aGetSlice, aSetModel, aGetRes, aExtra; 00138 00139 00140 }; 00141 00142 } //# NAMESPACE CASA - ENDf 00143 00144 #endif