casa::refim::WProjectFT Class Reference

An FTMachine for Gridded Fourier transforms. More...

#include <WProjectFT.h>

Inheritance diagram for casa::refim::WProjectFT:
casa::refim::FTMachine

List of all members.

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.
WProjectFToperator= (const WProjectFT &other)
 Assignment operator.
 ~WProjectFT ()
virtual FTMachinecloneFTM ()
 clone to FTMachine pointer
void initializeToVis (ImageInterface< Complex > &image, const vi::VisBuffer2 &vb)
 Initialize transform to Visibility plane using the image as a template.
void finalizeToVis ()
 Finalize transform to Visibility plane: flushes the image cache and shows statistics if it is being used.
void initializeToSky (ImageInterface< Complex > &image, Matrix< Float > &weight, const vi::VisBuffer2 &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 (vi::VisBuffer2 &vb, Int row=-1)
 Get actual coherence from grid by degridding.
void put (const vi::VisBuffer2 &vb, Int row=-1, Bool dopsf=False, FTMachine::Type type=FTMachine::OBSERVED)
 Put coherence to grid by gridding.
void makeImage (FTMachine::Type type, vi::VisibilityIterator2 &vi, 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 (vi::VisBuffer2 &, Bool)
 Make the VB and VBStore interefaces for the interim re-factoring work.

Static Public Member Functions

static void wStat (vi::VisibilityIterator2 &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 vi::VisBuffer2 &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< WPConvFuncwpConvFunc_p
Double timemass_p
Double timegrid_p
Double timedegrid_p
Double minW_p
Double maxW_p
Double rmsW_p

Detailed Description

An FTMachine for Gridded Fourier transforms.

Intended use:

Public interface

Prerequisite

Etymology

FTMachine is a Machine for Fourier Transforms. WProjectFT does Grid-based Fourier transforms.

Synopsis

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.

Example

See the example for SkyModel .

Motivation

Define an interface to allow efficient processing of chunks of visibility data

Definition at line 132 of file WProjectFT.h.


Constructor & Destructor Documentation

casa::refim::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::refim::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::refim::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::refim::WProjectFT::WProjectFT ( const RecordInterface &  stateRec  ) 

Construct from a Record containing the WProjectFT state.

casa::refim::WProjectFT::WProjectFT ( const WProjectFT other  ) 

Copy constructor.

casa::refim::WProjectFT::~WProjectFT (  ) 

Member Function Documentation

virtual FTMachine* casa::refim::WProjectFT::cloneFTM (  )  [virtual]

clone to FTMachine pointer

Reimplemented from casa::refim::FTMachine.

virtual void casa::refim::WProjectFT::ComputeResiduals ( vi::VisBuffer2 vb,
Bool  useCorrected 
) [inline, virtual]

Make the VB and VBStore interefaces for the interim re-factoring work.

Finally removed the VB interface.

Implements casa::refim::FTMachine.

Definition at line 228 of file WProjectFT.h.

void casa::refim::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::refim::FTMachine.

void casa::refim::WProjectFT::finalizeToVis (  )  [virtual]

Finalize transform to Visibility plane: flushes the image cache and shows statistics if it is being used.

Implements casa::refim::FTMachine.

void casa::refim::WProjectFT::findConvFunction ( const ImageInterface< Complex > &  image,
const vi::VisBuffer2 vb 
) [protected, virtual]

Find the convolution function.

Reimplemented from casa::refim::FTMachine.

void casa::refim::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 vi::VisBuffer2& vb, Int rownr) const;

/for openmp sectioning

Bool casa::refim::WProjectFT::fromRecord ( String &  error,
const RecordInterface &  inRec 
) [virtual]

Reimplemented from casa::refim::FTMachine.

void casa::refim::WProjectFT::get ( vi::VisBuffer2 vb,
Int  row = -1 
) [virtual]

Get actual coherence from grid by degridding.

Implements casa::refim::FTMachine.

CountedPtr<WPConvFunc>& casa::refim::WProjectFT::getConvFunc (  ) 
Array<Complex>* casa::refim::WProjectFT::getDataPointer ( const IPosition &  ,
Bool   
) [protected]

Get the appropriate data pointer.

ImageInterface<Complex>& casa::refim::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::refim::FTMachine.

Int casa::refim::WProjectFT::getIndex ( const ROMSPointingColumns &  mspc,
const Double &  time,
const Double &  interval 
) [protected]
void casa::refim::WProjectFT::getWeightImage ( ImageInterface< Float > &  ,
Matrix< Float > &   
) [virtual]

Get the final weights image.

Implements casa::refim::FTMachine.

void casa::refim::WProjectFT::init (  )  [protected]
void casa::refim::WProjectFT::initializeToSky ( ImageInterface< Complex > &  image,
Matrix< Float > &  weight,
const vi::VisBuffer2 vb 
) [virtual]

Initialize transform to Sky plane: initializes the image.

Implements casa::refim::FTMachine.

void casa::refim::WProjectFT::initializeToVis ( ImageInterface< Complex > &  image,
const vi::VisBuffer2 vb 
) [virtual]

Initialize transform to Visibility plane using the image as a template.

The image is loaded and Fourier transformed.

Implements casa::refim::FTMachine.

Bool casa::refim::WProjectFT::isFourier (  )  [inline, virtual]

Can this FTMachine be represented by Fourier convolutions?

Reimplemented from casa::refim::FTMachine.

Definition at line 215 of file WProjectFT.h.

References casacore::True.

void casa::refim::WProjectFT::makeImage ( FTMachine::Type  type,
vi::VisibilityIterator2 vi,
ImageInterface< Complex > &  image,
Matrix< Float > &  weight 
) [virtual]

Make the entire image.

Reimplemented from casa::refim::FTMachine.

String casa::refim::WProjectFT::name (  )  const [virtual]

Return name of this machine.

Implements casa::refim::FTMachine.

Int casa::refim::WProjectFT::nint ( Double  val  )  [inline, protected]

Definition at line 237 of file WProjectFT.h.

References casacore::floor().

virtual void casa::refim::WProjectFT::normalizeImage ( Lattice< Complex > &  ,
const Matrix< Double > &  ,
Lattice< Float > &  ,
Bool   
) [inline, virtual]

Reimplemented from casa::refim::FTMachine.

Definition at line 200 of file WProjectFT.h.

void casa::refim::WProjectFT::ok (  )  [protected, virtual]

Reimplemented from casa::refim::FTMachine.

WProjectFT& casa::refim::WProjectFT::operator= ( const WProjectFT other  ) 

Assignment operator.

Reimplemented from casa::refim::FTMachine.

void casa::refim::WProjectFT::prepGridForDegrid (  )  [protected]
void casa::refim::WProjectFT::put ( const vi::VisBuffer2 vb,
Int  row = -1,
Bool  dopsf = False,
FTMachine::Type  type = FTMachine::OBSERVED 
) [virtual]

Put coherence to grid by gridding.

Implements casa::refim::FTMachine.

void casa::refim::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::refim::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::refim::FTMachine.

Definition at line 227 of file WProjectFT.h.

Bool casa::refim::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::refim::FTMachine.

static void casa::refim::WProjectFT::wStat ( vi::VisibilityIterator2 vi,
Double &  minW,
Double &  maxW,
Double &  rmsW 
) [static]

Helper function to calculate min, max, rms of W in the data set.


Member Data Documentation

CountedPtr<Lattice<Complex> > casa::refim::WProjectFT::arrayLattice [protected]

Array lattice.

Definition at line 275 of file WProjectFT.h.

Sizes.

Definition at line 265 of file WProjectFT.h.

IPosition casa::refim::WProjectFT::centerLoc [protected]

Useful IPositions.

Definition at line 284 of file WProjectFT.h.

Cube<Complex> casa::refim::WProjectFT::convFunc [protected]

Definition at line 294 of file WProjectFT.h.

Definition at line 295 of file WProjectFT.h.

Definition at line 296 of file WProjectFT.h.

Vector<Int> casa::refim::WProjectFT::convSizes_p [protected]

Definition at line 299 of file WProjectFT.h.

Vector<Int> casa::refim::WProjectFT::convSupport [protected]

Definition at line 297 of file WProjectFT.h.

ConvolveGridder<Double, Complex>* casa::refim::WProjectFT::gridder [protected]

Gridder.

Definition at line 269 of file WProjectFT.h.

LatticeCache<Complex>* casa::refim::WProjectFT::imageCache [protected]

Image cache.

Definition at line 262 of file WProjectFT.h.

Is this tiled?

Definition at line 272 of file WProjectFT.h.

Definition at line 304 of file WProjectFT.h.

CountedPtr<Lattice<Complex> > casa::refim::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 279 of file WProjectFT.h.

Definition at line 309 of file WProjectFT.h.

Definition at line 281 of file WProjectFT.h.

Double casa::refim::WProjectFT::maxW_p [protected]

Definition at line 313 of file WProjectFT.h.

Double casa::refim::WProjectFT::minW_p [protected]

Definition at line 313 of file WProjectFT.h.

Definition at line 243 of file WProjectFT.h.

IPosition casa::refim::WProjectFT::offsetLoc [protected]

Definition at line 284 of file WProjectFT.h.

Padding in FFT.

Definition at line 235 of file WProjectFT.h.

Double casa::refim::WProjectFT::rmsW_p [protected]

Definition at line 313 of file WProjectFT.h.

Definition at line 288 of file WProjectFT.h.

Definition at line 266 of file WProjectFT.h.

Definition at line 312 of file WProjectFT.h.

Definition at line 312 of file WProjectFT.h.

Definition at line 312 of file WProjectFT.h.

Grid/degrid zero spacing points?

Definition at line 292 of file WProjectFT.h.

Vector<Double> casa::refim::WProjectFT::uvOffset [protected]

Definition at line 287 of file WProjectFT.h.

Vector<Double> casa::refim::WProjectFT::uvScale [protected]

Image Scaling and offset.

Definition at line 287 of file WProjectFT.h.

Definition at line 302 of file WProjectFT.h.

Definition at line 311 of file WProjectFT.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1