casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiTermFTNew.h
Go to the documentation of this file.
1 //# NewMultiTermFT.h: Definition for NewMultiTermFT
2 //# Copyright (C) 1996,1997,1998,1999,2000,2002
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 adressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef SYNTHESIS_MULTITERMFTNEW_H
30 #define SYNTHESIS_MULTITERMFTNEW_H
31 
33 #include <casa/Arrays/Matrix.h>
35 #include <msvis/MSVis/VisBuffer.h>
38 #include <casa/Containers/Block.h>
39 #include <casa/Arrays/Array.h>
40 #include <casa/Arrays/Vector.h>
41 #include <casa/Arrays/Matrix.h>
45 //#include <synthesis/MeasurementComponents/SynthesisPeek.h>
46 #include <casa/OS/Timer.h>
47 
48 namespace casacore{
49 
50 class UVWMachine;
51 }
52 
53 namespace casa { //# NAMESPACE CASA - BEGIN
54 
55 
56 class MultiTermFTNew : public FTMachine {
57 public:
58 
59  // Construct using an existing FT-Machine
61 
62  // Construct from a casacore::Record containing the MultiTermFTNew state
64 
65  // Copy constructor.
66  // This first calls the default "=" operator, and then instantiates objects for member pointers.
67  MultiTermFTNew(const MultiTermFTNew &other);
68 
69  // Assignment operator --- leave it as the default
71 
72  // Destructor
74 
75  // Called at the start of de-gridding : subftm->initializeToVis()
76  // Note : Pre-de-gridding model-image divisions by PBs will go here.
78  const VisBuffer& /*vb*/)
79  {throw(casacore::AipsError("MultiTermFTNew::initializeToVis called without vectors !"));};
80 
81  // Vectorized InitializeToVis
82  // void initializeToVis(casacore::Block<casacore::CountedPtr<casacore::ImageInterface<casacore::Complex> > > & compImageVec,casacore::PtrBlock<casacore::SubImage<casacore::Float> *> & modelImageVec, casacore::PtrBlock<casacore::SubImage<casacore::Float> *>& weightImageVec, casacore::PtrBlock<casacore::SubImage<casacore::Float> *>& fluxScaleVec, casacore::Block<casacore::Matrix<casacore::Float> >& weightsVec, const VisBuffer& vb);
83 
84  virtual void initializeToVisNew(const VisBuffer& vb,
86 
87  // Called at the end of de-gridding : subftm->finalizeToVis()
88  void finalizeToVis();
89 
90  // Called at the start of gridding : subftm->initializeToSky()
92  casacore::Matrix<casacore::Float>& /*weight*/, const VisBuffer& /*vb*/)
93  {throw(casacore::AipsError("MultiTermFTNew::initializeToSky() called without vectors!"));};
94 
95  // void initializeToSky(casacore::Block<casacore::CountedPtr<casacore::ImageInterface<casacore::Complex> > > & compImageVec, casacore::Block<casacore::Matrix<casacore::Float> >& weightsVec, const VisBuffer& vb, const casacore::Bool dopsf);
96 
97  virtual void initializeToSkyNew(const casacore::Bool dopsf,
98  const VisBuffer& vb,
100 
101 
102  // Called at the end of gridding : subftm->finalizeToSky()
103  void finalizeToSky(){throw(casacore::AipsError("MultiTermFTNew::finalizeToSky() called without arguments!"));};
104 
105  //void finalizeToSky(casacore::Block<casacore::CountedPtr<casacore::ImageInterface<casacore::Complex> > > & compImageVec, casacore::PtrBlock<casacore::SubImage<casacore::Float> *> & resImageVec, casacore::PtrBlock<casacore::SubImage<casacore::Float> *>& weightImageVec, casacore::PtrBlock<casacore::SubImage<casacore::Float> *>& fluxScaleVec, casacore::Bool dopsf, casacore::Block<casacore::Matrix<casacore::Float> >& weightsVec, const VisBuffer& vb);
106 
107  virtual void finalizeToSkyNew(casacore::Bool dopsf,
108  const VisBuffer& vb,
110 
111  // void normalizeToSky(casacore::ImageInterface<casacore::Complex>& compImage, casacore::ImageInterface<casacore::Float>& resImage, casacore::ImageInterface<casacore::Float>& weightImage, casacore::Bool dopsf, casacore::Matrix<casacore::Float>& weights)
112  // {throw(casacore::AipsError("MultiTermFTNew::normalizeToSky should not get called !"));};
113 
114 
115  // Do the degridding via subftm->get() and modify model-visibilities by Taylor-weights
116  void get(VisBuffer& vb, casacore::Int row=-1);
117 
118  // Modify imaging weights with Taylor-weights and do gridding via subftm->put()
119  void put(VisBuffer& vb, casacore::Int row=-1, casacore::Bool dopsf=false,
121 
122  // Have a const version for compatibility with other FTMs.. Throw an exception if called.
123  void put(const VisBuffer& /*vb*/, casacore::Int /*row*/=-1, casacore::Bool /*dopsf*/=false,
125  {throw(casacore::AipsError("MultiTermFTNew::put called with a const vb. This FTM needs to modify the vb."));};
126 
127  // Calculate residual visibilities if possible.
128  // The purpose is to allow rGridFT to make this multi-threaded
129  virtual void ComputeResiduals(VisBuffer&vb, casacore::Bool useCorrected);
130 
131  // Make an image : subftm->makeImage()
133  VisSet& vs,
136 
137  // Get the final image: do the Fourier transform grid-correct, then
138  // optionally normalize by the summed weights
139  // Note : Post-gridding residual-image divisions by PBs will go here.
140  // For now, it just calls subftm->getImage()
141  // casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>& weights, casacore::Bool normalize=true)
142  //{return getImage(weights,normalize,0);};
143  //casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>& weights, casacore::Bool normalize=true,
144  // const casacore::Int taylorindex=0);
146  {throw(casacore::AipsError("MultiTermFTNew::getImage() should not be called"));}
147 
149  {AlwaysAssert(subftms_p.nelements()>0,casacore::AipsError); return subftms_p[0]->useWeightImage(); };
150 
152  {AlwaysAssert(subftms_p.nelements()>0,casacore::AipsError);
153  subftms_p[0]->getWeightImage(weightImage, weights);}
154  // {throw(casacore::AipsError("MultiTermFTNew::getWeightImage() should not be called"));}
155 
156  // Save and restore the MultiTermFTNew to and from a record
157  virtual casacore::Bool toRecord(casacore::String& error, casacore::RecordInterface& outRec, casacore::Bool withImage=false,
158  const casacore::String diskimage="");
160 
161  // Various small inline functions
162  virtual casacore::Bool isFourier() {return true;}
163  virtual void setNoPadding(casacore::Bool nopad){subftms_p[0]->setNoPadding(nopad);};
164  virtual casacore::String name()const {return machineName_p;};
165  virtual void setMiscInfo(const casacore::Int qualifier){(void)qualifier;};
166 
168  {
169  cout << "** Number of FTs : " << subftms_p.nelements() << " -- " ;
170  for(casacore::uInt tix=0; tix<(subftms_p).nelements(); tix++)
171  cout << tix << " : " << (subftms_p[tix])->name() << " " ;
172  cout << endl;
173  };
174 
175  FTMachine* cloneFTM();
176  virtual void setDryRun(casacore::Bool val)
177  {
178  isDryRun=val;
179  //cerr << "MTFTMN: " << isDryRun << endl;
180  for (casacore::uInt i=0;i<subftms_p.nelements();i++)
181  subftms_p[i]->setDryRun(val);
182  };
183  virtual casacore::Bool isUsingCFCache() {casacore::Bool v=false; if (subftms_p.nelements() > 0) v=subftms_p[0]->isUsingCFCache(); return v;};
184 
185 protected:
186  // have to call the initmaps of subftm
187  virtual void initMaps(const VisBuffer& vb);
188  // Instantiate a new sub FTM
190 
191  // Multiply Imaging weights by Taylor-function weights - during "put"
193  // Multiply model visibilities by Taylor-function weights - during "get"
195  // Restore vb.imagingweights to the original
197 
198  // Helper function to write ImageInterfaces to disk
200 
201 
203 
209 
210  // casacore::Bool donePSF_p;
211 
213 
214 };
215 
216 } //# NAMESPACE CASA - END
217 
218 #endif
void put(VisBuffer &vb, casacore::Int row=-1, casacore::Bool dopsf=false, FTMachine::Type type=FTMachine::OBSERVED)
Modify imaging weights with Taylor-weights and do gridding via subftm-&gt;put()
virtual casacore::Bool useWeightImage()
All FTMachines that fill weightimage, need to set this.
int Int
Definition: aipstype.h:50
void makeImage(FTMachine::Type type, VisSet &vs, casacore::ImageInterface< casacore::Complex > &image, casacore::Matrix< casacore::Float > &weight)
Make an image : subftm-&gt;makeImage()
casacore::Block< casacore::CountedPtr< FTMachine > > subftms_p
casacore::Bool donePSF_p;
New MTFT specific internal parameters and functions *casacore::uInt psfnterms_p
virtual void setMiscInfo(const casacore::Int qualifier)
set the order of the Taylor term for MFS this is to tell A-casacore::Projection to qualify the accumu...
casacore::Matrix< casacore::Float > imweights_p
virtual void ComputeResiduals(VisBuffer &vb, casacore::Bool useCorrected)
Calculate residual visibilities if possible.
casacore::Bool storeAsImg(casacore::String fileName, casacore::ImageInterface< casacore::Float > &theImg)
Helper function to write ImageInterfaces to disk.
virtual Type type()
Return the type enum.
void put(const VisBuffer &, casacore::Int=-1, casacore::Bool=false, FTMachine::Type=FTMachine::OBSERVED)
Have a const version for compatibility with other FTMs.
virtual void initializeToVisNew(const VisBuffer &vb, casacore::CountedPtr< SIImageStore > imstore)
Vectorized InitializeToVis void initializeToVis(casacore::Block&lt;casacore::CountedPtr&lt;casacore::ImageI...
virtual void setNoPadding(casacore::Bool nopad)
To make sure no padding is used in certain gridders.
void restoreImagingWeights(VisBuffer &vb)
Restore vb.imagingweights to the original.
casacore::ImageInterface< casacore::Complex > * image
Definition: FTMachine.h:409
virtual void initializeToSkyNew(const casacore::Bool dopsf, const VisBuffer &vb, casacore::CountedPtr< SIImageStore > imstore)
void initializeToSky(casacore::Block&lt;casacore::CountedPtr&lt;casacore::ImageInterface&lt;casacore::Complex&gt;...
~MultiTermFTNew()
Destructor.
casacore::Bool modifyVisWeights(VisBuffer &vb, casacore::uInt thisterm)
Multiply Imaging weights by Taylor-function weights - during &quot;put&quot;.
void getWeightImage(casacore::ImageInterface< casacore::Float > &weightImage, casacore::Matrix< casacore::Float > &weights)
Get the final weights image.
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
casacore::CountedPtr< FTMachine > getNewFTM(const casacore::CountedPtr< FTMachine > &ftm)
Instantiate a new sub FTM.
virtual void finalizeToSkyNew(casacore::Bool dopsf, const VisBuffer &vb, casacore::CountedPtr< SIImageStore > imstore)
void finalizeToSky(casacore::Block&lt;casacore::CountedPtr&lt;casacore::ImageInterface&lt;casacore::Complex&gt; &gt;...
virtual casacore::Bool toRecord(casacore::String &error, casacore::RecordInterface &outRec, casacore::Bool withImage=false, const casacore::String diskimage="")
{throw(casacore::AipsError(&quot;MultiTermFTNew::getWeightImage() should not be called&quot;));} ...
double Double
Definition: aipstype.h:55
FTMachine * cloneFTM()
clone copy the default cloner clones via a Record copy
casacore::Double reffreq_p
LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
Type
Types of known Images that may be made using the makeImage method.
Definition: FTMachine.h:125
Converts UVW coordinates between coordinate systems.
Definition: UVWMachine.h:160
#define AlwaysAssert(expr, exception)
These marcos are provided for use instead of simply using the constructors of assert_ to allow additi...
Definition: Assert.h:157
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void setDryRun(casacore::Bool val)
void initializeToSky(casacore::ImageInterface< casacore::Complex > &, casacore::Matrix< casacore::Float > &, const VisBuffer &)
Called at the start of gridding : subftm-&gt;initializeToSky()
New MTFT specific internal parameters and functions *casacore::uInt nterms_p
virtual casacore::Bool fromRecord(casacore::String &error, const casacore::RecordInterface &inRec)
simple 1-D array
void initializeToVis(casacore::ImageInterface< casacore::Complex > &, const VisBuffer &)
Called at the start of de-gridding : subftm-&gt;initializeToVis() Note : Pre-de-gridding model-image div...
casacore::Bool modifyModelVis(VisBuffer &vb, casacore::uInt thisterm)
Multiply model visibilities by Taylor-function weights - during &quot;get&quot;.
virtual casacore::Bool isFourier()
Various small inline functions.
Base class for all Casacore library errors.
Definition: Error.h:134
virtual void initMaps(const VisBuffer &vb)
have to call the initmaps of subftm
virtual casacore::Bool isUsingCFCache()
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::String machineName_p
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
casacore::ImageInterface< casacore::Complex > & getImage(casacore::Matrix< casacore::Float > &, casacore::Bool=true)
Get the final image: do the Fourier transform grid-correct, then optionally normalize by the summed w...
MultiTermFTNew(casacore::CountedPtr< FTMachine > &subftm, casacore::Int nterms=1, casacore::Bool forward=false)
Construct using an existing FT-Machine.
Abstract base class for Record classes.
casacore::Bool isDryRun
Definition: FTMachine.h:398
casacore::Cube< casacore::Complex > modviscube_p
virtual casacore::String name() const
Return the name of the machine.
void finalizeToSky()
Called at the end of gridding : subftm-&gt;finalizeToSky()
unsigned int uInt
Definition: aipstype.h:51
defines interface for the Fourier Transform Machine
Definition: FTMachine.h:120
MultiTermFTNew & operator=(const MultiTermFTNew &other)
Assignment operator — leave it as the default.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
void finalizeToVis()
Called at the end of de-gridding : subftm-&gt;finalizeToVis()