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

An FTMachine for Gridded Fourier transforms. More...

#include <GridFT.h>

Inheritance diagram for casa::GridFT:
casa::FTMachine casa::SetJyGridFT

List of all members.

Public Member Functions

 GridFT ()
 Constructor: cachesize is the size of the cache in words (e.g.
 GridFT (Long cachesize, Int tilesize, String convType="SF", Float padding=1.0, Bool usezero=True, Bool useDoublePrec=False)
 GridFT (Long cachesize, Int tilesize, String convType, MPosition mLocation, Float padding=1.0, Bool usezero=True, Bool useDoublePrec=False)
 GridFT (Long cachesize, Int tilesize, String convType, MDirection mTangent, Float padding=1.0, Bool usezero=True, Bool useDoublePrec=False)
 GridFT (Long cachesize, Int tilesize, String convType, MPosition mLocation, MDirection mTangent, Float passing=1.0, Bool usezero=True, Bool useDoublePrec=False)
 GridFT (const RecordInterface &stateRec)
 Construct from a Record containing the GridFT state.
 GridFT (const GridFT &other)
 Copy constructor.
virtual GridFToperator= (const GridFT &other)
 Assignment operator.
virtual ~GridFT ()
virtual void initializeToVis (ImageInterface< Complex > &image, const VisBuffer &vb)
 Initialize transform to Visibility plane using the image as a template.
virtual void finalizeToVis ()
 Finalize transform to Visibility plane: flushes the image cache and shows statistics if it is being used.
virtual void initializeToSky (ImageInterface< Complex > &image, Matrix< Float > &weight, const VisBuffer &vb)
 Initialize transform to Sky plane: initializes the image.
virtual void finalizeToSky ()
 Finalize transform to Sky plane: flushes the image cache and shows statistics if it is being used.
virtual void get (VisBuffer &vb, Int row=-1)
 Get actual coherence from grid by degridding.
virtual 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.
virtual Bool toRecord (String &error, RecordInterface &outRec, Bool withImage=False)
 Save and restore the GridFT to and from a record.
virtual Bool fromRecord (String &error, const RecordInterface &inRec)
virtual Bool isFourier ()
 Can this FTMachine be represented by Fourier convolutions?
virtual void setNoPadding (Bool nopad)
 To make sure no padding is used in certain gridders.
virtual String name () const
 Return the name of the machine.
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

Array< Complex > * getDataPointer (const IPosition &, Bool)
 Get the appropriate data pointer.
virtual void ok ()
virtual void init ()
virtual void prepGridForDegrid ()
 Prepare the grid for degridding.
Bool recordOnGrid (const VisBuffer &vb, Int rownr) const
 Is this record on Grid? check both ends.

Protected Attributes

Float padding_p
 Padding in FFT.
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.
String convType
Float maxAbsData
IPosition centerLoc
 Useful IPositions.
IPosition offsetLoc
Vector< DoubleuvScale
 Image Scaling and offset.
Vector< DoubleuvOffset
Array< Complex > griddedData
 Array for non-tiled gridding.
Array< DComplex > griddedData2
Int priorCacheSize
Bool usezero_p
 Grid/degrid zero spacing points?
Bool noPadding_p
 force no padding
Bool usePut2_p
 Check if using put that avoids non-necessary reads.
String machineName_p
 machine name
Double timemass_p
Double timegrid_p

Detailed Description

An FTMachine for Gridded Fourier transforms.

Intended use:

Public interface

Prerequisite

Etymology

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

Synopsis

The SkyEquation needs to be able to perform Fourier transforms on visibility data. GridFT 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 GridFT 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 123 of file GridFT.h.


Constructor & Destructor Documentation

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), and convType is the type of gridding used (SF is prolate spheriodal wavefunction, and BOX is plain box-car summation). mLocation is the position to be used in some phase rotations. If mTangent is specified then the uvw rotation is done for that location iso the image center.

casa::GridFT::GridFT ( Long  cachesize,
Int  tilesize,
String  convType = "SF",
Float  padding = 1.0,
Bool  usezero = True,
Bool  useDoublePrec = False 
)
casa::GridFT::GridFT ( Long  cachesize,
Int  tilesize,
String  convType,
MPosition  mLocation,
Float  padding = 1.0,
Bool  usezero = True,
Bool  useDoublePrec = False 
)
casa::GridFT::GridFT ( Long  cachesize,
Int  tilesize,
String  convType,
MDirection  mTangent,
Float  padding = 1.0,
Bool  usezero = True,
Bool  useDoublePrec = False 
)
casa::GridFT::GridFT ( Long  cachesize,
Int  tilesize,
String  convType,
MPosition  mLocation,
MDirection  mTangent,
Float  passing = 1.0,
Bool  usezero = True,
Bool  useDoublePrec = False 
)
casa::GridFT::GridFT ( const RecordInterface stateRec)

Construct from a Record containing the GridFT state.

casa::GridFT::GridFT ( const GridFT other)

Copy constructor.

virtual casa::GridFT::~GridFT ( ) [virtual]

Member Function Documentation

virtual void casa::GridFT::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 219 of file GridFT.h.

virtual void casa::GridFT::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.

virtual void casa::GridFT::finalizeToVis ( ) [virtual]

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

Implements casa::FTMachine.

virtual Bool casa::GridFT::fromRecord ( String error,
const RecordInterface inRec 
) [virtual]

Reimplemented from casa::FTMachine.

Reimplemented in casa::SetJyGridFT.

virtual void casa::GridFT::get ( VisBuffer vb,
Int  row = -1 
) [virtual]

Get actual coherence from grid by degridding.

Implements casa::FTMachine.

Reimplemented in casa::SetJyGridFT.

Array<Complex>* casa::GridFT::getDataPointer ( const IPosition ,
Bool   
) [protected]

Get the appropriate data pointer.

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

void casa::GridFT::getWeightImage ( ImageInterface< Float > &  ,
Matrix< Float > &   
) [virtual]

Get the final weights image.

Implements casa::FTMachine.

virtual void casa::GridFT::init ( ) [protected, virtual]
virtual void casa::GridFT::initializeToSky ( ImageInterface< Complex > &  image,
Matrix< Float > &  weight,
const VisBuffer vb 
) [virtual]

Initialize transform to Sky plane: initializes the image.

Implements casa::FTMachine.

virtual void casa::GridFT::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.

Reimplemented in casa::SetJyGridFT.

virtual Bool casa::GridFT::isFourier ( ) [inline, virtual]

Can this FTMachine be represented by Fourier convolutions?

Reimplemented from casa::FTMachine.

Definition at line 213 of file GridFT.h.

References casa::True.

void casa::GridFT::makeImage ( FTMachine::Type  type,
VisSet vs,
ImageInterface< Complex > &  image,
Matrix< Float > &  weight 
) [virtual]

Make the entire image.

Reimplemented from casa::FTMachine.

virtual String casa::GridFT::name ( ) const [virtual]

Return the name of the machine.

Implements casa::FTMachine.

Reimplemented in casa::SetJyGridFT.

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

Reimplemented from casa::FTMachine.

Definition at line 198 of file GridFT.h.

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

Reimplemented from casa::FTMachine.

virtual GridFT& casa::GridFT::operator= ( const GridFT other) [virtual]

Assignment operator.

virtual void casa::GridFT::prepGridForDegrid ( ) [protected, virtual]

Prepare the grid for degridding.

virtual void casa::GridFT::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::GridFT::recordOnGrid ( const VisBuffer vb,
Int  rownr 
) const [protected]

Is this record on Grid? check both ends.

This assumes that the ends bracket the middle

virtual void casa::GridFT::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 218 of file GridFT.h.

virtual void casa::GridFT::setNoPadding ( Bool  nopad) [inline, virtual]

To make sure no padding is used in certain gridders.

Reimplemented from casa::FTMachine.

Definition at line 215 of file GridFT.h.

References noPadding_p.

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

Save and restore the GridFT to and from a record.

Reimplemented from casa::FTMachine.

Reimplemented in casa::SetJyGridFT.


Member Data Documentation

Array lattice.

Definition at line 256 of file GridFT.h.

Sizes.

Definition at line 246 of file GridFT.h.

Useful IPositions.

Definition at line 267 of file GridFT.h.

Definition at line 262 of file GridFT.h.

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

Array for non-tiled gridding.

Definition at line 273 of file GridFT.h.

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

Definition at line 274 of file GridFT.h.

Gridder.

Definition at line 250 of file GridFT.h.

LatticeCache<Complex>* casa::GridFT::imageCache [protected]

Image cache.

Definition at line 243 of file GridFT.h.

Is this tiled?

Definition at line 253 of file GridFT.h.

CountedPtr<Lattice<Complex> > casa::GridFT::lattice [protected]

Lattice.

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

Definition at line 260 of file GridFT.h.

machine name

Definition at line 289 of file GridFT.h.

Definition at line 264 of file GridFT.h.

force no padding

Definition at line 283 of file GridFT.h.

Referenced by setNoPadding().

Definition at line 267 of file GridFT.h.

Padding in FFT.

Definition at line 219 of file GridFT.h.

Definition at line 276 of file GridFT.h.

Definition at line 247 of file GridFT.h.

Definition at line 291 of file GridFT.h.

Definition at line 291 of file GridFT.h.

Check if using put that avoids non-necessary reads.

Definition at line 286 of file GridFT.h.

Grid/degrid zero spacing points?

Definition at line 280 of file GridFT.h.

Definition at line 270 of file GridFT.h.

Image Scaling and offset.

Definition at line 270 of file GridFT.h.


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