casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Go to the documentation of this file.
1 //# SynthesisImager.h: Imager functionality sits here;
2 //# Copyright (C) 2012-2013
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email:
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //#
25 //# $Id$
30 #include <casa/aips.h>
31 #include <casa/OS/Timer.h>
32 #include <casa/Containers/Record.h>
34 #include <casa/Arrays/IPosition.h>
35 #include <casa/Quanta/Quantum.h>
46 namespace casacore{
48 class MeasurementSet;
49 template<class T> class ImageInterface;
50 }
52 namespace casa { //# NAMESPACE CASA - BEGIN
54 // Forward declarations
55  class SIIterBot;
56  class VisImagingWeight;
58 // <summary> Class that contains functions needed for imager </summary>
61 {
62  public:
63  // Default constructor
66  virtual ~SynthesisImager();
68  // Copy constructor and assignment operator
69  //Imager(const Imager&);
70  //Imager& operator=(const Imager&);
72  virtual casacore::Bool selectData(const SynthesisParamsSelect& selpars);
75  // make all pure-inputs const
76  virtual casacore::Bool selectData(const casacore::String& msname,
77  const casacore::String& spw="*",
78  const casacore::String& freqBeg="",
79  const casacore::String& freqEnd="",
81  const casacore::String& field="*",
82  const casacore::String& antenna="",
83  const casacore::String& timestr="",
84  const casacore::String& scan="",
85  const casacore::String& obs="",
86  const casacore::String& state="",
87  const casacore::String& uvdist="",
88  const casacore::String& taql="",
89  const casacore::Bool usescratch=false,
90  const casacore::Bool readonly=false,
91  const casacore::Bool incrementModel=false);
93  virtual casacore::Bool defineImage(SynthesisParamsImage& impars, const SynthesisParamsGrid& gridpars);
95  //When having a facetted image with (facets > 1) first and once only ..
96  //Easier to keep track of the imstores that way
98  virtual casacore::Bool defineImage(const casacore::String& imagename, const casacore::Int nx, const casacore::Int ny,
99  const casacore::Quantity& cellx, const casacore::Quantity& celly,
100  const casacore::String& stokes,
101  const casacore::MDirection& phaseCenter,
102  const casacore::Int nchan,
103  const casacore::Quantity& freqStart,
104  const casacore::Quantity& freqStep,
105  const casacore::Vector<casacore::Quantity>& restFreq,
106  const casacore::Int facets=1,
107  // const casacore::Int chanchunks=1,
108  const casacore::String ftmachine="gridft",
109  const casacore::Int nTaylorTerms=1,
110  const casacore::Quantity& refFreq = casacore::Quantity(0,"Hz"),
112  const casacore::Quantity& distance=casacore::Quantity(0,"m"),
114  const casacore::Bool trackSource=false,
115  const casacore::MDirection& trackDir=casacore::MDirection(casacore::Quantity(0.0, "deg"), casacore::Quantity(90.0, "deg")),
116  const casacore::Bool overwrite=false,
117  const casacore::Float padding=1.0,
118  const casacore::Bool useAutocorr=false,
119  const bool useDoublePrec=true,
120  const casacore::Int wprojplanes=1,
121  const casacore::String convFunc="SF",
122  const casacore::String startmodel="",
123  // The extra params for WB-AWP
124  const casacore::Bool aTermOn = true,
125  const casacore::Bool psTermOn = true,
126  const casacore::Bool mTermOn = false,
127  const casacore::Bool wbAWP = true,
128  const casacore::String cfCache = "",
129  const casacore::Bool usePointing = false,
130  const casacore::Bool doPBCorr = true,
131  const casacore::Bool conjBeams = true,
132  const casacore::Float computePAStep=360.0,
133  const casacore::Float rotatePAStep=5.0
134  );
135  //Define image via a predefine SIImageStore object
137  const casacore::String& ftmachine);
142  //casacore::Function to tune the data selection to intersect with image definition chosen
143  //This is to optimize the data selection so that unnecessary data is not parsed despite the user
144  // deciding to select so.
145  // defineimage has to be run first (and thus selectData prior to that) otherwise an exception is thrown
148  //Defining componentlist to use while degriding
149  //This should be called once...if multiple lists are used..they can be merged in one
150  //if sdgrid=true then image plane degridding is done
152  virtual void setComponentList(const ComponentList& cl,
153  casacore::Bool sdgrid=false);
154  virtual casacore::Bool weight(const casacore::String& type="natural",
155  const casacore::String& rmode="norm",
156  const casacore::Quantity& noise=casacore::Quantity(0.0, "Jy"),
157  const casacore::Double robust=0.0,
158  const casacore::Quantity& fieldofview=casacore::Quantity(0.0, "arcsec"),
159  const casacore::Int npixels=0,
160  const casacore::Bool multiField=false,
161  const casacore::Bool usecubebriggs=false,
162  const casacore::String& filtertype=casacore::String("Gaussian"),
163  const casacore::Quantity& filterbmaj=casacore::Quantity(0.0,"deg"),
164  const casacore::Quantity& filterbmin=casacore::Quantity(0.0,"deg"),
165  const casacore::Quantity& filterbpa=casacore::Quantity(0.0,"deg") );
167  //Stores the weight density in an image. Returns the image name
169  //set the weight density to the visibility iterator
170  //the default is to set it from the imagestore griwt() image
171  //Otherwise it will use this image passed here; useful for parallelization to
172  //share one grid to all children process
175  //the following get rid of the mappers in this object
176  void resetMappers();
180  //casacore::Record getMajorCycleControls();
181  void executeMajorCycle(casacore::Record& controls);
183  // make the psf images i.e grid weight rather than data
184  void makePSF();
186  // Calculate apparent sensitivity (for _Visibility_ spectrum)
187  // _Image_ spectral grid TBD
188  // Throws an exception because not supported in old VI (see SynthesisImagerVi2)
191  virtual bool makePB();
193  virtual void predictModel();
194  virtual void makeSdImage(casacore::Bool dopsf=false);
200  //selected should be those that are pointed up with the antenna which is rastering.
201  virtual void makeImage(casacore::String type, const casacore::String& imagename, const casacore::String& complexImage=casacore::String(""), const Int whichModel=0);
203  /* Access method to the Loop Controller held in this class */
204  //SIIterBot& getLoopControls();
206  virtual void dryGridding(const casacore::Vector<casacore::String>& cfList);
207  virtual void fillCFCache(const casacore::Vector<casacore::String>& cfList, const casacore::String& ftmName, const casacore::String& cfcPath,
208  const casacore::Bool& psTermOn, const casacore::Bool& aTermOn, const casacore::Bool& conjBeams);
209  virtual void reloadCFCache();
216  void setMovingSource(const casacore::String& movsource);
218  virtual casacore::Long estimateRAM();
220 protected:
224  // Choose between different types of FTMs
227  const casacore::String& ftname,
228  const casacore::uInt nTaylorTerms=1,
229  const casacore::String mType="default",
230  const casacore::Int facets=1,
231  //------------------------------
232  const casacore::Int wprojplane=1,
233  const casacore::Float padding=1.0,
234  const casacore::Bool useAutocorr=false,
235  const casacore::Bool useDoublePrec=true,
236  const casacore::String gridFunction=casacore::String("SF"),
237  //------------------------------
238  const casacore::Bool aTermOn = true,
239  const casacore::Bool psTermOn = true,
240  const casacore::Bool mTermOn = false,
241  const casacore::Bool wbAWP = true,
242  const casacore::String cfCache = "",
243  const casacore::Bool usePointing = false,
244  const casacore::Bool doPBCorr = true,
245  const casacore::Bool conjBeams = true,
246  const casacore::Float computePAStep = 360.0,
247  const casacore::Float rotatePAStep = 5.0,
248  const casacore::String interpolation = casacore::String("linear"),
249  const casacore::Bool freqFrameValid = true,
250  const casacore::Int cache=1000000000,
251  const casacore::Int tile=16,
252  const casacore::String stokes="I",
253  const casacore::String imageNamePrefix="");
257  const casacore::Float padding,
258  const casacore::Bool useAutoCorr,
259  const casacore::Bool useDoublePrec,
260  const casacore::Float rotatePAStep,
261  const casacore::String Stokes="I",
262  const casacore::Bool doConjConvFunc=false
263  );
265  // Choose between different types of ImageStore types (single term, multiterm, faceted)
268  casacore::IPosition imShape,
269  const casacore::Bool overwrite,
270  casacore::ROMSColumns& msc,
271  casacore::String mappertype="default",
272  casacore::uInt ntaylorterms=1,
273  casacore::Quantity distance=casacore::Quantity(0.0, "m"),
274  casacore::uInt facets=1,
275  casacore::Bool useweightimage=false,
278  // Choose between different types of Mappers (single term, multiterm, imagemosaic, faceted)
283  casacore::uInt ntaylorterms=1);
287  casacore::Int facets);
288  // void setPsfFromOneFacet();
291  casacore::Int chanchunks);
295  virtual void createVisSet(const casacore::Bool writeaccess=false);
298  const casacore::String& ftmName,
299  const casacore::Int facets,
300  //----------------------------
301  const casacore::Int wprojPlane,
302  const casacore::Float padding,
303  const casacore::Bool useAutocorr,
304  const casacore::Bool useDoublePrec,
305  const casacore::String gridFunction,
306  //---------------------------
307  const casacore::Bool aTermOn,
308  const casacore::Bool psTermOn,
309  const casacore::Bool mTermOn,
310  const casacore::Bool wbAWP,
311  const casacore::String cfCache,
312  const casacore::Bool usePointing,
313  const casacore::Bool doPBCorr,
314  const casacore::Bool conjBeams,
315  const casacore::Float computePAStep,
316  const casacore::Float rotatePAStep,
317  const casacore::Int cache,
318  const casacore::Int tile,
319  const casacore::String imageNamePrefix="");
322  // Get VP record
325  // Do the major cycle
326  virtual void runMajorCycle(const casacore::Bool dopsf=false, const casacore::Bool savemodel=false);
328  // Version of major cycle code with mappers in a loop outside vi/vb.
329  virtual void runMajorCycle2(const casacore::Bool dopsf=false, const casacore::Bool savemodel=false);
335  // void appendToMapperList(casacore::String imagename, casacore::CoordinateSystem& csys, casacore::String ftmachine,
336  // casacore::Quantity distance=casacore::Quantity(0.0, "m"), casacore::Int facets=1, const casacore::Bool overwrite=false);
338  void appendToMapperList(casacore::String imagename,
340  casacore::IPosition imshape,
343  casacore::Quantity distance=casacore::Quantity(0.0, "m"),
344  casacore::Int facets=1,
345  casacore::Int chanchunks=1,
346  const casacore::Bool overwrite=false,
347  casacore::String mappertype=casacore::String("default"),
348  float padding=1.0,
349  casacore::uInt ntaylorterms=1,
352  virtual void unlockMSs();
354  bool makePBImage(const casacore::String& telescopeName,
355  bool useSymmetricBeam, double diam);
356  bool makePBImage(const casacore::String telescop);
357  virtual bool makePrimaryBeam(PBMath& pbMath);
360  virtual bool isSpectralCube();
377  bool itsMakeVP;
381  // casacore::Data Selection
383  // Image Definition
384  // Imaging/Gridding
388  //vi::FrequencySelections fselections_p;
389  //casacore::CountedPtr<vi::VisibilityIterator2> vi_p;
391  // Other Options
402  //the 'channel flags' to handle various channel selections in the spw parameter
413  //
414  // casacore::Bool freqFrameValid_p;
425 };
430 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
A Measure: astronomical direction.
Definition: MDirection.h:174
casacore::Block< casacore::Vector< casacore::Int > > blockStep_p
This enumeration provides a simple way to instantiate the common primary beam models.
Definition: PBMath.h:134
A 1-D Specialization of the Array class.
FTMachine::Type datacol_p
casacore::Bool freqFrameValid_p;
A Measure: position on Earth.
Definition: MPosition.h:79
const SynthesisParamsGrid & getSynthesisParamsGrid()
int Int
Definition: aipstype.h:50
casacore::CountedPtr< SIImageStore > unFacettedImStore_p
if facetting this storage will keep the unsliced version
virtual casacore::Long estimateRAM()
return an estimate of memory it is going to use in kB
Object to hold type of imaging weight scheme to be used on the fly and to provide facilities to do th...
casacore::Data Selection *casacore::Vector< SynthesisParamsSelect > dataSel_p
Geometric parameters needed for a sky projection to a plane.
Definition: Projection.h:95
void executeMajorCycle(casacore::Record &controls)
casacore::Record getMajorCycleControls();
casacore::Block< casacore::Vector< casacore::Int > > blockNChan_p
virtual void setComponentList(const ComponentList &cl, casacore::Bool sdgrid=false)
Defining componentlist to use while degriding This should be called once...if multiple lists are used...
void resetMappers()
the following get rid of the mappers in this object
casacore::Cube< casacore::Int > chanSel_p
the &#39;channel flags&#39; to handle various channel selections in the spw parameter
Stokes parameter definitions for interface to table data.
Definition: Stokes.h:51
casacore::IPosition itsMaxShape
casacore::Int updateNchan()
casacore::Int chanChunksStore_p
virtual Type type()
Return the type enum.
SynthesisParamsGrid gridpars_p
casacore::Bool imageDefined_p
virtual casacore::Vector< SynthesisParamsSelect > tuneSelectData()
casacore::Function to tune the data selection to intersect with image definition chosen This is to op...
void createMosFTMachine(casacore::CountedPtr< FTMachine > &theFT, casacore::CountedPtr< FTMachine > &theIFT, const casacore::Float padding, const casacore::Bool useAutoCorr, const casacore::Bool useDoublePrec, const casacore::Float rotatePAStep, const casacore::String Stokes="I", const casacore::Bool doConjConvFunc=false)
virtual casacore::Record apparentSensitivity()
Calculate apparent sensitivity (for Visibility spectrum) Image spectral grid TBD Throws an exception ...
Choose between different types of FTMs *void createFTMachine(casacore::CountedPtr< FTMachine > &theFT, casacore::CountedPtr< FTMachine > &theIFT, const casacore::String &ftname, const casacore::uInt nTaylorTerms=1, const casacore::String mType="default", const casacore::Int facets=1, const casacore::Int wprojplane=1, const casacore::Float padding=1.0, const casacore::Bool useAutocorr=false, const casacore::Bool useDoublePrec=true, const casacore::String gridFunction=casacore::String("SF"), const casacore::Bool aTermOn=true, const casacore::Bool psTermOn=true, const casacore::Bool mTermOn=false, const casacore::Bool wbAWP=true, const casacore::String cfCache="", const casacore::Bool usePointing=false, const casacore::Bool doPBCorr=true, const casacore::Bool conjBeams=true, const casacore::Float computePAStep=360.0, const casacore::Float rotatePAStep=5.0, const casacore::String interpolation=casacore::String("linear"), const casacore::Bool freqFrameValid=true, const casacore::Int cache=1000000000, const casacore::Int tile=16, const casacore::String stokes="I", const casacore::String imageNamePrefix="")
casacore::Block< casacore::CountedPtr< SIImageStore > > createFacetImageStoreList(casacore::CountedPtr< SIImageStore > imagestore, casacore::Int facets)
casacore::String getWeightDensity()
Stores the weight density in an image.
virtual casacore::Bool setWeightDensity(const casacore::String &imagename=casacore::String(""))
set the weight density to the visibility iterator the default is to set it from the imagestore griwt(...
casacore::CountedPtr< SIImageStore > unChanChunkedImStore_p
casacore::Record itsCsysRec
Primary beam envelope class, derived from PBMathInterface.
Definition: PBMath.h:126
Class that contains functions needed for imager.
casacore::Matrix< casacore::Double > mssFreqSel_p
VisImagingWeight imwgt_p
virtual void predictModel()
static casacore::String doubleToString(const casacore::Double &df)
virtual bool makePB()
casacore::MDirection phaseCenter_p
casacore::Block< casacore::CountedPtr< SIImageStore > > createChanChunkImageStoreList(casacore::CountedPtr< SIImageStore > imagestore, casacore::Int chanchunks)
void setPsfFromOneFacet();
virtual void makeSdImage(casacore::Bool dopsf=false)
Definition: Projection.h:107
void appendToMapperList(casacore::String imagename, casacore::CoordinateSystem &csys, casacore::String ftmachine, casacore::Quantity distance=casacore::Quantity(0.0,"m"), casacore::Int facets=1, const casacore::Bool overwrite=false)
It associated the ftmachine with a given field.
void createAWPFTMachine(casacore::CountedPtr< FTMachine > &theFT, casacore::CountedPtr< FTMachine > &theIFT, const casacore::String &ftmName, const casacore::Int facets, const casacore::Int wprojPlane, const casacore::Float padding, const casacore::Bool useAutocorr, const casacore::Bool useDoublePrec, const casacore::String gridFunction, const casacore::Bool aTermOn, const casacore::Bool psTermOn, const casacore::Bool mTermOn, const casacore::Bool wbAWP, const casacore::String cfCache, const casacore::Bool usePointing, const casacore::Bool doPBCorr, const casacore::Bool conjBeams, const casacore::Float computePAStep, const casacore::Float rotatePAStep, const casacore::Int cache, const casacore::Int tile, const casacore::String imageNamePrefix="")
casacore::Bool useViVb2_p
vi::FrequencySelections fselections_p; casacore::CountedPtr&lt;vi::VisibilityIterator2&gt; vi_p; ...
casacore::Int nMajorCycles
casacore::MPosition mLocation_p
ROVisibilityIterator * rvi_p
long Long
Definition: aipstype.h:52
void getVPRecord(casacore::Record &rec, PBMath::CommonPB &kpb, casacore::String telescop)
Get VP record.
Default constructor.
casacore::CountedPtr< SIMapper > createSIMapper(casacore::String mappertype, casacore::CountedPtr< SIImageStore > imagestore, casacore::CountedPtr< FTMachine > ftmachine, casacore::CountedPtr< FTMachine > iftmachine, casacore::uInt ntaylorterms=1)
Choose between different types of Mappers (single term, multiterm, imagemosaic, faceted) ...
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
A base class for astronomical images.
casacore::Record getcsys()
bool makePBImage(const casacore::String &telescopeName, bool useSymmetricBeam, double diam)
virtual void runMajorCycle(const casacore::Bool dopsf=false, const casacore::Bool savemodel=false)
Do the major cycle.
VisibilityIterator * wvi_p
virtual void createVisSet(const casacore::Bool writeaccess=false)
double Double
Definition: aipstype.h:55
void makePSF()
make the psf images i.e grid weight rather than data
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
virtual ~SynthesisImager()
casacore::Block< casacore::MeasurementSet > mss4vi_p
virtual casacore::Bool selectData(const SynthesisParamsSelect &selpars)
Copy constructor and assignment operator Imager(const Imager&amp;); Imager&amp; operator=(const Imager&amp;); ...
casacore::Bool writeAccess_p
Types of known Images that may be made using the makeImage method.
Definition: FTMachine.h:125
ATerm * createTelescopeATerm(const casacore::MeasurementSet &ms, const casacore::Bool &isATermOn)
casacore::Block< casacore::Vector< casacore::Int > > blockStart_p
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
casacore::Int facetsStore_p
casacore::CoordinateSystem itsMaxCoordSys
casacore::Block< casacore::Vector< casacore::Int > > blockSpw_p
A Table intended to hold astronomical data (a set of Measurements).
simple 1-D array
SynthesisParamsImage impars_p
virtual void makeImage(casacore::String type, const casacore::String &imagename, const casacore::String &complexImage=casacore::String(""), const Int whichModel=0)
This should replace makeSDImage and makePSF etc in the long run But for now you can do the following ...
void setMovingSource(const casacore::String &movsource)
This will set the movingSource_p.
A class for manipulating groups of components.
casacore::String itsVpTable
casacore::CountedPtr< SIImageStore > imageStore(const casacore::Int id=0)
virtual void reloadCFCache()
The base class to represent the Aperture-Term of the Measurement Equation.
Definition: ATerm.h:63
virtual bool makePrimaryBeam(PBMath &pbMath)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
const SynthesisParamsImage & getSynthesisParamsImage()
VisibilityIterator iterates through one or more writable MeasurementSets.
virtual casacore::Bool defineImage(SynthesisParamsImage &impars, const SynthesisParamsGrid &gridpars)
virtual void dryGridding(const casacore::Vector< casacore::String > &cfList)
SIIterBot&amp; getLoopControls();.
casacore::Bool readOnly_p
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
virtual bool isSpectralCube()
is any of the images defined spectral cube
virtual void unlockMSs()
casacore::Bool itsDataLoopPerMapper
casacore::Bool useScratch_p
*SIMapperCollection itsMappers
casacore::CountedPtr< SIImageStore > createIMStore(casacore::String imageName, casacore::CoordinateSystem &cSys, casacore::IPosition imShape, const casacore::Bool overwrite, casacore::ROMSColumns &msc, casacore::String mappertype="default", casacore::uInt ntaylorterms=1, casacore::Quantity distance=casacore::Quantity(0.0,"m"), casacore::uInt facets=1, casacore::Bool useweightimage=false, casacore::Vector< casacore::String > startmodel=casacore::Vector< casacore::String >(0))
Choose between different types of ImageStore types (single term, multiterm, faceted) ...
Interconvert pixel and world coordinates.
virtual void runMajorCycle2(const casacore::Bool dopsf=false, const casacore::Bool savemodel=false)
Version of major cycle code with mappers in a loop outside vi/vb.
unsigned int uInt
Definition: aipstype.h:51
casacore::Block< const casacore::MeasurementSet * > mss_p
Image Definition Imaging/Gridding.
virtual void fillCFCache(const casacore::Vector< casacore::String > &cfList, const casacore::String &ftmName, const casacore::String &cfcPath, const casacore::Bool &psTermOn, const casacore::Bool &aTermOn, const casacore::Bool &conjBeams)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
virtual casacore::Bool weight(const casacore::String &type="natural", const casacore::String &rmode="norm", const casacore::Quantity &noise=casacore::Quantity(0.0,"Jy"), const casacore::Double robust=0.0, const casacore::Quantity &fieldofview=casacore::Quantity(0.0,"arcsec"), const casacore::Int npixels=0, const casacore::Bool multiField=false, const casacore::Bool usecubebriggs=false, const casacore::String &filtertype=casacore::String("Gaussian"), const casacore::Quantity &filterbmaj=casacore::Quantity(0.0,"deg"), const casacore::Quantity &filterbmin=casacore::Quantity(0.0,"deg"), const casacore::Quantity &filterbpa=casacore::Quantity(0.0,"deg"))
casacore::Bool toUseWeightImage(casacore::CountedPtr< FTMachine > &ftm, casacore::String mappertype)