An FTMachine for Gridded Fourier transforms. More...
#include <WProjectFT.h>
Public Member Functions | |
WProjectFT (Int nFacets, Long cachesize, Int tilesize=16, Bool usezero=True, Bool useDoublePrec=False, const Double minW=-1.0, const Double maxW=-1.0, const Double rmsW=-1.0) | |
Constructor: cachesize is the size of the cache in words (e.g. | |
WProjectFT (Int nFacets, MPosition mLocation, Long cachesize, Int tilesize=16, Bool usezero=True, Float padding=1.0, Bool useDoublePrec=False, const Double minW=-1.0, const Double maxW=-1.0, const Double rmsW=-1.0) | |
Constructor without tangent direction. | |
WProjectFT (Int nFacets, MDirection mTangent, MPosition mLocation, Long cachesize, Int tilesize=16, Bool usezero=True, Float padding=1.0, Bool useDoublePrec=False, const Double minW=-1.0, const Double maxW=-1.0, const Double rmsW=-1.0) | |
Deprecated no longer need ms in constructor. | |
WProjectFT (const RecordInterface &stateRec) | |
Construct from a Record containing the WProjectFT state. | |
WProjectFT (const WProjectFT &other) | |
Copy constructor. | |
WProjectFT & | operator= (const WProjectFT &other) |
Assignment operator. | |
~WProjectFT () | |
virtual FTMachine * | cloneFTM () |
clone to FTMachine pointer | |
void | initializeToVis (ImageInterface< Complex > &image, const VisBuffer &vb) |
Initialize transform to Visibility plane using the image as a template. | |
void | finalizeToVis () |
This version returns the gridded vis...should be used in conjunction. | |
void | initializeToSky (ImageInterface< Complex > &image, Matrix< Float > &weight, const VisBuffer &vb) |
Initialize transform to Sky plane: initializes the image. | |
void | finalizeToSky () |
Finalize transform to Sky plane: flushes the image cache and shows statistics if it is being used. | |
void | get (VisBuffer &vb, Int row=-1) |
Get actual coherence from grid by degridding. | |
void | put (const VisBuffer &vb, Int row=-1, Bool dopsf=False, FTMachine::Type type=FTMachine::OBSERVED) |
Put coherence to grid by gridding. | |
void | makeImage (FTMachine::Type type, VisSet &vs, ImageInterface< Complex > &image, Matrix< Float > &weight) |
Make the entire image. | |
ImageInterface< Complex > & | getImage (Matrix< Float > &, Bool normalize=True) |
Get the final image: do the Fourier transform and grid-correct, then optionally normalize by the summed weights. | |
virtual void | normalizeImage (Lattice< Complex > &, const Matrix< Double > &, Lattice< Float > &, Bool) |
void | getWeightImage (ImageInterface< Float > &, Matrix< Float > &) |
Get the final weights image. | |
Bool | toRecord (String &error, RecordInterface &outRec, Bool withImage=False, const String diskimage="") |
Save and restore the WProjectFT to and from a record. | |
Bool | fromRecord (String &error, const RecordInterface &inRec) |
Bool | isFourier () |
Can this FTMachine be represented by Fourier convolutions? | |
String | name () const |
Return name of this machine. | |
void | setConvFunc (CountedPtr< WPConvFunc > &pbconvFunc) |
Copy convolution function etc to another FT machine necessary if ft and ift are distinct but can share convfunctions. | |
CountedPtr< WPConvFunc > & | getConvFunc () |
virtual void | setMiscInfo (const Int qualifier) |
set the order of the Taylor term for MFS this is to tell A-Projection to qualify the accumulated avgPB for each Taylor term in the CFCache. | |
virtual void | ComputeResiduals (VisBuffer &, Bool) |
Make the VB and VBStore interefaces for the interim re-factoring work. | |
Static Public Member Functions | |
static void | wStat (ROVisibilityIterator &vi, Double &minW, Double &maxW, Double &rmsW) |
Helper function to calculate min, max, rms of W in the data set. | |
Protected Member Functions | |
Int | nint (Double val) |
void | findConvFunction (const ImageInterface< Complex > &image, const VisBuffer &vb) |
Find the convolution function. | |
Array< Complex > * | getDataPointer (const IPosition &, Bool) |
Get the appropriate data pointer. | |
void | ok () |
void | init () |
void | prepGridForDegrid () |
void | findGridSector (const Int &nxp, const Int &nyp, const Int &ixsub, const Int &iysub, const Int &minx, const Int &miny, const Int &icounter, Int &x0, Int &y0, Int &nxsub, Int &nysub, const Bool linear) |
Is this record on Grid? check both ends. | |
Int | getIndex (const ROMSPointingColumns &mspc, const Double &time, const Double &interval) |
Protected Attributes | |
Float | padding_p |
Padding in FFT. | |
Int | nWPlanes_p |
LatticeCache< Complex > * | imageCache |
Image cache. | |
Long | cachesize |
Sizes. | |
Int | tilesize |
ConvolveGridder< Double, Complex > * | gridder |
Gridder. | |
Bool | isTiled |
Is this tiled? | |
CountedPtr< Lattice< Complex > > | arrayLattice |
Array lattice. | |
CountedPtr< Lattice< Complex > > | lattice |
Lattice. | |
Float | maxAbsData |
IPosition | centerLoc |
Useful IPositions. | |
IPosition | offsetLoc |
Vector< Double > | uvScale |
Image Scaling and offset. | |
Vector< Double > | uvOffset |
Double | savedWScale_p |
Bool | usezero_p |
Grid/degrid zero spacing points? | |
Cube< Complex > | convFunc |
Int | convSampling |
Int | convSize |
Vector< Int > | convSupport |
Vector< Int > | convSizes_p |
Int | wConvSize |
Int | lastIndex_p |
String | machineName_p |
CountedPtr< WPConvFunc > | wpConvFunc_p |
Double | timemass_p |
Double | timegrid_p |
Double | timedegrid_p |
Double | minW_p |
Double | maxW_p |
Double | rmsW_p |
An FTMachine for Gridded Fourier transforms.
Public interface
FTMachine is a Machine for Fourier Transforms. WProjectFT does Grid-based Fourier transforms.
The SkyEquation needs to be able to perform Fourier transforms on visibility data. WProjectFT allows efficient Fourier Transform processing using a VisBuffer which encapsulates a chunk of visibility (typically all baselines for one time) together with all the information needed for processing (e.g. UVW coordinates).
Gridding and degridding in WProjectFT are performed using a novel sort-less algorithm. In this approach, the gridded plane is divided into small patches, a cache of which is maintained in memory using a general-purpose LatticeCache class. As the (time-sorted) visibility data move around slowly in the Fourier plane, patches are swapped in and out as necessary. Thus, optimally, one would keep at least one patch per baseline.
A grid cache is defined on construction. If the gridded uv plane is smaller than this, it is kept entirely in memory and all gridding and degridding is done entirely in memory. Otherwise a cache of tiles is kept an paged in and out as necessary. Optimally the cache should be big enough to hold all polarizations and frequencies for all baselines. The paging rate will then be small. As the cache size is reduced below this critical value, paging increases. The algorithm will work for only one patch but it will be very slow!
This scheme works well for arrays having a moderate number of antennas since the saving in space goes as the ratio of baselines to image size. For the ATCA, VLBA and WSRT, this ratio is quite favorable. For the VLA, one requires images of greater than about 200 pixels on a side to make it worthwhile.
The FFT step is done plane by plane for images having less than 1024 * 1024 pixels on each plane, and line by line otherwise.
The gridding and degridding steps are implemented in Fortran for speed. In gridding, the visibilities are added onto the grid points in the neighborhood using a weighting function. In degridding, the value is derived by a weight summ of the same points, using the same weighting function.
See the example for SkyModel .
Define an interface to allow efficient processing of chunks of visibility data
Definition at line 131 of file WProjectFT.h.
casa::WProjectFT::WProjectFT | ( | Int | nFacets, | |
Long | cachesize, | |||
Int | tilesize = 16 , |
|||
Bool | usezero = True , |
|||
Bool | useDoublePrec = False , |
|||
const Double | minW = -1.0 , |
|||
const Double | maxW = -1.0 , |
|||
const Double | rmsW = -1.0 | |||
) |
Constructor: cachesize is the size of the cache in words (e.g.
a few million is a good number), tilesize is the size of the tile used in gridding (cannot be less than 12, 16 works in most cases).
casa::WProjectFT::WProjectFT | ( | Int | nFacets, | |
MPosition | mLocation, | |||
Long | cachesize, | |||
Int | tilesize = 16 , |
|||
Bool | usezero = True , |
|||
Float | padding = 1.0 , |
|||
Bool | useDoublePrec = False , |
|||
const Double | minW = -1.0 , |
|||
const Double | maxW = -1.0 , |
|||
const Double | rmsW = -1.0 | |||
) |
Constructor without tangent direction.
casa::WProjectFT::WProjectFT | ( | Int | nFacets, | |
MDirection | mTangent, | |||
MPosition | mLocation, | |||
Long | cachesize, | |||
Int | tilesize = 16 , |
|||
Bool | usezero = True , |
|||
Float | padding = 1.0 , |
|||
Bool | useDoublePrec = False , |
|||
const Double | minW = -1.0 , |
|||
const Double | maxW = -1.0 , |
|||
const Double | rmsW = -1.0 | |||
) |
Deprecated no longer need ms in constructor.
casa::WProjectFT::WProjectFT | ( | const RecordInterface & | stateRec | ) |
Construct from a Record containing the WProjectFT state.
casa::WProjectFT::WProjectFT | ( | const WProjectFT & | other | ) |
Copy constructor.
casa::WProjectFT::~WProjectFT | ( | ) |
virtual FTMachine* casa::WProjectFT::cloneFTM | ( | ) | [virtual] |
clone to FTMachine pointer
Reimplemented from casa::FTMachine.
virtual void casa::WProjectFT::ComputeResiduals | ( | VisBuffer & | vb, | |
Bool | useCorrected | |||
) | [inline, virtual] |
Make the VB and VBStore interefaces for the interim re-factoring work.
Finally removed the VB interface.
Implements casa::FTMachine.
Definition at line 230 of file WProjectFT.h.
void casa::WProjectFT::finalizeToSky | ( | ) | [virtual] |
Finalize transform to Sky plane: flushes the image cache and shows statistics if it is being used.
DOES NOT DO THE FINAL TRANSFORM!
Implements casa::FTMachine.
void casa::WProjectFT::finalizeToVis | ( | ) | [virtual] |
This version returns the gridded vis...should be used in conjunction.
Finalize transform to Visibility plane: flushes the image cache and shows statistics if it is being used.
Implements casa::FTMachine.
void casa::WProjectFT::findConvFunction | ( | const ImageInterface< Complex > & | image, | |
const VisBuffer & | vb | |||
) | [protected, virtual] |
Find the convolution function.
Reimplemented from casa::FTMachine.
void casa::WProjectFT::findGridSector | ( | const Int & | nxp, | |
const Int & | nyp, | |||
const Int & | ixsub, | |||
const Int & | iysub, | |||
const Int & | minx, | |||
const Int & | miny, | |||
const Int & | icounter, | |||
Int & | x0, | |||
Int & | y0, | |||
Int & | nxsub, | |||
Int & | nysub, | |||
const Bool | linear | |||
) | [protected] |
Is this record on Grid? check both ends.
This assumes that the ends bracket the middle Bool recordOnGrid(const VisBuffer& vb, Int rownr) const;
/for openmp sectioning
Bool casa::WProjectFT::fromRecord | ( | String & | error, | |
const RecordInterface & | inRec | |||
) | [virtual] |
Reimplemented from casa::FTMachine.
void casa::WProjectFT::get | ( | VisBuffer & | vb, | |
Int | row = -1 | |||
) | [virtual] |
Get actual coherence from grid by degridding.
Implements casa::FTMachine.
CountedPtr<WPConvFunc>& casa::WProjectFT::getConvFunc | ( | ) |
Array<Complex>* casa::WProjectFT::getDataPointer | ( | const IPosition & | , | |
Bool | ||||
) | [protected] |
Get the appropriate data pointer.
ImageInterface<Complex>& casa::WProjectFT::getImage | ( | Matrix< Float > & | , | |
Bool | normalize = True | |||
) | [virtual] |
Get the final image: do the Fourier transform and grid-correct, then optionally normalize by the summed weights.
Implements casa::FTMachine.
Int casa::WProjectFT::getIndex | ( | const ROMSPointingColumns & | mspc, | |
const Double & | time, | |||
const Double & | interval | |||
) | [protected] |
void casa::WProjectFT::getWeightImage | ( | ImageInterface< Float > & | , | |
Matrix< Float > & | ||||
) | [virtual] |
Get the final weights image.
Implements casa::FTMachine.
void casa::WProjectFT::init | ( | ) | [protected] |
void casa::WProjectFT::initializeToSky | ( | ImageInterface< Complex > & | image, | |
Matrix< Float > & | weight, | |||
const VisBuffer & | vb | |||
) | [virtual] |
Initialize transform to Sky plane: initializes the image.
Implements casa::FTMachine.
void casa::WProjectFT::initializeToVis | ( | ImageInterface< Complex > & | image, | |
const VisBuffer & | vb | |||
) | [virtual] |
Initialize transform to Visibility plane using the image as a template.
The image is loaded and Fourier transformed.
Implements casa::FTMachine.
Bool casa::WProjectFT::isFourier | ( | ) | [inline, virtual] |
Can this FTMachine be represented by Fourier convolutions?
Reimplemented from casa::FTMachine.
Definition at line 217 of file WProjectFT.h.
References casacore::True.
void casa::WProjectFT::makeImage | ( | FTMachine::Type | type, | |
VisSet & | vs, | |||
ImageInterface< Complex > & | image, | |||
Matrix< Float > & | weight | |||
) | [virtual] |
Make the entire image.
Reimplemented from casa::FTMachine.
String casa::WProjectFT::name | ( | ) | const [virtual] |
Return name of this machine.
Implements casa::FTMachine.
Int casa::WProjectFT::nint | ( | Double | val | ) | [inline, protected] |
Definition at line 241 of file WProjectFT.h.
References casacore::floor().
virtual void casa::WProjectFT::normalizeImage | ( | Lattice< Complex > & | , | |
const Matrix< Double > & | , | |||
Lattice< Float > & | , | |||
Bool | ||||
) | [inline, virtual] |
Reimplemented from casa::FTMachine.
Definition at line 202 of file WProjectFT.h.
void casa::WProjectFT::ok | ( | ) | [protected, virtual] |
Reimplemented from casa::FTMachine.
WProjectFT& casa::WProjectFT::operator= | ( | const WProjectFT & | other | ) |
Assignment operator.
Reimplemented from casa::FTMachine.
void casa::WProjectFT::prepGridForDegrid | ( | ) | [protected] |
void casa::WProjectFT::put | ( | const VisBuffer & | vb, | |
Int | row = -1 , |
|||
Bool | dopsf = False , |
|||
FTMachine::Type | type = FTMachine::OBSERVED | |||
) | [virtual] |
Put coherence to grid by gridding.
Implements casa::FTMachine.
void casa::WProjectFT::setConvFunc | ( | CountedPtr< WPConvFunc > & | pbconvFunc | ) |
Copy convolution function etc to another FT machine necessary if ft and ift are distinct but can share convfunctions.
virtual void casa::WProjectFT::setMiscInfo | ( | const Int | qualifier | ) | [inline, virtual] |
set the order of the Taylor term for MFS this is to tell A-Projection to qualify the accumulated avgPB for each Taylor term in the CFCache.
Implements casa::FTMachine.
Definition at line 229 of file WProjectFT.h.
Bool casa::WProjectFT::toRecord | ( | String & | error, | |
RecordInterface & | outRec, | |||
Bool | withImage = False , |
|||
const String | diskimage = "" | |||
) | [virtual] |
Save and restore the WProjectFT to and from a record.
Reimplemented from casa::FTMachine.
static void casa::WProjectFT::wStat | ( | ROVisibilityIterator & | vi, | |
Double & | minW, | |||
Double & | maxW, | |||
Double & | rmsW | |||
) | [static] |
Helper function to calculate min, max, rms of W in the data set.
CountedPtr<Lattice<Complex> > casa::WProjectFT::arrayLattice [protected] |
Array lattice.
Definition at line 279 of file WProjectFT.h.
Long casa::WProjectFT::cachesize [protected] |
Sizes.
Definition at line 269 of file WProjectFT.h.
IPosition casa::WProjectFT::centerLoc [protected] |
Useful IPositions.
Definition at line 288 of file WProjectFT.h.
Cube<Complex> casa::WProjectFT::convFunc [protected] |
Definition at line 298 of file WProjectFT.h.
Int casa::WProjectFT::convSampling [protected] |
Definition at line 299 of file WProjectFT.h.
Int casa::WProjectFT::convSize [protected] |
Definition at line 300 of file WProjectFT.h.
Vector<Int> casa::WProjectFT::convSizes_p [protected] |
Definition at line 303 of file WProjectFT.h.
Vector<Int> casa::WProjectFT::convSupport [protected] |
Definition at line 301 of file WProjectFT.h.
ConvolveGridder<Double, Complex>* casa::WProjectFT::gridder [protected] |
Gridder.
Definition at line 273 of file WProjectFT.h.
LatticeCache<Complex>* casa::WProjectFT::imageCache [protected] |
Image cache.
Definition at line 266 of file WProjectFT.h.
Bool casa::WProjectFT::isTiled [protected] |
Is this tiled?
Definition at line 276 of file WProjectFT.h.
Int casa::WProjectFT::lastIndex_p [protected] |
Definition at line 308 of file WProjectFT.h.
CountedPtr<Lattice<Complex> > casa::WProjectFT::lattice [protected] |
Lattice.
For non-tiled gridding, this will point to arrayLattice, whereas for tiled gridding, this points to the image
Definition at line 283 of file WProjectFT.h.
String casa::WProjectFT::machineName_p [protected] |
Definition at line 313 of file WProjectFT.h.
Float casa::WProjectFT::maxAbsData [protected] |
Definition at line 285 of file WProjectFT.h.
Double casa::WProjectFT::maxW_p [protected] |
Definition at line 317 of file WProjectFT.h.
Double casa::WProjectFT::minW_p [protected] |
Definition at line 317 of file WProjectFT.h.
Int casa::WProjectFT::nWPlanes_p [protected] |
Definition at line 247 of file WProjectFT.h.
IPosition casa::WProjectFT::offsetLoc [protected] |
Definition at line 288 of file WProjectFT.h.
Float casa::WProjectFT::padding_p [protected] |
Padding in FFT.
Definition at line 239 of file WProjectFT.h.
Double casa::WProjectFT::rmsW_p [protected] |
Definition at line 317 of file WProjectFT.h.
Double casa::WProjectFT::savedWScale_p [protected] |
Definition at line 292 of file WProjectFT.h.
Int casa::WProjectFT::tilesize [protected] |
Definition at line 270 of file WProjectFT.h.
Double casa::WProjectFT::timedegrid_p [protected] |
Definition at line 316 of file WProjectFT.h.
Double casa::WProjectFT::timegrid_p [protected] |
Definition at line 316 of file WProjectFT.h.
Double casa::WProjectFT::timemass_p [protected] |
Definition at line 316 of file WProjectFT.h.
Bool casa::WProjectFT::usezero_p [protected] |
Grid/degrid zero spacing points?
Definition at line 296 of file WProjectFT.h.
Vector<Double> casa::WProjectFT::uvOffset [protected] |
Definition at line 291 of file WProjectFT.h.
Vector<Double> casa::WProjectFT::uvScale [protected] |
Image Scaling and offset.
Definition at line 291 of file WProjectFT.h.
Int casa::WProjectFT::wConvSize [protected] |
Definition at line 306 of file WProjectFT.h.
CountedPtr<WPConvFunc> casa::WProjectFT::wpConvFunc_p [protected] |
Definition at line 315 of file WProjectFT.h.