casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DataLoadingBuf Class Reference

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

#include <DataLoadingBuf.h>

Public Member Functions

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

Private Member Functions

 DataLoadingBuf (DataLoadingBuf &)
 

Private Attributes

casacore::Block
< casacore::Matrix
< casacore::Complex > * > 
vislist
 
casacore::Block
< casacore::Cube
< casacore::Bool > * > 
flgslist
 
casacore::Vector< casacore::Floatwt
 
casacore::Vector< casacore::Floatrms
 

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 casacore::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 casacore::Matrix<casacore::Complex> to store the visibility data and a casacore::Cube<casacore::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.

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

Now to use the buffers...

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

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

return a reference to the flags casacore::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, and casacore::Block< T >::nelements().

casacore::Int DataLoadingBuf::nchanForSpWin ( casacore::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 casacore::Matrix< T >::ncolumn(), and visForSpWin().

void DataLoadingBuf::resizeForNpol ( casacore::Int  npol)
inline

resize the containers for a given number of polarization correlations

Definition at line 194 of file DataLoadingBuf.h.

References flgslist, casacore::Block< T >::nelements(), casacore::Vector< T >::resize(), casacore::Block< T >::resize(), rms, vislist, and wt.

void DataLoadingBuf::resizeForNspect ( casacore::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 ( casacore::Int  winid,
casacore::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 flgslist, casacore::Block< T >::nelements(), visForSpWin(), and vislist.

casacore::Vector<casacore::Float>& DataLoadingBuf::sigma ( )
inline

return a reference to the sigma vector

Definition at line 175 of file DataLoadingBuf.h.

References rms.

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

return a reference to the vis casacore::Matrix for a given window

Definition at line 165 of file DataLoadingBuf.h.

References casacore::Block< T >::nelements(), and vislist.

Referenced by nchanForSpWin(), and resizeForSpWin().

casacore::Vector<casacore::Float>& DataLoadingBuf::weight ( )
inline

return a reference to the weight vector

Definition at line 172 of file DataLoadingBuf.h.

References wt.

Member Data Documentation

casacore::Block< casacore::Cube<casacore::Bool>* > DataLoadingBuf::flgslist
private

Definition at line 130 of file DataLoadingBuf.h.

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

casacore::Vector<casacore::Float> DataLoadingBuf::rms
private

Definition at line 132 of file DataLoadingBuf.h.

Referenced by resizeForNpol(), and sigma().

casacore::Block< casacore::Matrix<casacore::Complex>* > DataLoadingBuf::vislist
private

Definition at line 129 of file DataLoadingBuf.h.

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

casacore::Vector<casacore::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: