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

MSRange determines ranges of values in a MeasurementSet. More...

#include <MSRange.h>

Public Types

enum  {
  UNCHECKED,
  UNSELECTED,
  ALL
}
 

Public Member Functions

 MSRange ()
 Default constructor, only useful to assign to. More...
 
 MSRange (const MeasurementSet &ms)
 Construct from an MS. More...
 
 MSRange (const MSSelector &msSel)
 construct from an MSSelector, if this constructor is used, the data will be channel selected and polarization converted as specified in the MSSelector object, and the current selection is used in the range. More...
 
 MSRange (const MSRange &other)
 Copy constructor. More...
 
MSRangeoperator= (const MSRange &other)
 Assignment. More...
 
Record range (const Vector< String > &items, Bool useFlags=True, Bool OneBased=False)
 Return the range of values for each of the items specified in the record. More...
 
Record range (const Vector< Int > &items, Bool useFlags=True, Bool OneBased=False)
 Same as previous function, with Vector of MSS::Field keys instead of Strings. More...
 
Record range (MSS::Field item, Bool useFlags=True)
 Similar to above, with a single enum, for convenience. More...
 
void setBlockSize (Int blockSize=10)
 Set the block size (in Mbytes) to use when reading the data column. More...
 

Protected Member Functions

Bool checkShapes ()
 check the data description selection (one or more with same shape, or varying shape) More...
 
void scalarRange (Record &out, const String &item, const ScalarColumn< Int > &id, Bool oneBased)
 get the range of a ScalarColumn<Int>, correct for 1-based indexing if oneBased is True, and add to out record. More...
 
Vector< IntscalarRange (const ScalarColumn< Int > &id)
 get the range of a ScalarColumn<Int> More...
 
void minMax (Matrix< Float > &minmax, const Vector< Bool > &funcSel, const ArrayColumn< Complex > &data1, const ArrayColumn< Complex > &data2, const ArrayColumn< Bool > &flag, Int dataType, Bool useFlags)
 get the minimum and maximum of a Complex data column, after application of some function to convert to Float (e.g., real, amplitude,...). More...
 
void minMax (Float &mini, Float &maxi, const ArrayColumn< Float > &data, const ArrayColumn< Bool > &flag, Bool useFlags)
 get the minimum and maximum of a Float data column This function reads the data in blocks of size blockSize, as set by the setBlockSize function. More...
 
Vector< IntifrNumbers (const ScalarColumn< Int > &ant1, const ScalarColumn< Int > &ant2)
 Get the range of interferometer numbers given the antenna1 and antenna2 columns. More...
 

Private Types

enum  {
  Amp,
  Phase,
  Real,
  Imag,
  Data,
  nFuncType
}
 The function types. More...
 
enum  {
  Observed,
  Corrected,
  Model,
  Ratio,
  Residual,
  ObsResidual,
  ObsFloat,
  nDataType
}
 The data types. More...
 

Private Attributes

MeasurementSet ms_p
 
Int blockSize_p
 
Vector< IntddId_p
 
Vector< uIntspwId_p
 
Vector< uIntpolId_p
 
Bool constantShape_p
 
const MSSelectorsel_p
 

Detailed Description

MSRange determines ranges of values in a MeasurementSet.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

MSRange is a class that determines ranges of values in an MS

Synopsis

This class is used to determine the range of values present for the various columns in a MeasurementSet. This class is initialized from a MeasurementSet. If the MS contains more than one DATA_DESC_ID, it can be preselected on this to allow a consistent set of frequencies to be returned. The ms DO provides access to this class from glish and GUIs.

Example

MSRange myRange(myMS);
Vector<String> items(3);
// fill in some fields
items(0)="field_id";
items(1)="time";
items(2)="data_desc_id";
// get the range of values for the items specified
cout << myRange.range(items)<<endl;
// sample output: range=[field_id=[0,1,2],time=[4.5e9, 4.51e9],
// data_desc_id=[0,1,2]];
// Now preselect on data_desc_id
MSSelector mss(myMS);
Vector<Int> dd(2); dd(0)=1; dd(1)=2;
mss.selectinit(0,dd); // select data desc ids 1 and 2
MSRange r2(mss);
items(2)="amplitude";
cout<< r2.range(items)<<endl;
// sample output: [field_id=[0,1,2],time=[4.5e9, 4.51e9],
// amplitude=[0.00132,1.543]]

Motivation

Finding out the range of values in a column is often needed before a sensible selection of data can be made. This class, formerly part of MSSelector, separates out this functionality.

Thrown Exceptions

To Do

Definition at line 106 of file MSRange.h.

Member Enumeration Documentation

anonymous enum
Enumerator
UNCHECKED 

spectral window selection and shapes have not been checked

UNSELECTED 

multiple spectral windows with varying shapes

ALL 

multiple spectral windows with same shape

Definition at line 109 of file MSRange.h.

anonymous enum
private

The function types.

Enumerator
Amp 
Phase 
Real 
Imag 
Data 
nFuncType 

Definition at line 203 of file MSRange.h.

anonymous enum
private

The data types.

Enumerator
Observed 
Corrected 
Model 
Ratio 
Residual 
ObsResidual 
ObsFloat 
nDataType 

Definition at line 206 of file MSRange.h.

Constructor & Destructor Documentation

casacore::MSRange::MSRange ( )

Default constructor, only useful to assign to.

casacore::MSRange::MSRange ( const MeasurementSet ms)
explicit

Construct from an MS.

casacore::MSRange::MSRange ( const MSSelector msSel)
explicit

construct from an MSSelector, if this constructor is used, the data will be channel selected and polarization converted as specified in the MSSelector object, and the current selection is used in the range.

casacore::MSRange::MSRange ( const MSRange other)

Copy constructor.

Member Function Documentation

Bool casacore::MSRange::checkShapes ( )
protected

check the data description selection (one or more with same shape, or varying shape)

Vector<Int> casacore::MSRange::ifrNumbers ( const ScalarColumn< Int > &  ant1,
const ScalarColumn< Int > &  ant2 
)
protected

Get the range of interferometer numbers given the antenna1 and antenna2 columns.

void casacore::MSRange::minMax ( Matrix< Float > &  minmax,
const Vector< Bool > &  funcSel,
const ArrayColumn< Complex > &  data1,
const ArrayColumn< Complex > &  data2,
const ArrayColumn< Bool > &  flag,
Int  dataType,
Bool  useFlags 
)
protected

get the minimum and maximum of a Complex data column, after application of some function to convert to Float (e.g., real, amplitude,...).

This function reads the data in blocks of size blockSize, as set by the setBlockSize function.

void casacore::MSRange::minMax ( Float mini,
Float maxi,
const ArrayColumn< Float > &  data,
const ArrayColumn< Bool > &  flag,
Bool  useFlags 
)
protected

get the minimum and maximum of a Float data column This function reads the data in blocks of size blockSize, as set by the setBlockSize function.

MSRange& casacore::MSRange::operator= ( const MSRange other)

Assignment.

Record casacore::MSRange::range ( const Vector< String > &  items,
Bool  useFlags = True,
Bool  OneBased = False 
)

Return the range of values for each of the items specified in the record.

For index-like items a list of values is returned, for non-index items the minimum and maximum are returned. Items with varying array shape will not be returned by this function (i.e. you may need to preselect the MS passed to MSRange). See the enum description in MSSelector for the list of supported items. Use the data flags if useFlags is True. Correct for one-based indexing if oneBased is True.

Record casacore::MSRange::range ( const Vector< Int > &  items,
Bool  useFlags = True,
Bool  OneBased = False 
)

Same as previous function, with Vector of MSS::Field keys instead of Strings.

Record casacore::MSRange::range ( MSS::Field  item,
Bool  useFlags = True 
)

Similar to above, with a single enum, for convenience.

void casacore::MSRange::scalarRange ( Record out,
const String item,
const ScalarColumn< Int > &  id,
Bool  oneBased 
)
protected

get the range of a ScalarColumn<Int>, correct for 1-based indexing if oneBased is True, and add to out record.

Vector<Int> casacore::MSRange::scalarRange ( const ScalarColumn< Int > &  id)
protected

get the range of a ScalarColumn<Int>

void casacore::MSRange::setBlockSize ( Int  blockSize = 10)

Set the block size (in Mbytes) to use when reading the data column.

The default is 10 MB. Actual memory used is higher due to temporaries and caching.

Member Data Documentation

Int casacore::MSRange::blockSize_p
private

Definition at line 209 of file MSRange.h.

Bool casacore::MSRange::constantShape_p
private

Definition at line 213 of file MSRange.h.

Vector<Int> casacore::MSRange::ddId_p
private

Definition at line 210 of file MSRange.h.

MeasurementSet casacore::MSRange::ms_p
private

Definition at line 208 of file MSRange.h.

Vector<uInt> casacore::MSRange::polId_p
private

Definition at line 212 of file MSRange.h.

const MSSelector* casacore::MSRange::sel_p
private

Definition at line 214 of file MSRange.h.

Vector<uInt> casacore::MSRange::spwId_p
private

Definition at line 211 of file MSRange.h.


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