casa
$Rev:20696$
|
An FTMachine for Gridded Fourier transforms. More...
#include <GridFT.h>
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 GridFT & | operator= (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< Double > | uvScale |
Image Scaling and offset. | |
Vector< Double > | uvOffset |
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 |
An FTMachine for Gridded Fourier transforms.
Public interface
FTMachine is a Machine for Fourier Transforms. GridFT does Grid-based Fourier transforms.
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.
See the example for SkyModel .
Define an interface to allow efficient processing of chunks of visibility data
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 | ) |
casa::GridFT::GridFT | ( | const GridFT & | other | ) |
Copy constructor.
virtual casa::GridFT::~GridFT | ( | ) | [virtual] |
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.
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] |
virtual void casa::GridFT::normalizeImage | ( | Lattice< Complex > & | , |
const Matrix< Double > & | , | ||
Lattice< Float > & | , | ||
Bool | |||
) | [inline, virtual] |
Reimplemented from casa::FTMachine.
virtual void casa::GridFT::ok | ( | ) | [protected, virtual] |
Reimplemented from casa::FTMachine.
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.
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.
CountedPtr<Lattice<Complex> > casa::GridFT::arrayLattice [protected] |
Long casa::GridFT::cachesize [protected] |
IPosition casa::GridFT::centerLoc [protected] |
String casa::GridFT::convType [protected] |
Array<Complex> casa::GridFT::griddedData [protected] |
Array<DComplex> casa::GridFT::griddedData2 [protected] |
ConvolveGridder<Double, Complex>* casa::GridFT::gridder [protected] |
LatticeCache<Complex>* casa::GridFT::imageCache [protected] |
Bool casa::GridFT::isTiled [protected] |
CountedPtr<Lattice<Complex> > casa::GridFT::lattice [protected] |
String casa::GridFT::machineName_p [protected] |
Float casa::GridFT::maxAbsData [protected] |
Bool casa::GridFT::noPadding_p [protected] |
IPosition casa::GridFT::offsetLoc [protected] |
Float casa::GridFT::padding_p [protected] |
Int casa::GridFT::priorCacheSize [protected] |
Int casa::GridFT::tilesize [protected] |
Double casa::GridFT::timegrid_p [protected] |
Double casa::GridFT::timemass_p [protected] |
Bool casa::GridFT::usePut2_p [protected] |
Bool casa::GridFT::usezero_p [protected] |
Vector<Double> casa::GridFT::uvOffset [protected] |
Vector<Double> casa::GridFT::uvScale [protected] |