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 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 {
00047
00048 class MeasurementSet;
00049 template<class T> class ImageInterface;
00050 class SIIterBot;
00051 class VisImagingWeight;
00052
00053
00054 namespace refim {
00055
00056 class SynthesisImager
00057 {
00058 public:
00059
00060
00061 SynthesisImager();
00062 virtual ~SynthesisImager();
00063
00064
00065
00066
00067
00068 virtual Bool selectData(const SynthesisParamsSelect& selpars);
00069
00070
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
00091
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
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
00130 virtual Bool defineImage(CountedPtr<SIImageStore> imstor,
00131 const String& ftmachine);
00132
00133
00134
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
00150 void resetMappers();
00151
00152 CountedPtr<SIImageStore> imageStore(const Int id=0);
00153
00154
00155 void executeMajorCycle(Record& controls);
00156
00157
00158 void makePSF();
00159
00160 void predictModel();
00161
00162
00163
00164
00165
00166 protected:
00167
00169
00170
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
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
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
00257
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
00283
00284
00285
00286
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
00301
00302 refim::FTMachine::Type datacol_p;
00303
00304 };
00305
00306 }
00307 }
00308
00309 #endif