DataLoadingBuf Class Reference

a container for data buffers used to fill a measurement set More...

#include <DataLoadingBuf.h>

List of all members.

Public Member Functions

 DataLoadingBuf ()
 create the container
 ~DataLoadingBuf ()
 delete the container
void resizeForNspect (Int i)
 resize our arrays of containers to hold data for wide band data and a given number of narrow band spectral windows.
Int nchanForSpWin (Int i)
 return the number of channels that can be stored in a given window.
Cube< Bool > & flagsForSpWin (Int winid)
 return a reference to the flags Cube for a given window.
Matrix< Complex > & visForSpWin (Int winid)
 return a reference to the vis Matrix for a given window
Vector< Float > & weight ()
 return a reference to the weight vector
Vector< Float > & sigma ()
 return a reference to the sigma vector
void resizeForSpWin (Int winid, Int nchan)
 resize the containers for a given window to the given number of channels
void resizeForNpol (Int npol)
 resize the containers for a given number of polarization correlations

Private Member Functions

 DataLoadingBuf (DataLoadingBuf &)

Private Attributes

Block< Matrix< Complex > * > vislist
Block< Cube< Bool > * > flgslist
Vector< Float > wt
Vector< Float > rms

Detailed Description

a container for data buffers used to fill a measurement set

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Etymology

class holds buffers used to load data into a Measurment Set

Motivation

Miriad data support multiple spectral windows for a given correllator setup. Furthermore, a dataset can contain multiple setups. This class attempts to avoid having to repeatedly create a buffer inside a loading loop.

Synopsis

This class allows one to create reusable buffers for each of the spectral windows that can be passed to an ArrayColumn's put() function. This avoids the cost of recreating the buffers inside a loading loop that cycles through the input Miriad windows. The buffers can be resized if necessary if the Miriad correllator setup changes.

This class stores for each window a Matrix<Complex> to store the visibility data and a Cube<Bool> to hold the flags. Normally, you can have all wide-band windows share a single buffer (since they are all the same size, namely having 1 channel). The buffers are access via their (zero-base) window index, starting with the narrow band windows. A window index greater than or equal to the number of narrow band windows (set via resizeForNspec()) is assumed to refer a wide-band window and the last buffer is returned.

If the size of a buffer needs to be changed (e.g. because the correllator setup changed such that the number of channels in a window subsequently changed), it is most convenient to do the resizing via resizeForSpWin().

Example

To set up the buffers, you need to know how many windows you have, and the number of channels in each window.

 Int nspec = 6
 Int *nchan = { 512, 256, 256, 512, 256, 256 };
 DataLoadingBuf buf();
 buf.resizeForNspect(nspec+1)  // to hold both narrow and wide band data
 for(Int i=0; i < nspec; i++)
 buf.resizeForSpWin(i, nchan[i]);
 buf.resizeForSpWin(nspec, 1);

Now to use the buffers..\.

 for(Int i=0; i < 2*nspec; i++) {
 
 // get data-loading buffers
 Matrix<Complex> &vis = buf.visForSpWin(i);
 Cube<Bool> &flgs = buf.flagsForSpWin(i);
 
 // load in the data
 Int n = (i < nspec) ? nchan[i] : 1;
 for(Int j=0; j < n; j++) {
 vis(0,j) = Complex( corr[2*(j+offset)], 
 -corr[2*(j+offset)+1] );
 flgs(0,j,1) = (flags[j+offset] == 0);
 }
 
 // load it into MS column
 msc->data().put(row, vis);
 msc->flagCategory().put(row, flgs);
 }

To Do

Definition at line 127 of file DataLoadingBuf.h.


Constructor & Destructor Documentation

DataLoadingBuf::DataLoadingBuf ( DataLoadingBuf  )  [private]
DataLoadingBuf::DataLoadingBuf (  ) 

create the container

DataLoadingBuf::~DataLoadingBuf (  ) 

delete the container


Member Function Documentation

Cube<Bool>& DataLoadingBuf::flagsForSpWin ( Int  winid  )  [inline]

return a reference to the flags Cube for a given window.

A value for i greater than or equal to the number of narrow band windows is assumed to refer to a wideband window.

Definition at line 157 of file DataLoadingBuf.h.

References flgslist.

Int DataLoadingBuf::nchanForSpWin ( Int  i  )  [inline]

return the number of channels that can be stored in a given window.

A value for i greater than or equal to the number of narrow band windows is assumed to refer to a wideband window; thus, 1 will be returned.

Definition at line 152 of file DataLoadingBuf.h.

References visForSpWin().

void DataLoadingBuf::resizeForNpol ( Int  npol  )  [inline]

resize the containers for a given number of polarization correlations

Definition at line 194 of file DataLoadingBuf.h.

References casacore::False, flgslist, rms, vislist, and wt.

void DataLoadingBuf::resizeForNspect ( Int  i  ) 

resize our arrays of containers to hold data for wide band data and a given number of narrow band spectral windows.

i is the number of narrow band spectral windows.

void DataLoadingBuf::resizeForSpWin ( Int  winid,
Int  nchan 
) [inline]

resize the containers for a given window to the given number of channels

Definition at line 178 of file DataLoadingBuf.h.

References casacore::False, flgslist, visForSpWin(), and vislist.

Vector<Float>& DataLoadingBuf::sigma (  )  [inline]

return a reference to the sigma vector

Definition at line 175 of file DataLoadingBuf.h.

References rms.

Matrix<Complex>& DataLoadingBuf::visForSpWin ( Int  winid  )  [inline]

return a reference to the vis Matrix for a given window

Definition at line 165 of file DataLoadingBuf.h.

References vislist.

Referenced by nchanForSpWin(), and resizeForSpWin().

Vector<Float>& DataLoadingBuf::weight (  )  [inline]

return a reference to the weight vector

Definition at line 172 of file DataLoadingBuf.h.

References wt.


Member Data Documentation

Block< Cube<Bool>* > DataLoadingBuf::flgslist [private]

Definition at line 130 of file DataLoadingBuf.h.

Referenced by flagsForSpWin(), resizeForNpol(), and resizeForSpWin().

Vector<Float> DataLoadingBuf::rms [private]

Definition at line 132 of file DataLoadingBuf.h.

Referenced by resizeForNpol(), and sigma().

Block< Matrix<Complex>* > DataLoadingBuf::vislist [private]

Definition at line 129 of file DataLoadingBuf.h.

Referenced by resizeForNpol(), resizeForSpWin(), and visForSpWin().

Vector<Float> DataLoadingBuf::wt [private]

Definition at line 131 of file DataLoadingBuf.h.

Referenced by resizeForNpol(), and weight().


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