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

#include <SubMS.h>

Inheritance diagram for casa::SubMS:
casa::SimpleSubMS

List of all members.

Public Types

enum  RegriddingAlternatives {
  useFFTShift,
  useLinIntThenFFTShift
}
enum  asdmStManUseAlternatives {
  DONT,
  USE_FOR_DATA,
  USE_FOR_DATA_WEIGHT_SIGMA_FLAG
}

Public Member Functions

 SubMS (String &theMS, Table::TableOption option=Table::Old)
 SubMS (MeasurementSet &ms)
 construct from an MS
virtual ~SubMS ()
void setMS (MeasurementSet &ms)
 Change or Set the MS this MSSelector refers to.
Bool selectSpw (const String &spwstr, const Vector< Int > &steps)
 Select spw and channels for each spw.
void selectSpw (Vector< Int > spw, Vector< Int > nchan, Vector< Int > start, Vector< Int > step)
 This older version is used by the older version of setmsselect().
Bool selectCorrelations (const String &corrstr)
 Setup polarization selection (for now, only from available correlations - no Stokes transformations.)
Bool setmsselect (const String &spw="", const String &field="", const String &baseline="", const String &scan="", const String &uvrange="", const String &taql="", const Vector< Int > &step=Vector< Int >(1, 1), const String &subarray="", const String &correlation="", const String &intent="", const String &obs="")
 select Time and time averaging or regridding void selectTime();
void setmsselect (const String &spw, const String &field, const String &baseline, const String &scan, const String &obs, const String &uvrange, const String &taql, const Vector< Int > &nchan, const Vector< Int > &start, const Vector< Int > &step, const String &subarray)
 This older version does not return a success value, and does need nchan, start, and step.
Bool selectSource (const Vector< Int > &fieldid)
 Select source or field.
void selectAntenna (const Vector< Int > &antennaids, const Vector< String > &antennaSel)
 Select Antennas to split out.
void selectArray (const String &subarray)
 Select array IDs to use.
void selectTime (Double timeBin=-1.0, String timerng="")
 select time parameters
void setFitOrder (Int fitorder, Bool advise=true)
 void selectSource(Vector<String> sourceid);
void setFitSpw (const String &fitspw)
 Set the selection string for line-free channels.
void setFitOutSpw (const String &fitoutspw)
 Selection string for output channels if doing continuum subtraction.
Bool makeSubMS (String &submsname, String &whichDataCol, const Vector< Int > &tileShape=Vector< Int >(1, 0), const String &combine="")
 Method to make the subMS.
virtual MeasurementSetmakeScratchSubMS (const Vector< MS::PredefinedColumns > &whichDataCols, const Bool forceInMemory=False)
 Method to make a scratch subMS and even in memory if posssible Useful if temporary subselection/averaging is necessary It'll be in memory if the basic output ms is less than half of memory reported by HostInfo unless forced to by user...
virtual MeasurementSetmakeScratchSubMS (const String &whichDataCol, const Bool forceInMemory=False)
 In this form whichDataCol gets passed to parseColumnNames().
void verifyColumns (const MeasurementSet &ms, const Vector< MS::PredefinedColumns > &colNames)
Int regridSpw (String &message, const String &outframe="", const String &regridQuant="chan", const Double regridVeloRestfrq=-3E30, const String &regridInterpMeth="LINEAR", const Double regridCenter=-3E30, const Double regridBandwidth=-1., const Double regridChanWidth=-1., const Bool doHanningSmooth=False, const Int phaseCenterFieldId=-2, MDirection phaseCenter=MDirection(), const Bool centerIsStart=False, const Bool startIsEnd=False, const Int nchan=0, const Int width=0, const Int start=-1)
 Transform spectral data to different reference frame, optionally regrid the frequency channels return values: -1 = MS not modified, 1 = MS modified and OK, 0 = MS modified but not OK (i.e.
Bool createPartnerColumn (TableDesc &modMSTD, const String &oldName, const String &newName, const Int &hypercolumnDim, const IPosition &tileShape)
 Support method for regridSpw(): results in the column oldName being renamed to newName, and a new column which is an empty copy of oldName being created together with a TileShapeStMan data manager and hypercolumn (name copied from the old hypercolumn) with given dimension, the old hypercolumn of name hypercolumnName is renamed to name+"B".
Bool setRegridParameters (vector< Int > &oldSpwId, vector< Int > &oldFieldId, vector< Int > &newDataDescId, vector< Bool > &regrid, vector< Bool > &transform, vector< MDirection > &theFieldDirV, vector< MPosition > &mObsPosV, vector< MFrequency::Types > &fromFrameTypeV, vector< MFrequency::Ref > &outFrameV, vector< Vector< Double > > &xold, vector< Vector< Double > > &xout, vector< Vector< Double > > &xin, vector< Int > &method, Bool &msMod, const String &outframe, const String &regridQuant, const Double regridVeloRestfrq, const String &regridInterpMeth, const Double regridCenter, const Double regridBandwidth, const Double regridChanWidth, const Int regridPhaseCenterFieldId, const MDirection regridPhaseCenter, const Bool writeTables, LogIO &os, String &regridMessage, const Bool centerIsStart=False, const Bool startIsEnd=False, const Int nchan=0, const Int width=0, const Int start=-1)
 Support method for regridSpw(): if writeTables is False, the (const) input parameters are only verified, nothing is written; return value is True if the parameters are OK.
Bool combineSpws (const Vector< Int > &spwids, const Bool noModify, Vector< Double > &newCHAN_FREQ, Vector< Double > &newCHAN_WIDTH, Bool verbose=False)
 combineSpws(): make one spectral window from all spws given by the spwids vector
Bool combineSpws (const Vector< Int > &spwids=Vector< Int >(1,-1))

Static Public Member Functions

static std::set< IntfindBadSpws (MeasurementSet &ms, Vector< Int > spwv)
 Returns the set (possibly empty) of spectral windows that are in spwv but not listed in ms's DATA_DESCRIPTION subtable.
static Bool pickAntennas (Vector< Int > &selected_antennaids, Vector< String > &selected_antenna_strs, const Vector< Int > &antennaids, const Vector< String > &antennaSel)
static MeasurementSetsetupMS (const String &msname, const Int nchan, const Int npol, const String &telescop, const Vector< MS::PredefinedColumns > &colNamesTok, const Int obstype=0, const Bool compress=False, const asdmStManUseAlternatives asdmStManUse=DONT)
 This sets up a default new ms Declared static as it can be (and is) called directly outside of SubMS.
static MeasurementSetsetupMS (const String &msname, const Int nchan, const Int npol, const Vector< MS::PredefinedColumns > &colNamesTok, const Vector< Int > &tileShape=Vector< Int >(1, 0), const Bool compress=False, const asdmStManUseAlternatives asdmStManUse=DONT)
 Same as above except allowing manual tileshapes.
static uInt addOptionalColumns (const Table &inTab, Table &outTab, const Bool beLazy=false)
 Add optional columns to outTab if present in inTab and possColNames.
static Bool copyCols (Table &out, const Table &in, const Bool flush=True)
 Like TableCopy::copyRows, but by column.
static void createSubtables (MeasurementSet &ms, Table::TableOption option)
 A customized version of MS::createDefaultSubtables().
static const Vector
< MS::PredefinedColumns > & 
parseColumnNames (String colNameList)
 Declared static because it's used in setupMS().
static const Vector
< MS::PredefinedColumns > & 
parseColumnNames (String colNameList, const MeasurementSet &ms)
 This version uses the MeasurementSet to check what columns are present, i.e.
static Bool mustConvertToData (const uInt nTok, const Vector< MS::PredefinedColumns > &datacols)
 The output MS must have (at least?) 1 of DATA, FLOAT_DATA, or LAG_DATA.
static Bool sepFloat (const Vector< MS::PredefinedColumns > &anyDataCols, Vector< MS::PredefinedColumns > &complexDataCols)
static Bool getCorrMaps (MSSelection &mssel, const MeasurementSet &ms, Vector< Vector< Int > > &outToIn, const Bool areSelecting=false)
 Fills outToIn[pol] with a map from output correlation index to input correlation index, for each input polID pol.
static void remap (Vector< Int > &col, const Vector< Int > &mapper)
 Replaces col[i] with mapper[col[i]] for each element of col.
static void remap (Vector< Int > &col, const std::map< Int, Int > &mapper)
static lDouble vrad (const lDouble freq, const lDouble rest)
 the following inline convenience methods for regridSpw bypass the whole CASA measure system because when they are used, they can assume that the frame stays the same and the units are OK
static lDouble vopt (const lDouble freq, const lDouble rest)
static lDouble lambda (const lDouble freq)
static lDouble freq_from_vrad (const lDouble vrad, const lDouble rest)
static lDouble freq_from_vopt (const lDouble vopt, const lDouble rest)
static lDouble freq_from_lambda (const lDouble lambda)
static Bool regridChanBounds (Vector< Double > &newChanLoBound, Vector< Double > &newChanHiBound, const Double regridCenter, const Double regridBandwidth, const Double regridChanWidth, const Double regridVeloRestfrq, const String regridQuant, const Vector< Double > &transNewXin, const Vector< Double > &transCHAN_WIDTH, String &message, const Bool centerIsStart=False, const Bool startIsEnd=False, const Int nchan=0, const Int width=0, const Int start=-1)
 Support method for regridSpw(): calculate the final new channel boundaries from the regridding parameters and the old channel boundaries (already transformed to the desired reference frame); returns False if input paramters were invalid and no useful boundaries could be created.
static Bool convertGridPars (LogIO &os, const String &mode, const int nchan, const String &start, const String &width, const String &interp, const String &restfreq, const String &outframe, const String &veltype, String &t_mode, String &t_outframe, String &t_regridQuantity, Double &t_restfreq, String &t_regridInterpMeth, Double &t_cstart, Double &t_bandwidth, Double &t_cwidth, Bool &t_centerIsStart, Bool &t_startIsEnd, Int &t_nchan, Int &t_width, Int &t_start)
 a helper function for handling the gridding parameter user input
static Bool calcChanFreqs (LogIO &os, Vector< Double > &newCHAN_FREQ, Vector< Double > &newCHAN_WIDTH, const Vector< Double > &oldCHAN_FREQ, const Vector< Double > &oldCHAN_WIDTH, const MDirection phaseCenter, const MFrequency::Types theOldRefFrame, const MEpoch theObsTime, const MPosition mObsPos, const String &mode, const int nchan, const String &start, const String &width, const String &restfreq, const String &outframe, const String &veltype, Bool verbose=False, MRadialVelocity mRV=MRadialVelocity())
 A wrapper for SubMS::regridChanBounds() which takes the user interface type gridding parameters The ready-made grid is returned in newCHAN_FREQ and newCHAN_WIDTH.
static void getDataColMap (MSColumns *msc, ArrayColumn< Complex > *mapper, uInt ntok, const Vector< MS::PredefinedColumns > &colEnums)
 Fills mapper[ntok] with a map from dataColumn indices to ArrayColumns in the output.

Protected Member Functions

Bool makeSelection ()
 method that returns the selected ms (?! - but it's Boolean - RR)
Bool fillAllTables (const Vector< MS::PredefinedColumns > &colNames)
 (Sub)table fillers.
Bool fillDDTables ()
Bool fillFieldTable ()
Bool writeAllMainRows (const Vector< MS::PredefinedColumns > &colNames)
 Used to be fillMainTable(colnames), but what distinguishes it from writeSomeMainRows(colnames) is that it is for cases where there is a 1-1 match between rows in mssel_p and msOut_p (including order).
Bool writeSomeMainRows (const Vector< MS::PredefinedColumns > &colNames)
 Used to be fillAverMainTable(colnames), but what distinguishes it from writeAllMainRows(colnames) is that it is for cases where there is not necessarily a 1-1 match between rows in mssel_p and msOut_p.
Bool copyAntenna ()
Bool copyFeed ()
Bool copyFlag_Cmd ()
Bool copyHistory ()
Bool copyObservation ()
Bool copyPointing ()
Bool copyProcessor ()
Bool copySource ()
Bool copyState ()
Bool copySyscal ()
Bool copyWeather ()
Bool copyGenericSubtables ()
Bool filterOptSubtable (const String &subtabname)
 This falls between copyGenericSubtables() and the copiers for standard subtables like copyFeed().
Bool fillAccessoryMainCols ()
 Bool writeDiffSpwShape(const Vector<MS::PredefinedColumns>& colNames);.
void copySubtable (const String &tabName, const Table &inTab, const Bool noRows=False)
 *** Private member functions ***
Bool getDataColumn (ROArrayColumn< Complex > &data, const MS::PredefinedColumns colName)
Bool getDataColumn (ROArrayColumn< Float > &data, const MS::PredefinedColumns colName)
Bool putDataColumn (MSColumns &msc, ROArrayColumn< Complex > &data, const MS::PredefinedColumns datacol, const Bool writeToDataCol=False)
Bool putDataColumn (MSColumns &msc, ROArrayColumn< Float > &data, const MS::PredefinedColumns datacol, const Bool writeToDataCol=False)
Bool copyDataFlagsWtSp (const Vector< MS::PredefinedColumns > &colNames, const Bool writeToDataCol)
 This method uses VisIter for efficient copy mode data transfer.
Bool subtractContinuum (const Vector< MS::PredefinedColumns > &colNames, const VBRemapper &remapper)
 Like doTimeAver(), but it subtracts the continuum instead of time averaging.
Bool doChannelMods (const Vector< MS::PredefinedColumns > &colNames)
void fill_vbmaps (std::map< VisBufferComponents::EnumType, std::map< Int, Int > > &vbmaps)
Double n_bytes ()
 return the number of unique antennas selected Int numOfBaselines(Vector<Int>& ant1, Vector<Int>& ant2, Bool includeAutoCorr=False);
const ROArrayColumn< Complex > & right_column (const ROMSColumns *ms_p, const MS::PredefinedColumns datacol)
 Picks a reference to DATA, MODEL_DATA, CORRECTED_DATA, or LAG_DATA out of ms_p.
ArrayColumn< Complex > & right_column (MSColumns *msclala, const MS::PredefinedColumns col, const Bool writeToDataCol)
 The writable version of the above.
uInt fillAntIndexer (std::map< Int, Int > &antIndexer, const ROMSColumns *msc)
 Figures out the number, maximum, and index of the selected antennas.
Bool doTimeAver (const Vector< MS::PredefinedColumns > &dataColNames, const VBRemapper &remapper)
 Read the input, time average it to timeBin_p, and write the output.
Bool doTimeAverVisIterator (const Vector< MS::PredefinedColumns > &dataColNames, const VBRemapper &remapper)
void getDataColMap (ArrayColumn< Complex > *mapper, uInt ntok, const Vector< MS::PredefinedColumns > &colEnums)
Bool areDataShapesConstant ()
 Returns whether or not the numbers of correlations and channels are independent of DATA_DESCRIPTION_ID, for both the input and output MSes.
Bool existsFlagCategory () const
 Returns whether or not the input MS has a valid FLAG_CATEGORY, and its first row has the right number of correlations and channels.
void relabelSources ()
 Sets up sourceRelabel_p for mapping input SourceIDs (if any) to output ones.
void relabelIDs ()
void remapColumn (ScalarColumn< Int > &outcol, const ROScalarColumn< Int > &incol, const Vector< Int > &selvals)
 Sets outcol to the indices of selvals that correspond to incol, i.e.
void remapColumn (ScalarColumn< Int > &outcol, const ROScalarColumn< Int > &incol)
 Equivalent to but slightly more efficient than remapColumn(outcol, incol, incol.getColumn()).
uInt remapped (const Int ov, const Vector< Int > &mapper, uInt i)
void setupNewPointing ()
 Sets up the stub of a POINTING, enough to create an MSColumns.
Bool setSortOrder (Block< Int > &sort, const String &uncombinable="", const Bool verbose=true) const
 Sets sort to a Block of columns that a VisibilityIterator should sort by, according to combine_p.
Bool shouldWatch (Bool &conflict, const String &col, const String &uncombinable="", const Bool verbose=true) const
 Returns whether col is (not in combine_p) || in uncombinable.

Static Protected Member Functions

static uInt dataColStrToEnums (const String &col, Vector< MS::PredefinedColumns > &colvec)
 Helper function for parseColumnNames().
static void make_map (std::map< Int, Int > &mapper, const Vector< Int > &inv)
 static void make_map(const Vector<Int>& mscol, Vector<Int>& mapper);
static void make_map2 (std::map< Int, Int > &mapper, const Vector< Int > &inv)
 Sets mapper to form a map from inv whose elements are mapped values.

Protected Attributes

MeasurementSet ms_p
 *** Member variables ***
MeasurementSet mssel_p
MSColumnsmsc_p
ROMSColumnsmscIn_p
Bool keepShape_p
Bool antennaSel_p
 same shape as the corresponding input one.
Double timeBin_p
String scanString_p
String intentString_p
String obsString_p
String uvrangeString_p
String taqlString_p
String timeRange_p
String arrayExpr_p
String corrString_p
String combine_p
Int fitorder_p
 scan #, observation, and/or state ID? Must be lowercase at all times.
String fitspw_p
 If < 0 (default), continuum subtraction is not done.
String fitoutspw_p
Bool fillMainTable_p
 continuum subtraction.
MeasurementSet msOut_p
 Uninitialized by ctors.
Vector< Intspw_p
Vector< Intspw_uniq_p
Vector< Intspwind_to_min_spwind_p
Vector< Intnchan_p
Vector< Inttotnchan_p
Vector< IntchanStart_p
Vector< IntchanEnd_p
Vector< IntchanStep_p
Vector< Intwidths_p
 input channel will be used.
Vector< Intncorr_p
Vector< IntinNumChan_p
Vector< IntinNumCorr_p
Vector< Intfieldid_p
Vector< IntspwRelabel_p
Vector< IntfieldRelabel_p
Vector< IntsourceRelabel_p
Vector< IntoldDDSpwMatch_p
Vector< StringantennaSelStr_p
Vector< IntantennaId_p
Vector< IntantIndexer_p
Vector< IntantNewIndex_p
Vector< IntselObsId_p
Vector< IntpolID_p
Vector< uIntspw2ddid_p
Vector< Vector< Int > > inPolOutCorrToInCorrMap_p
 inCorrInd = outPolCorrToInCorrMap_p[polID_p[ddID]][outCorrInd]
std::map< Int, IntstateRemapper_p
Vector< Vector< Slice > > chanSlices_p
Vector< SlicecorrSlice_p
Vector< Vector< Slice > > corrSlices_p
Matrix< DoubleselTimeRanges_p

Friends

class MSTransformDataHandler
 jagonzal: Allow TransformVisDataHandler to access protected methods and members of this class

Detailed Description

Definition at line 103 of file SubMS.h.


Member Enumeration Documentation

Enumerator:
DONT 
USE_FOR_DATA 
USE_FOR_DATA_WEIGHT_SIGMA_FLAG 

Definition at line 116 of file SubMS.h.

Enumerator:
useFFTShift 
useLinIntThenFFTShift 

Definition at line 111 of file SubMS.h.


Constructor & Destructor Documentation

construct from an MS

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

Member Function Documentation

static uInt casa::SubMS::addOptionalColumns ( const Table inTab,
Table outTab,
const Bool  beLazy = false 
) [static]

Add optional columns to outTab if present in inTab and possColNames.

beLazy should only be true if outTab is in its default state. Returns the number of added columns.

Returns whether or not the numbers of correlations and channels are independent of DATA_DESCRIPTION_ID, for both the input and output MSes.

static Bool casa::SubMS::calcChanFreqs ( LogIO os,
Vector< Double > &  newCHAN_FREQ,
Vector< Double > &  newCHAN_WIDTH,
const Vector< Double > &  oldCHAN_FREQ,
const Vector< Double > &  oldCHAN_WIDTH,
const MDirection  phaseCenter,
const MFrequency::Types  theOldRefFrame,
const MEpoch  theObsTime,
const MPosition  mObsPos,
const String mode,
const int  nchan,
const String start,
const String width,
const String restfreq,
const String outframe,
const String veltype,
Bool  verbose = False,
MRadialVelocity  mRV = MRadialVelocity() 
) [static]

A wrapper for SubMS::regridChanBounds() which takes the user interface type gridding parameters The ready-made grid is returned in newCHAN_FREQ and newCHAN_WIDTH.

Parameters:
newCHAN_FREQoutput
oldCHAN_FREQinput
phaseCenterthe gridding parameters
Bool casa::SubMS::combineSpws ( const Vector< Int > &  spwids,
const Bool  noModify,
Vector< Double > &  newCHAN_FREQ,
Vector< Double > &  newCHAN_WIDTH,
Bool  verbose = False 
)

combineSpws(): make one spectral window from all spws given by the spwids vector

Referenced by combineSpws().

Bool casa::SubMS::combineSpws ( const Vector< Int > &  spwids = Vector<Int>(1,-1)) [inline]

Definition at line 462 of file SubMS.h.

References combineSpws(), casa::False, and casa::True.

static Bool casa::SubMS::convertGridPars ( LogIO os,
const String mode,
const int  nchan,
const String start,
const String width,
const String interp,
const String restfreq,
const String outframe,
const String veltype,
String t_mode,
String t_outframe,
String t_regridQuantity,
Double t_restfreq,
String t_regridInterpMeth,
Double t_cstart,
Double t_bandwidth,
Double t_cwidth,
Bool t_centerIsStart,
Bool t_startIsEnd,
Int t_nchan,
Int t_width,
Int t_start 
) [static]

a helper function for handling the gridding parameter user input

Bool casa::SubMS::copyAntenna ( ) [protected]
static Bool casa::SubMS::copyCols ( Table out,
const Table in,
const Bool  flush = True 
) [static]

Like TableCopy::copyRows, but by column.

Bool casa::SubMS::copyDataFlagsWtSp ( const Vector< MS::PredefinedColumns > &  colNames,
const Bool  writeToDataCol 
) [protected]

This method uses VisIter for efficient copy mode data transfer.

Bool casa::SubMS::copyFeed ( ) [protected]
Bool casa::SubMS::copyHistory ( ) [protected]
Bool casa::SubMS::copySource ( ) [protected]
Bool casa::SubMS::copyState ( ) [protected]
void casa::SubMS::copySubtable ( const String tabName,
const Table inTab,
const Bool  noRows = False 
) [protected]

*** Private member functions ***

Adds and copies inTab to msOut_p without any filtering. tabName is the table "type", i.e. POINTING or SYSPOWER without the preceding path.

If noRows is True, the structure will be setup but no rows will be copied. (Useful for filtering)

Bool casa::SubMS::copySyscal ( ) [protected]
Bool casa::SubMS::copyWeather ( ) [protected]
Bool casa::SubMS::createPartnerColumn ( TableDesc modMSTD,
const String oldName,
const String newName,
const Int hypercolumnDim,
const IPosition tileShape 
)

Support method for regridSpw(): results in the column oldName being renamed to newName, and a new column which is an empty copy of oldName being created together with a TileShapeStMan data manager and hypercolumn (name copied from the old hypercolumn) with given dimension, the old hypercolumn of name hypercolumnName is renamed to name+"B".

static void casa::SubMS::createSubtables ( MeasurementSet ms,
Table::TableOption  option 
) [static]

A customized version of MS::createDefaultSubtables().

static uInt casa::SubMS::dataColStrToEnums ( const String col,
Vector< MS::PredefinedColumns > &  colvec 
) [static, protected]

Helper function for parseColumnNames().

Converts col to a list of MS::PredefinedColumnss, and returns the # of recognized data columns. static because parseColumnNames() is static.

Bool casa::SubMS::doChannelMods ( const Vector< MS::PredefinedColumns > &  colNames) [protected]
Bool casa::SubMS::doTimeAver ( const Vector< MS::PredefinedColumns > &  dataColNames,
const VBRemapper remapper 
) [protected]

Read the input, time average it to timeBin_p, and write the output.

The first version uses VisibilityIterator (much faster), but the second supports correlation selection using VisIterator. VisIterator should be sped up soon!

Bool casa::SubMS::doTimeAverVisIterator ( const Vector< MS::PredefinedColumns > &  dataColNames,
const VBRemapper remapper 
) [protected]
Bool casa::SubMS::existsFlagCategory ( ) const [protected]

Returns whether or not the input MS has a valid FLAG_CATEGORY, and its first row has the right number of correlations and channels.

void casa::SubMS::fill_vbmaps ( std::map< VisBufferComponents::EnumType, std::map< Int, Int > > &  vbmaps) [protected]

Bool writeDiffSpwShape(const Vector<MS::PredefinedColumns>& colNames);.

Bool casa::SubMS::fillAllTables ( const Vector< MS::PredefinedColumns > &  colNames) [protected]

(Sub)table fillers.

uInt casa::SubMS::fillAntIndexer ( std::map< Int, Int > &  antIndexer,
const ROMSColumns msc 
) [protected]

Figures out the number, maximum, and index of the selected antennas.

Bool casa::SubMS::filterOptSubtable ( const String subtabname) [protected]

This falls between copyGenericSubtables() and the copiers for standard subtables like copyFeed().

It is for optional subtables like CALDEVICE and SYSPOWER which can be watched for by name and may need their ANTENNA_ID and SPECTRAL_WINDOW_ID columns remapped. (Technically FEED_ID, too, if split ever starts remapping feeds.)

It must be called BEFORE copyGenericSubtables()!

static std::set<Int> casa::SubMS::findBadSpws ( MeasurementSet ms,
Vector< Int spwv 
) [static]

Returns the set (possibly empty) of spectral windows that are in spwv but not listed in ms's DATA_DESCRIPTION subtable.

(This happens with certain calibration/hardware setups.)

static lDouble casa::SubMS::freq_from_lambda ( const lDouble  lambda) [inline, static]

Definition at line 332 of file SubMS.h.

References casa::C::c.

static lDouble casa::SubMS::freq_from_vopt ( const lDouble  vopt,
const lDouble  rest 
) [inline, static]

Definition at line 331 of file SubMS.h.

References casa::C::c.

static lDouble casa::SubMS::freq_from_vrad ( const lDouble  vrad,
const lDouble  rest 
) [inline, static]

Definition at line 330 of file SubMS.h.

References casa::C::c.

static Bool casa::SubMS::getCorrMaps ( MSSelection mssel,
const MeasurementSet ms,
Vector< Vector< Int > > &  outToIn,
const Bool  areSelecting = false 
) [static]

Fills outToIn[pol] with a map from output correlation index to input correlation index, for each input polID pol.

It does not yet check the appropriateness of the correlation selection string, so ignore the return value for now. outToIn[pol] defaults to an empty Vector if no correlations are selected for pol. That is not the same as the default "select everything in ms".

static void casa::SubMS::getDataColMap ( MSColumns msc,
ArrayColumn< Complex > *  mapper,
uInt  ntok,
const Vector< MS::PredefinedColumns > &  colEnums 
) [static]

Fills mapper[ntok] with a map from dataColumn indices to ArrayColumns in the output.

mapper must have ntok slots!

Referenced by getDataColMap().

void casa::SubMS::getDataColMap ( ArrayColumn< Complex > *  mapper,
uInt  ntok,
const Vector< MS::PredefinedColumns > &  colEnums 
) [inline, protected]

Definition at line 594 of file SubMS.h.

References getDataColMap(), and msc_p.

Bool casa::SubMS::getDataColumn ( ROArrayColumn< Complex > &  data,
const MS::PredefinedColumns  colName 
) [protected]
Bool casa::SubMS::getDataColumn ( ROArrayColumn< Float > &  data,
const MS::PredefinedColumns  colName 
) [protected]
static lDouble casa::SubMS::lambda ( const lDouble  freq) [inline, static]

Definition at line 329 of file SubMS.h.

References casa::C::c.

static void casa::SubMS::make_map ( std::map< Int, Int > &  mapper,
const Vector< Int > &  inv 
) [static, protected]

static void make_map(const Vector<Int>& mscol, Vector<Int>& mapper);

Sets mapper to to a map from the distinct values of inv, in increasing order, to 0, 1, 2, ..., mapper.size() - 1.

static void casa::SubMS::make_map2 ( std::map< Int, Int > &  mapper,
const Vector< Int > &  inv 
) [static, protected]

Sets mapper to form a map from inv whose elements are mapped values.

It skips to store in mapper if the value is -1

virtual MeasurementSet* casa::SubMS::makeScratchSubMS ( const Vector< MS::PredefinedColumns > &  whichDataCols,
const Bool  forceInMemory = False 
) [virtual]

Method to make a scratch subMS and even in memory if posssible Useful if temporary subselection/averaging is necessary It'll be in memory if the basic output ms is less than half of memory reported by HostInfo unless forced to by user...

virtual MeasurementSet* casa::SubMS::makeScratchSubMS ( const String whichDataCol,
const Bool  forceInMemory = False 
) [virtual]

In this form whichDataCol gets passed to parseColumnNames().

method that returns the selected ms (?! - but it's Boolean - RR)

Bool casa::SubMS::makeSubMS ( String submsname,
String whichDataCol,
const Vector< Int > &  tileShape = VectorInt >(1, 0),
const String combine = "" 
)

Method to make the subMS.

TileShape of size 1 can have 2 values [0], and [1] ...these are used in to determine the tileshape by using MSTileLayout. Otherwise it has to be a vector size 3 e.g [4, 15, 351] => a tile shape of 4 stokes, 15 channels 351 rows.

combine sets combine_p. (Columns to ignore while time averaging.)

static Bool casa::SubMS::mustConvertToData ( const uInt  nTok,
const Vector< MS::PredefinedColumns > &  datacols 
) [inline, static]

The output MS must have (at least?) 1 of DATA, FLOAT_DATA, or LAG_DATA.

MODEL_DATA or CORRECTED_DATA will be converted to DATA if necessary.

Definition at line 277 of file SubMS.h.

References casa::MSMainEnums::FLOAT_DATA, and casa::MSMainEnums::LAG_DATA.

Double casa::SubMS::n_bytes ( ) [inline, protected]

return the number of unique antennas selected Int numOfBaselines(Vector<Int>& ant1, Vector<Int>& ant2, Bool includeAutoCorr=False);

Used in a couple of places to estimate how much memory to grab.

Definition at line 569 of file SubMS.h.

References mssel_p, nchan_p, ncorr_p, and casa::Table::nrow().

static const Vector<MS::PredefinedColumns>& casa::SubMS::parseColumnNames ( String  colNameList) [static]

Declared static because it's used in setupMS().

Therefore it can't use any member variables. It is also used in MSFixvis.cc. colNameList is internally upcased, so it is not const or passed by reference.

static const Vector<MS::PredefinedColumns>& casa::SubMS::parseColumnNames ( String  colNameList,
const MeasurementSet ms 
) [static]

This version uses the MeasurementSet to check what columns are present, i.e.

it makes col=="all" smarter, and it is not necessary to call verifyColumns() after calling this. Unlike the other version, it knows about FLOAT_DATA and LAG_DATA. It throws an exception if a specifically requested column is absent.

static Bool casa::SubMS::pickAntennas ( Vector< Int > &  selected_antennaids,
Vector< String > &  selected_antenna_strs,
const Vector< Int > &  antennaids,
const Vector< String > &  antennaSel 
) [static]
Bool casa::SubMS::putDataColumn ( MSColumns msc,
ROArrayColumn< Complex > &  data,
const MS::PredefinedColumns  datacol,
const Bool  writeToDataCol = False 
) [protected]
Bool casa::SubMS::putDataColumn ( MSColumns msc,
ROArrayColumn< Float > &  data,
const MS::PredefinedColumns  datacol,
const Bool  writeToDataCol = False 
) [protected]
static Bool casa::SubMS::regridChanBounds ( Vector< Double > &  newChanLoBound,
Vector< Double > &  newChanHiBound,
const Double  regridCenter,
const Double  regridBandwidth,
const Double  regridChanWidth,
const Double  regridVeloRestfrq,
const String  regridQuant,
const Vector< Double > &  transNewXin,
const Vector< Double > &  transCHAN_WIDTH,
String message,
const Bool  centerIsStart = False,
const Bool  startIsEnd = False,
const Int  nchan = 0,
const Int  width = 0,
const Int  start = -1 
) [static]

Support method for regridSpw(): calculate the final new channel boundaries from the regridding parameters and the old channel boundaries (already transformed to the desired reference frame); returns False if input paramters were invalid and no useful boundaries could be created.

Int casa::SubMS::regridSpw ( String message,
const String outframe = "",
const String regridQuant = "chan",
const Double  regridVeloRestfrq = -3E30,
const String regridInterpMeth = "LINEAR",
const Double  regridCenter = -3E30,
const Double  regridBandwidth = -1.,
const Double  regridChanWidth = -1.,
const Bool  doHanningSmooth = False,
const Int  phaseCenterFieldId = -2,
MDirection  phaseCenter = MDirection(),
const Bool  centerIsStart = False,
const Bool  startIsEnd = False,
const Int  nchan = 0,
const Int  width = 0,
const Int  start = -1 
)

Transform spectral data to different reference frame, optionally regrid the frequency channels return values: -1 = MS not modified, 1 = MS modified and OK, 0 = MS modified but not OK (i.e.

MS is probably damaged)

void casa::SubMS::relabelIDs ( ) [protected]
void casa::SubMS::relabelSources ( ) [protected]

Sets up sourceRelabel_p for mapping input SourceIDs (if any) to output ones.

Must be called after fieldid_p is set and before calling fillFieldTable() or copySource().

static void casa::SubMS::remap ( Vector< Int > &  col,
const Vector< Int > &  mapper 
) [static]

Replaces col[i] with mapper[col[i]] for each element of col.

Does NOT check whether mapper[col[i]] is defined, but it does return right away (i.e. a no-op) if mapper is empty.

static void casa::SubMS::remap ( Vector< Int > &  col,
const std::map< Int, Int > &  mapper 
) [static]
void casa::SubMS::remapColumn ( ScalarColumn< Int > &  outcol,
const ROScalarColumn< Int > &  incol,
const Vector< Int > &  selvals 
) [protected]

Sets outcol to the indices of selvals that correspond to incol, i.e.

outcol(i) = j s.t. selvals[j] == incol(i).

Ideally selvals is set up so that outcol's values will be row numbers in the corresponding subtable of its ms.

Throws an exception if incol and outcol do not have the same # of rows, or incol has a value that is not in selvals.

void casa::SubMS::remapColumn ( ScalarColumn< Int > &  outcol,
const ROScalarColumn< Int > &  incol 
) [protected]

Equivalent to but slightly more efficient than remapColumn(outcol, incol, incol.getColumn()).

uInt casa::SubMS::remapped ( const Int  ov,
const Vector< Int > &  mapper,
uInt  i 
) [protected]
const ROArrayColumn<Complex>& casa::SubMS::right_column ( const ROMSColumns ms_p,
const MS::PredefinedColumns  datacol 
) [protected]

Picks a reference to DATA, MODEL_DATA, CORRECTED_DATA, or LAG_DATA out of ms_p.

FLOAT_DATA is not included because it is not natively complex.

ArrayColumn<Complex>& casa::SubMS::right_column ( MSColumns msclala,
const MS::PredefinedColumns  col,
const Bool  writeToDataCol 
) [protected]

The writable version of the above.

void casa::SubMS::selectAntenna ( const Vector< Int > &  antennaids,
const Vector< String > &  antennaSel 
) [inline]

Select Antennas to split out.

Definition at line 177 of file SubMS.h.

References antennaId_p, antennaSel_p, antennaSelStr_p, and pickAntennas().

void casa::SubMS::selectArray ( const String subarray) [inline]

Select array IDs to use.

Definition at line 189 of file SubMS.h.

References arrayExpr_p.

Setup polarization selection (for now, only from available correlations - no Stokes transformations.)

Bool casa::SubMS::selectSource ( const Vector< Int > &  fieldid)

Select source or field.

Bool casa::SubMS::selectSpw ( const String spwstr,
const Vector< Int > &  steps 
)

Select spw and channels for each spw.

This is the version used by split. It returns true on success and false on failure.

void casa::SubMS::selectSpw ( Vector< Int spw,
Vector< Int nchan,
Vector< Int start,
Vector< Int step 
)

This older version is used by the older version of setmsselect().

void casa::SubMS::selectTime ( Double  timeBin = -1.0,
String  timerng = "" 
)

select time parameters

static Bool casa::SubMS::sepFloat ( const Vector< MS::PredefinedColumns > &  anyDataCols,
Vector< MS::PredefinedColumns > &  complexDataCols 
) [static]
void casa::SubMS::setFitOrder ( Int  fitorder,
Bool  advise = true 
)

void selectSource(Vector<String> sourceid);

Method to set if a phase Center rotation is needed void setPhaseCenter(Int fieldid, MDirection& newPhaseCenter);

Sets the polynomial order for continuum fitting to fitorder. If < 0, continuum subtraction is not done.

void casa::SubMS::setFitOutSpw ( const String fitoutspw) [inline]

Selection string for output channels if doing continuum subtraction.

Definition at line 205 of file SubMS.h.

References fitoutspw_p.

void casa::SubMS::setFitSpw ( const String fitspw) [inline]

Set the selection string for line-free channels.

Definition at line 203 of file SubMS.h.

References fitspw_p.

Change or Set the MS this MSSelector refers to.

Bool casa::SubMS::setmsselect ( const String spw = "",
const String field = "",
const String baseline = "",
const String scan = "",
const String uvrange = "",
const String taql = "",
const Vector< Int > &  step = VectorInt >(1, 1),
const String subarray = "",
const String correlation = "",
const String intent = "",
const String obs = "" 
)

select Time and time averaging or regridding void selectTime();

select stuff using msselection syntax ...time is left out call it separately with timebin This version returns a success value, and does not need nchan, start, and step. It is used by split.

void casa::SubMS::setmsselect ( const String spw,
const String field,
const String baseline,
const String scan,
const String obs,
const String uvrange,
const String taql,
const Vector< Int > &  nchan,
const Vector< Int > &  start,
const Vector< Int > &  step,
const String subarray 
)

This older version does not return a success value, and does need nchan, start, and step.

It is used elsewhere (i.e. ImagerMultiMS).

Bool casa::SubMS::setRegridParameters ( vector< Int > &  oldSpwId,
vector< Int > &  oldFieldId,
vector< Int > &  newDataDescId,
vector< Bool > &  regrid,
vector< Bool > &  transform,
vector< MDirection > &  theFieldDirV,
vector< MPosition > &  mObsPosV,
vector< MFrequency::Types > &  fromFrameTypeV,
vector< MFrequency::Ref > &  outFrameV,
vector< Vector< Double > > &  xold,
vector< Vector< Double > > &  xout,
vector< Vector< Double > > &  xin,
vector< Int > &  method,
Bool msMod,
const String outframe,
const String regridQuant,
const Double  regridVeloRestfrq,
const String regridInterpMeth,
const Double  regridCenter,
const Double  regridBandwidth,
const Double  regridChanWidth,
const Int  regridPhaseCenterFieldId,
const MDirection  regridPhaseCenter,
const Bool  writeTables,
LogIO os,
String regridMessage,
const Bool  centerIsStart = False,
const Bool  startIsEnd = False,
const Int  nchan = 0,
const Int  width = 0,
const Int  start = -1 
)

Support method for regridSpw(): if writeTables is False, the (const) input parameters are only verified, nothing is written; return value is True if the parameters are OK.

if writeTables is True, the vectors are filled and the SPW, DD, and SOURCE tables are modified; the return value in this case is True only if a successful modification (or none) took place

Bool casa::SubMS::setSortOrder ( Block< Int > &  sort,
const String uncombinable = "",
const Bool  verbose = true 
) const [protected]

Sets sort to a Block of columns that a VisibilityIterator should sort by, according to combine_p.

Columns that should never be combined in the calling function, i.e. spw for time averaging, should be listed in uncombinable.

verbose: log a message on error.

Returns whether or not there were any conflicts between combine_p and uncombinable.

static MeasurementSet* casa::SubMS::setupMS ( const String msname,
const Int  nchan,
const Int  npol,
const String telescop,
const Vector< MS::PredefinedColumns > &  colNamesTok,
const Int  obstype = 0,
const Bool  compress = False,
const asdmStManUseAlternatives  asdmStManUse = DONT 
) [static]

This sets up a default new ms Declared static as it can be (and is) called directly outside of SubMS.

Therefore it is not dependent on any member variable.

static MeasurementSet* casa::SubMS::setupMS ( const String msname,
const Int  nchan,
const Int  npol,
const Vector< MS::PredefinedColumns > &  colNamesTok,
const Vector< Int > &  tileShape = VectorInt >(1, 0),
const Bool  compress = False,
const asdmStManUseAlternatives  asdmStManUse = DONT 
) [static]

Same as above except allowing manual tileshapes.

void casa::SubMS::setupNewPointing ( ) [protected]

Sets up the stub of a POINTING, enough to create an MSColumns.

Bool casa::SubMS::shouldWatch ( Bool conflict,
const String col,
const String uncombinable = "",
const Bool  verbose = true 
) const [protected]

Returns whether col is (not in combine_p) || in uncombinable.

Columns that should never be combined in the calling function, i.e. spw for time averaging, should be listed in uncombinable.

verbose: log a message on error.

conflict is set to true if there is a conflict between combine_p and uncombinable.

Bool casa::SubMS::subtractContinuum ( const Vector< MS::PredefinedColumns > &  colNames,
const VBRemapper remapper 
) [protected]

Like doTimeAver(), but it subtracts the continuum instead of time averaging.

Unlike doTimeAver(), it infers writeToDataCol from colNames.nelements() (subtractContinuum is intentionally not as general as copyDataFlagsWtSp), and writes according to fitoutspw_p instead of spw_p.

void casa::SubMS::verifyColumns ( const MeasurementSet ms,
const Vector< MS::PredefinedColumns > &  colNames 
)
static lDouble casa::SubMS::vopt ( const lDouble  freq,
const lDouble  rest 
) [inline, static]

Definition at line 328 of file SubMS.h.

References casa::C::c.

static lDouble casa::SubMS::vrad ( const lDouble  freq,
const lDouble  rest 
) [inline, static]

the following inline convenience methods for regridSpw bypass the whole CASA measure system because when they are used, they can assume that the frame stays the same and the units are OK

Definition at line 327 of file SubMS.h.

References casa::C::c.

Bool casa::SubMS::writeAllMainRows ( const Vector< MS::PredefinedColumns > &  colNames) [protected]

Used to be fillMainTable(colnames), but what distinguishes it from writeSomeMainRows(colnames) is that it is for cases where there is a 1-1 match between rows in mssel_p and msOut_p (including order).

Bool casa::SubMS::writeSomeMainRows ( const Vector< MS::PredefinedColumns > &  colNames) [protected]

Used to be fillAverMainTable(colnames), but what distinguishes it from writeAllMainRows(colnames) is that it is for cases where there is not necessarily a 1-1 match between rows in mssel_p and msOut_p.


Friends And Related Function Documentation

friend class MSTransformDataHandler [friend]

jagonzal: Allow TransformVisDataHandler to access protected methods and members of this class

Definition at line 107 of file SubMS.h.


Member Data Documentation

Definition at line 721 of file SubMS.h.

Referenced by selectAntenna().

same shape as the corresponding input one.

       sameShape_p,             // Iff true, the shapes of the arrays do not

vary with row number.

Definition at line 677 of file SubMS.h.

Referenced by selectAntenna().

Definition at line 720 of file SubMS.h.

Referenced by selectAntenna().

Definition at line 722 of file SubMS.h.

Definition at line 723 of file SubMS.h.

Definition at line 688 of file SubMS.h.

Referenced by selectArray().

Definition at line 704 of file SubMS.h.

Definition at line 734 of file SubMS.h.

Definition at line 704 of file SubMS.h.

Definition at line 704 of file SubMS.h.

Definition at line 689 of file SubMS.h.

Definition at line 735 of file SubMS.h.

Definition at line 736 of file SubMS.h.

Definition at line 688 of file SubMS.h.

Definition at line 717 of file SubMS.h.

Definition at line 718 of file SubMS.h.

continuum subtraction.

jagonzal: Allow main table to be left empty, so that it can be filled by another layer.

Definition at line 700 of file SubMS.h.

scan #, observation, and/or state ID? Must be lowercase at all times.

Definition at line 692 of file SubMS.h.

Definition at line 696 of file SubMS.h.

Referenced by setFitOutSpw().

If < 0 (default), continuum subtraction is not done.

Definition at line 695 of file SubMS.h.

Referenced by setFitSpw().

Definition at line 704 of file SubMS.h.

Definition at line 704 of file SubMS.h.

inCorrInd = outPolCorrToInCorrMap_p[polID_p[ddID]][outCorrInd]

Definition at line 730 of file SubMS.h.

Definition at line 683 of file SubMS.h.

Definition at line 677 of file SubMS.h.

*** Member variables ***

 Initialized* by ctors.  (Maintain order both here and in ctors.)

not necessarily to anything useful.

Definition at line 674 of file SubMS.h.

Definition at line 675 of file SubMS.h.

Referenced by getDataColMap().

Definition at line 676 of file SubMS.h.

Uninitialized by ctors.

Definition at line 703 of file SubMS.h.

Definition at line 674 of file SubMS.h.

Referenced by n_bytes().

Definition at line 704 of file SubMS.h.

Referenced by n_bytes().

Definition at line 704 of file SubMS.h.

Referenced by n_bytes().

Definition at line 683 of file SubMS.h.

Definition at line 719 of file SubMS.h.

Definition at line 726 of file SubMS.h.

Definition at line 683 of file SubMS.h.

Definition at line 725 of file SubMS.h.

Definition at line 737 of file SubMS.h.

Definition at line 718 of file SubMS.h.

Definition at line 727 of file SubMS.h.

Definition at line 704 of file SubMS.h.

Definition at line 704 of file SubMS.h.

Definition at line 704 of file SubMS.h.

Definition at line 718 of file SubMS.h.

std::map<Int, Int> casa::SubMS::stateRemapper_p [protected]

Definition at line 732 of file SubMS.h.

Definition at line 683 of file SubMS.h.

Definition at line 682 of file SubMS.h.

Definition at line 688 of file SubMS.h.

Definition at line 704 of file SubMS.h.

Definition at line 683 of file SubMS.h.

input channel will be used.

Definition at line 704 of file SubMS.h.


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