casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NewMultiTermFT.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_NEWMULTITERMFT_H
30 #define SYNTHESIS_NEWMULTITERMFT_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 NewMultiTermFT : public FTMachine {
57 public:
58 
59  // Construct using an existing FT-Machine
60  NewMultiTermFT(FTMachine *subftm, casacore::Int nterms=1, casacore::Double reffreq=0.0);
61 
62  // Construct from a casacore::Record containing the NewMultiTermFT state
64 
65  // Copy constructor.
66  // This first calls the default "=" operator, and then instantiates objects for member pointers.
67  NewMultiTermFT(const NewMultiTermFT &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("NewMultiTermFT::initializeToVis called without vectors !"));};
80 
81  // Vectorized InitializeToVis
83 
84  // Called at the end of de-gridding : subftm->finalizeToVis()
85  void finalizeToVis();
86 
87  // Called at the start of gridding : subftm->initializeToSky()
89  casacore::Matrix<casacore::Float>& /*weight*/, const VisBuffer& /*vb*/)
90  {throw(casacore::AipsError("NewMultiTermFT::initializeToSky() called without vectors!"));};
91 
93 
94 
95  // Called at the end of gridding : subftm->finalizeToSky()
96  void finalizeToSky(){throw(casacore::AipsError("NewMultiTermFT::finalizeToSky() called without arguments!"));};
97 
99 
100  // 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)
101  // {throw(casacore::AipsError("NewMultiTermFT::normalizeToSky should not get called !"));};
102 
103 
104  // Do the degridding via subftm->get() and modify model-visibilities by Taylor-weights
105  void get(VisBuffer& vb, casacore::Int row=-1);
106 
107  // Modify imaging weights with Taylor-weights and do gridding via subftm->put()
108  void put(VisBuffer& vb, casacore::Int row=-1, casacore::Bool dopsf=false,
110 
111  // Have a const version for compatibility with other FTMs.. Throw an exception if called.
112  void put(const VisBuffer& /*vb*/, casacore::Int /*row*/=-1, casacore::Bool /*dopsf*/=false,
114  {throw(casacore::AipsError("NewMultiTermFT::put called with a const vb. This FTM needs to modify the vb."));};
115 
116  // Calculate residual visibilities if possible.
117  // The purpose is to allow rGridFT to make this multi-threaded
118  virtual void ComputeResiduals(VisBuffer&vb, casacore::Bool useCorrected);
119 
120  // Make an image : subftm->makeImage()
122  VisSet& vs,
125 
126  // Get the final image: do the Fourier transform grid-correct, then
127  // optionally normalize by the summed weights
128  // Note : Post-gridding residual-image divisions by PBs will go here.
129  // For now, it just calls subftm->getImage()
130  // casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>& weights, casacore::Bool normalize=true)
131  //{return getImage(weights,normalize,0);};
132  //casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>& weights, casacore::Bool normalize=true,
133  // const casacore::Int taylorindex=0);
135  {throw(casacore::AipsError("NewMultiTermFT::getImage() should not be called"));}
136 
137 
138  // Place-holder for possible use with AWProject and AWProjectWB FTMs
139  /*
140  virtual void normalizeImage(casacore::Lattice<casacore::Complex>& skyImage,
141  const casacore::Matrix<casacore::Double>& sumOfWts,
142  casacore::Lattice<casacore::Float>& sensitivityImage,
143  casacore::Bool fftNorm)
144  {throw(casacore::AipsError("NewMultiTermFT::normalizeImage() is not implemented"));}
145  */
146  // Get the final weights image - this will hold PB2
147  //void getWeightImage(casacore::ImageInterface<casacore::Float>& weightImage, casacore::Matrix<casacore::Float>& weights)
148  //{getWeightImage(weightImage, weights, 0);};
149  //void getWeightImage(casacore::ImageInterface<casacore::Float>& weightImage, casacore::Matrix<casacore::Float>& weights,
150  // const casacore::Int taylorindex);
152  {subftms_p[0]->getWeightImage(weightImage, weights);}
153  // {throw(casacore::AipsError("NewMultiTermFT::getWeightImage() should not be called"));}
154 
155  // Save and restore the NewMultiTermFT to and from a record
156  virtual casacore::Bool toRecord(casacore::String& error, casacore::RecordInterface& outRec, casacore::Bool withImage=false,
157  const casacore::String diskimage="");
159 
160  // Various small inline functions
161  virtual casacore::Bool isFourier() {return true;}
162  virtual void setNoPadding(casacore::Bool nopad){subftms_p[0]->setNoPadding(nopad);};
163  virtual casacore::String name()const {return machineName_p;};
164  virtual void setMiscInfo(const casacore::Int qualifier){(void)qualifier;};
165 
167  {
168  cout << "** Number of FTs : " << subftms_p.nelements() << " -- " ;
169  for(casacore::uInt tix=0; tix<(subftms_p).nelements(); tix++)
170  cout << tix << " : " << (subftms_p[tix])->name() << " " ;
171  cout << endl;
172  };
173 
176  virtual void setConjBeams(casacore::Bool useit=true) {useConjBeams_p=useit;};
178 
179 
180 protected:
181 
182  // Instantiate a new sub FTM
183  FTMachine* getNewFTM(const FTMachine *ftm);
184 
185  // Multiply Imaging weights by Taylor-function weights - during "put"
187  // Multiply model visibilities by Taylor-function weights - during "get"
189  // Restore vb.imagingweights to the original
191 
192  // Use sumwts to make a Hessian, invert it, apply to weight images, fill in pbcoeffs_p
195  // Make pixel-by-pixel matrices from pbcoeffs, invert, apply to residuals
196  // void normalizeWideBandPB2(casacore::PtrBlock<casacore::SubImage<casacore::Float> *> & resImageVec);
197  // void normalizeWideBandPB(casacore::PtrBlock<casacore::SubImage<casacore::Float> *> & resImageVec, casacore::PtrBlock<casacore::SubImage<casacore::Float> *>& scratchImageVec);
199 
202 
203  // Helper function to write ImageInterfaces to disk
205 
206 
208 
220 
223 
225  casacore::Matrix<casacore::Double> hess_p, invhess_p; // casacore::Block is for the pol axis
226 
229 
233 };
234 
235 } //# NAMESPACE CASA - END
236 
237 #endif
casacore::Bool useConjBeams_p
virtual casacore::Bool toRecord(casacore::String &error, casacore::RecordInterface &outRec, casacore::Bool withImage=false, const casacore::String diskimage="")
{throw(casacore::AipsError(&quot;NewMultiTermFT::getWeightImage() should not be called&quot;));} ...
casacore::Bool modifyVisWeights(VisBuffer &vb, casacore::uInt thisterm)
Multiply Imaging weights by Taylor-function weights - during &quot;put&quot;.
casacore::String machineName_p
int Int
Definition: aipstype.h:50
casacore::Bool donePSF_p
casacore::Bool storeAsImg(casacore::String fileName, casacore::ImageInterface< casacore::Float > &theImg)
Helper function to write ImageInterfaces to disk.
void makeImage(FTMachine::Type type, VisSet &vs, casacore::ImageInterface< casacore::Complex > &image, casacore::Matrix< casacore::Float > &weight)
Make an image : subftm-&gt;makeImage()
casacore::Bool donePBTaylor_p
FTMachine * getNewFTM(const FTMachine *ftm)
Instantiate a new sub FTM.
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()
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...
virtual Type type()
Return the type enum.
casacore::Double time_res
casacore::String cacheDir_p
NewMultiTermFT(FTMachine *subftm, casacore::Int nterms=1, casacore::Double reffreq=0.0)
Construct using an existing FT-Machine.
NewMultiTermFT & operator=(const NewMultiTermFT &other)
Assignment operator — leave it as the default.
casacore::Bool modifyModelVis(VisBuffer &vb, casacore::uInt thisterm)
Multiply model visibilities by Taylor-function weights - during &quot;get&quot;.
casacore::ImageInterface< casacore::Complex > * image
Definition: FTMachine.h:409
void restoreImagingWeights(VisBuffer &vb)
Restore vb.imagingweights to the original.
casacore::Cube< casacore::Complex > modviscube_p
virtual casacore::Bool isFourier()
Various small inline functions.
void finalizeToSky()
Called at the end of gridding : subftm-&gt;finalizeToSky()
virtual void setDOPBCorrection(casacore::Bool doit=true)
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...
casacore::Double time_get
void normAvgPBs(casacore::PtrBlock< casacore::SubImage< casacore::Float > * > &weightImageVec)
Use sumwts to make a Hessian, invert it, apply to weight images, fill in pbcoeffs_p.
casacore::Bool doingPSF_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...
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
double Double
Definition: aipstype.h:55
void calculateTaylorPBs(casacore::PtrBlock< casacore::SubImage< casacore::Float > * > &weightImageVec)
New MTFT specific internal parameters and functions *casacore::uInt nterms_p
void finalizeToVis()
Called at the end of de-gridding : subftm-&gt;finalizeToVis()
LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
casacore::PtrBlock< casacore::SubImage< casacore::Float > * > pbcoeffs_p
Type
Types of known Images that may be made using the makeImage method.
Definition: FTMachine.h:125
void put(const VisBuffer &, casacore::Int=-1, casacore::Bool=false, FTMachine::Type=FTMachine::OBSERVED)
Have a const version for compatibility with other FTMs.
Converts UVW coordinates between coordinate systems.
Definition: UVWMachine.h:160
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Bool dotime_p
measure the time it takes to execute parts of a program
Definition: Timer.h:127
float Float
Definition: aipstype.h:54
casacore::Block< casacore::CountedPtr< casacore::ImageInterface< casacore::Float > > > sensitivitymaps_p
virtual casacore::Bool getDOPBCorrection()
A (masked) subset of an ImageInterface object.
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
casacore::Bool dbg_p
casacore::Float pblimit_p
virtual casacore::Bool getConjBeams()
casacore::Double reffreq_p
simple 1-D array
casacore::Bool doWideBandPBCorrection_p
casacore::Matrix< casacore::Double > invhess_p
virtual casacore::String name() const
Return the name of the machine.
Base class for all Casacore library errors.
Definition: Error.h:134
void multiplyHMatrix(casacore::Matrix< casacore::Double > &hmat, casacore::PtrBlock< casacore::SubImage< casacore::Float > * > &invec, casacore::PtrBlock< casacore::SubImage< casacore::Float > * > &outvec, casacore::String saveImagePrefix)
casacore::Matrix< casacore::Double > hess_p
virtual void ComputeResiduals(VisBuffer &vb, casacore::Bool useCorrected)
Calculate residual visibilities if possible.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Timer tmr_p
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
casacore::Double sumwt_p
casacore::Double time_put
void getWeightImage(casacore::ImageInterface< casacore::Float > &weightImage, casacore::Matrix< casacore::Float > &weights)
Place-holder for possible use with AWProject and AWProjectWB FTMs.
virtual casacore::Bool fromRecord(casacore::String &error, const casacore::RecordInterface &inRec)
void applyWideBandPB(casacore::String action, casacore::PtrBlock< casacore::SubImage< casacore::Float > * > &imageVec)
Make pixel-by-pixel matrices from pbcoeffs, invert, apply to residuals void normalizeWideBandPB2(casa...
casacore::Matrix< casacore::Float > imweights_p
Abstract base class for Record classes.
virtual void setConjBeams(casacore::Bool useit=true)
void initializeToSky(casacore::ImageInterface< casacore::Complex > &, casacore::Matrix< casacore::Float > &, const VisBuffer &)
Called at the start of gridding : subftm-&gt;initializeToSky()
casacore::Block< casacore::CountedPtr< FTMachine > > subftms_p
casacore::Block< casacore::Matrix< casacore::Float > > sumweights_p
~NewMultiTermFT()
Destructor.
unsigned int uInt
Definition: aipstype.h:51
defines interface for the Fourier Transform Machine
Definition: FTMachine.h:120
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
virtual void setNoPadding(casacore::Bool nopad)
To make sure no padding is used in certain gridders.