casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes
casa::WProjectFT Class Reference

An FTMachine for Gridded Fourier transforms. More...

#include <WProjectFT.h>

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

List of all members.

Public Member Functions

 WProjectFT (Int nFacets, Long cachesize, Int tilesize=16, Bool usezero=True, Bool useDoublePrec=False)
 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)
 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)
 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 ()
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)
 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.

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 ()
Bool recordOnGrid (const VisBuffer &vb, Int rownr) const
 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< DoubleuvScale
 Image Scaling and offset.
Vector< DoubleuvOffset
Double savedWScale_p
Array< Complex > griddedData
 Array for non-tiled gridding.
Array< DComplex > griddedData2
Bool usezero_p
 Grid/degrid zero spacing points?
Cube< Complex > convFunc
Int convSampling
Int convSize
Vector< IntconvSupport
Vector< IntconvSizes_p
Int wConvSize
Int lastIndex_p
String machineName_p
CountedPtr< WPConvFuncwpConvFunc_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 131 of file WProjectFT.h.


Constructor & Destructor Documentation

casa::WProjectFT::WProjectFT ( Int  nFacets,
Long  cachesize,
Int  tilesize = 16,
Bool  usezero = True,
Bool  useDoublePrec = False 
)

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 
)

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 
)

Deprecated no longer need ms in constructor.

Construct from a Record containing the WProjectFT state.

Copy constructor.


Member Function Documentation

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 228 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.

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.

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 215 of file WProjectFT.h.

References casa::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 235 of file WProjectFT.h.

References casa::floor().

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

Reimplemented from casa::FTMachine.

Definition at line 200 of file WProjectFT.h.

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

Reimplemented from casa::FTMachine.

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

Assignment operator.

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.

Bool casa::WProjectFT::recordOnGrid ( const VisBuffer vb,
Int  rownr 
) const [protected]

Is this record on Grid? check both ends.

This assumes that the ends bracket the middle

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 227 of file WProjectFT.h.

Bool casa::WProjectFT::toRecord ( String error,
RecordInterface outRec,
Bool  withImage = False 
) [virtual]

Save and restore the WProjectFT to and from a record.

Reimplemented from casa::FTMachine.


Member Data Documentation

Array lattice.

Definition at line 269 of file WProjectFT.h.

Sizes.

Definition at line 259 of file WProjectFT.h.

Useful IPositions.

Definition at line 278 of file WProjectFT.h.

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

Definition at line 292 of file WProjectFT.h.

Definition at line 293 of file WProjectFT.h.

Definition at line 294 of file WProjectFT.h.

Definition at line 297 of file WProjectFT.h.

Definition at line 295 of file WProjectFT.h.

Array<Complex> casa::WProjectFT::griddedData [protected]

Array for non-tiled gridding.

Definition at line 285 of file WProjectFT.h.

Array<DComplex> casa::WProjectFT::griddedData2 [protected]

Definition at line 286 of file WProjectFT.h.

Gridder.

Definition at line 263 of file WProjectFT.h.

Image cache.

Definition at line 256 of file WProjectFT.h.

Is this tiled?

Definition at line 266 of file WProjectFT.h.

Definition at line 302 of file WProjectFT.h.

Lattice.

For non-tiled gridding, this will point to arrayLattice, whereas for tiled gridding, this points to the image

Definition at line 273 of file WProjectFT.h.

Definition at line 307 of file WProjectFT.h.

Definition at line 275 of file WProjectFT.h.

Definition at line 241 of file WProjectFT.h.

Definition at line 278 of file WProjectFT.h.

Padding in FFT.

Definition at line 228 of file WProjectFT.h.

Definition at line 282 of file WProjectFT.h.

Definition at line 260 of file WProjectFT.h.

Grid/degrid zero spacing points?

Definition at line 290 of file WProjectFT.h.

Definition at line 281 of file WProjectFT.h.

Image Scaling and offset.

Definition at line 281 of file WProjectFT.h.

Definition at line 300 of file WProjectFT.h.

Definition at line 309 of file WProjectFT.h.


The documentation for this class was generated from the following file: