fieldSet( fieldGet(oTableName) );
antennaSet( antennaGet(oTableName) );
antenna1Set( antenna1Get(oTableName) );
antenna2Set( antenna2Get(oTableName) );
timeSet( timeGet(oTableName) );
feedSet( feedGet(oTableName) );
spwInfoSet(CalAnalysis::SPW_INFO(oTableName));
spwInfoSet( spwInfoGet(oTableName) );
// -----------------------------------------------------------------------------
This member function returns the new format calibration table.
The String instance containing the new format calibration table
The reference to the String instance containing the new format calibration table
name, returned via the function value.
2012 Apr 03 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::calName( void ) const {
String& CalAnalysis::calName( void ) const {
// Copy the private variable containing the new format calibration table name
// return the variable containing the new format calibration table name
String* poCalName = new String( oCalName );
// -----------------------------------------------------------------------------
This member function returns the MS name.
The String instance containing the MS name, returned via the
The reference to the String instance containing the MS name, returned via the
2012 Apr 03 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::msName( void ) const {
String& CalAnalysis::msName( void ) const {
// return the private variable containing the MS name
// Copy the private variable containing the MS name and return it
String* poMSName = new String( oMSName );
// -----------------------------------------------------------------------------
This member function returns the visibility calibration type.
The String instance containing the visibility calibration type,
The reference to the String instance containing the visibility calibration type,
returned via the function value.
2012 Apr 03 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::visCal( void ) const {
String& CalAnalysis::visCal( void ) const {
// Copy the private variable containing the visibility calibration type and
// Return opy the private variable containing the visibility calibration type
String* poVisCal = new String( oVisCal );
// -----------------------------------------------------------------------------
This member function returns the parameter type ("Complex" or "Float").
The String instance containing the parameter type, returned via
The reference to the String instance containing the parameter type, returned via
2012 Apr 03 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::parType( void ) const {
String& CalAnalysis::parType( void ) const {
// Return the private variable containing the parameter type
// Copy the private variable containing the parameter type and return it
String* poParType = new String( oParType );
// -----------------------------------------------------------------------------
2012 Apr 03 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::polBasis( void ) const {
String& CalAnalysis::polBasis( void ) const {
// Copy the private variable containing the polarization basis and return it
// Return the variable containing the polarization basis
String* poPolBasis = new String( oPolBasis );
// -----------------------------------------------------------------------------
This member function returns the field numbers.
The Vector<uInt> instance containing the fields, returned via
The reference to the Vector<uInt> instance containing the fields, returned via
2012 Apr 17 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::field( void ) const {
Vector<uInt>& CalAnalysis::field( void ) const {
// Copy the private variable containing the field numbers and return it
Vector<uInt>* poField = new Vector<uInt>( oField.copy() );
// -----------------------------------------------------------------------------
This member function returns the antenna numbers.
The Vector<uInt> instance containing the antenna numbers,
The reference to the Vector<uInt> instance containing the antenna numbers,
returned via the function value.
2012 Apr 17 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::antenna( void ) const {
Vector<uInt>& CalAnalysis::antenna( void ) const {
// Copy the private variable containing the antenna numbers and return it
// Return a copy of the private variable containing the antenna numbers
Vector<uInt>* poAntenna = new Vector<uInt>( oAntenna.copy() );
// -----------------------------------------------------------------------------
This member function returns the antenna 1 numbers.
The the Vector<uInt> instance containing the antenna 1 numbers,
The reference to the Vector<uInt> instance containing the antenna 1 numbers,
returned via the function value.
2012 May 07 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::antenna1( void ) const {
Vector<uInt>& CalAnalysis::antenna1( void ) const {
// Copy the private variable containing the antenna 1 numbers and return it
Vector<uInt>* poAntenna1 = new Vector<uInt>( oAntenna1.copy() );
// -----------------------------------------------------------------------------
This member function returns the antenna 2 numbers.
The Vector<Int> instance containing the antenna 2 numbers,
The reference to the Vector<Int> instance containing the antenna 2 numbers,
returned via the function value.
2012 May 07 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<Int> CalAnalysis::antenna2( void ) const {
Vector<Int>& CalAnalysis::antenna2( void ) const {
// Copy the private variable containing the antenna 2 numbers and return it
Vector<Int>* poAntenna2 = new Vector<Int>( oAntenna2.copy() );
// -----------------------------------------------------------------------------
This member function returns the times.
The Vector<Double> instance containing the times, returned via
The reference to the Vector<Double> instance containing the times, returned via
2012 Apr 04 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<Double> CalAnalysis::time( void ) const {
Vector<Double>& CalAnalysis::time( void ) const {
// Copy the private variable containing the times and return it
Vector<Double>* poTime = new Vector<Double>( oTime.copy() );
// -----------------------------------------------------------------------------
This member function returns the feeds.
The Vector<String> instance containing the feeds, returned via
The reference to the Vector<String> instance containing the feeds, returned via
2012 Apr 04 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<String> CalAnalysis::feed( void ) const {
Vector<String>& CalAnalysis::feed( void ) const {
// Copy the private variable containing the feeds and return it
Vector<String>* poFeed = new Vector<String>( oFeed.copy() );
// -----------------------------------------------------------------------------
This member function returns the number of spectral windows.
The uInt variable containing the spectral windows, returned via
The reference to the uInt variable containing the spectral windows, returned via
2012 Apr 04 - Nick Elias, NRAO
2012 Apr 17 - Nick Elias, NRAO
Modified to handle the SPW_INFO instance.
// -----------------------------------------------------------------------------
uInt CalAnalysis::numspw( void ) const {
uInt& CalAnalysis::numspw( void ) const {
// Copy the private variable containing the number of spectral windows and
// Return the variable containing the number of spectral windows
uInt* puiNumSPW = new uInt( oSPWInfo.uiNumSPW );
return oSPWInfo.uiNumSPW;
// -----------------------------------------------------------------------------
This member function returns the spectral windows.
The Vector<uInt> instance containing the spectral windows,
The reference to the Vector<uInt> instance containing the spectral windows,
returned via the function value.
2012 Apr 04 - Nick Elias, NRAO
2012 Apr 17 - Nick Elias, NRAO
Modified to handle the SPW_INFO instance.
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::spw( void ) const {
Vector<uInt>& CalAnalysis::spw( void ) const {
// Copy the private variable containing the spectral windows and return it
return oSPWInfo.oSPW.copy();
Vector<uInt>* poSPW = new Vector<uInt>( oSPWInfo.oSPW.copy() );
// -----------------------------------------------------------------------------
2012 Apr 17 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::numChannel( void ) const {
Vector<uInt>& CalAnalysis::numChannel( void ) const {
// Copy the private variable containing the number of channels for each
// spectral window and return it
return oSPWInfo.oNumChannel.copy();
Vector<uInt>* poNumChannel = new Vector<uInt>( oSPWInfo.oNumChannel.copy() );
// -----------------------------------------------------------------------------
2012 Apr 17 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<Vector<Double> > CalAnalysis::freq( void ) const {
Vector<Vector<Double> >& CalAnalysis::freq( void ) const {
// Copy the private variable containing the frequencies for each spectral
uInt uiNumSPW = oSPWInfo.uiNumSPW;
Vector<Vector<Double> > freq( uiNumSPW );
Vector<Vector<Double> >* poFreq = new Vector<Vector<Double> >( uiNumSPW );
for ( uInt s=0; s<uiNumSPW; s++ ) {
freq[s] = oSPWInfo.oFrequency[s].copy();
poFreq->operator[](s) = oSPWInfo.oFrequency[s].copy();
// -----------------------------------------------------------------------------
// End of CalAnalysis public member functions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Start of CalAnalysis private member functions
// -----------------------------------------------------------------------------
2012 Apr 03 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::calNameGet( const String& oTableName ) {
String& CalAnalysis::calNameGet( const String& oTableName ) {
// Get the new format calibration table name and return it
String poTableName = oTableName;
String* poTableName = new String( oTableName );
// -----------------------------------------------------------------------------
2012 Mar 13 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::msNameGet( const String& oTableName ) {
String& CalAnalysis::msNameGet( const String& oTableName ) {
// Get the record containing the main table keywords
Table oTable( oTableName );
TableProxy oTP( oTable );
Record oR( oTP.getKeywordSet( String("") ) );
// Get the associated MS name and return it
uInt uiIndex = oR.fieldNumber( String( "MSName" ) );
String poMSName = RecordFieldPtr<String>(oR,uiIndex).get();
String* poMSName = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
// -----------------------------------------------------------------------------
2012 Mar 13 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::visCalGet( const String& oTableName ) {
String& CalAnalysis::visCalGet( const String& oTableName ) {
// Get the record containing the main table keywords
Table oTable( oTableName );
TableProxy oTP( oTable );
Record oR( oTP.getKeywordSet( String("") ) );
// Get the visibility calibration type and return it
uInt uiIndex = oR.fieldNumber( String( "VisCal" ) );
String poVisCal = RecordFieldPtr<String>(oR,uiIndex).get();
String* poVisCal = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
// -----------------------------------------------------------------------------
2012 Jan 20 - Nick Elias, NRAO
2012 Mar 13 - Nick Elias, NRAO
Function renamed to parType().
// -----------------------------------------------------------------------------
String CalAnalysis::parTypeGet( const String& oTableName ) {
String& CalAnalysis::parTypeGet( const String& oTableName ) {
// Get the record containing the main table keywords
Table oTable( oTableName );
TableProxy oTP( oTable );
Record oR( oTP.getKeywordSet( String("") ) );
// Get the parameter column type and return it
uInt uiIndex = oR.fieldNumber( String( "ParType" ) );
String poParType = RecordFieldPtr<String>(oR,uiIndex).get();
String* poParType = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
// -----------------------------------------------------------------------------
2012 Jan 20 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
String CalAnalysis::polBasisGet( const String& oTableName ) {
String& CalAnalysis::polBasisGet( const String& oTableName ) {
// Get the record containing the main table keywords
Table oTable( oTableName );
TableProxy oTP( oTable );
Record oR( oTP.getKeywordSet( String("") ) );
// Get the polarization basis, make it upper case, keep only the initial
uInt uiIndex = oR.fieldNumber( String( "PolBasis" ) );
String poPolBasis = RecordFieldPtr<String>(oR,uiIndex).get();
String* poPolBasis = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
poPolBasis.operator=( poPolBasis.operator[](0) );
poPolBasis->operator=( poPolBasis->operator[](0) );
// -----------------------------------------------------------------------------
This member function gets the field numbers from the new format calibration
oTableName - This reference to a String instance contains the new format
The Vector<uInt> instance containing the field numbers,
The reference to the Vector<uInt> instance containing the field numbers,
returned via the function value.
2012 Apr 17 - Nick Elias, NRAO
2012 May 02 - Nick Elias, NRAO
Fields are now obtained directly from the FIELD_ID column of the
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::fieldGet( const String& oTableName ) {
Vector<uInt>& CalAnalysis::fieldGet( const String& oTableName ) {
// Get the field numbers from the new format calibration table
Table oTable( oTableName, Table::Old );
ScalarColumn<Int> oROSC( oTable, String("FIELD_ID") );
oROSC.getColumn( oFieldInt, true );
Vector<Int> oFieldUnique;
unique<Int>(oFieldInt, oFieldUnique);
Vector<Int> oFieldUnique( unique<Int>(oFieldInt) );
Vector<uInt> field( oFieldUnique.nelements() );
convertArray<uInt,Int>( field, oFieldUnique );
Vector<uInt>* poField = new Vector<uInt>( oFieldUnique.nelements() );
convertArray<uInt,Int>( *poField, oFieldUnique );
// -----------------------------------------------------------------------------
oFieldIn - This reference to a Vector<uInt> instance contains the field numbers.
oFieldOut - This reference to the Vector<uInt> instance contains the checked and
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 Apr 17 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::fieldCheck( const Vector<uInt>& oFieldIn,
Bool& CalAnalysis::fieldCheck( const Vector<uInt>& oFieldIn,
Vector<uInt>& oFieldOut ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Check the input field numbers and return the fixed field numbers
if ( oFieldIn.nelements() == 0 ) {
for ( uInt f=0; f<oFieldIn.nelements(); f++ ) {
if ( exists<uInt>( oFieldIn[f], oField ) ) {
oFieldOut.resize( uiNumFieldOut, true );
oFieldOut[uiNumFieldOut-1] = oFieldIn[f];
if ( uiNumFieldOut == 0 ) {
// -----------------------------------------------------------------------------
This member function gets the antenna numbers from the new format calibration
oTableName - This reference to a String instance contains the new format
The Vector<uInt> instance containing the antenna numbers,
The reference to the Vector<uInt> instance containing the antenna numbers,
returned via the function value.
2012 Apr 17 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::antennaGet( const String& oTableName ) {
Vector<uInt>& CalAnalysis::antennaGet( const String& oTableName ) {
// Create a temporary antenna subtable instance and get the number of antennas
Table oTableAntenna( oTableName+"/ANTENNA", Table::Old );
uInt uiNumRow = oTableAntenna.nrow();
// Create the vector containing the antenna numbers and return it
Vector<uInt> antenna( uiNumRow );
indgen<uInt>( antenna, 0 );
Vector<uInt>* poAntenna = new Vector<uInt>( uiNumRow );
indgen<uInt>( *poAntenna, 0 );
// -----------------------------------------------------------------------------
This member function gets the antenna 1 numbers from the new format calibration
oTableName - This reference to a String instance contains the new format
The Vector<uInt> instance containing the antenna 1 numbers,
The reference to the Vector<uInt> instance containing the antenna 1 numbers,
returned via the function value.
2012 May 02 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<uInt> CalAnalysis::antenna1Get( const String& oTableName ) {
Vector<uInt>& CalAnalysis::antenna1Get( const String& oTableName ) {
// Get the antenna 1 numbers from the new format calibration table
Table oTable( oTableName, Table::Old );
ScalarColumn<Int> oROSC( oTable, String("ANTENNA1") );
Vector<Int> oAntenna1Int;
oROSC.getColumn( oAntenna1Int, true );
Vector<Int> oAntenna1Unique;
unique<Int>(oAntenna1Int, oAntenna1Unique);
Vector<Int> oAntenna1Unique( unique<Int>(oAntenna1Int) );
Vector<uInt> antenna1( oAntenna1Unique.nelements() );
convertArray<uInt,Int>( antenna1, oAntenna1Unique );
Vector<uInt>* poAntenna1 = new Vector<uInt>( oAntenna1Unique.nelements() );
convertArray<uInt,Int>( *poAntenna1, oAntenna1Unique );
// -----------------------------------------------------------------------------
oAntenna1In - This reference to a Vector<uInt> instance contains the antenna 1
oAntenna1Out - This reference to the Vector<uInt> instance contains the checked
and fixed antenna 1 numbers.
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 Apr 17 - Nick Elias, NRAO
2012 Apr 25 - Nick Elias, NRAO
Member function antennaCheck() renamed to antenna1Check().
2012 May 02 - Nick Elias, NRAO
The comparison is now made to an internal list of antenna 2.
// -----------------------------------------------------------------------------
Bool CalAnalysis::antenna1Check( const Vector<uInt>& oAntenna1In,
Bool& CalAnalysis::antenna1Check( const Vector<uInt>& oAntenna1In,
Vector<uInt>& oAntenna1Out ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Check the input antenna 1 numbers and return the fixed antenna 1 numbers
if ( oAntenna1In.nelements() == 0 ) {
uInt uiNumAntenna1Out = 0;
for ( uInt a=0; a<oAntenna1In.nelements(); a++ ) {
if ( exists<uInt>( oAntenna1In[a], oAntenna1 ) ) {
oAntenna1Out.resize( uiNumAntenna1Out, true );
oAntenna1Out[uiNumAntenna1Out-1] = oAntenna1In[a];
if ( uiNumAntenna1Out == 0 ) {
// -----------------------------------------------------------------------------
This member function gets the antenna 2 numbers from the new format calibration
oTableName - This reference to a String instance contains the new format
The Vector<Int> instance containing the antenna 2 numbers,
The reference to the Vector<Int> instance containing the antenna 2 numbers,
returned via the function value.
2012 May 02 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<Int> CalAnalysis::antenna2Get( const String& oTableName ) {
Vector<Int>& CalAnalysis::antenna2Get( const String& oTableName ) {
// Get the antenna 2 numbers from the new format calibration table
Table oTable( oTableName, Table::Old );
ScalarColumn<Int> oROSC( oTable, String("ANTENNA2") );
Vector<Int> oAntenna2Int;
oROSC.getColumn( oAntenna2Int, true );
Vector<Int>* poAntenna2 = new Vector<Int>( unique<Int>(oAntenna2Int) );
unique<Int>(oAntenna2Int, uniqueA2);
Vector<Int> antenna2( uniqueA2 );
// -----------------------------------------------------------------------------
oAntenna2In - This reference to a Vector<Int> instance contains the antenna 2
oAntenna2Out - This reference to the Vector<Int> instance contains the checked
and fixed antenna 2 numbers.
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 Apr 25 - Nick Elias, NRAO
2012 May 02 - Nick Elias, NRAO
The comparison is now made to an internal list of antenna 2.
// -----------------------------------------------------------------------------
Bool CalAnalysis::antenna2Check( const Vector<Int>& oAntenna2In,
Bool& CalAnalysis::antenna2Check( const Vector<Int>& oAntenna2In,
Vector<Int>& oAntenna2Out ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Check the input antenna 1 numbers and return the fixed antenna 1 numbers
if ( oAntenna2In.nelements() == 0 ) {
uInt uiNumAntenna2Out = 0;
for ( uInt a=0; a<oAntenna2In.nelements(); a++ ) {
if ( oAntenna2In[a] == -1 || exists<Int>( oAntenna2In[a], oAntenna2 ) ) {
oAntenna2Out.resize( uiNumAntenna2Out, true );
oAntenna2Out[uiNumAntenna2Out-1] = oAntenna2In[a];
if ( uiNumAntenna2Out == 0 ) {
// -----------------------------------------------------------------------------
This member function gets the times from the new format calibration table.
oTableName - This reference to a String instance contains the new format
The Vector<Double> instance containing the times, returned via
The reference to the Vector<Double> instance containing the times, returned via
2012 Apr 04 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Vector<Double> CalAnalysis::timeGet( const String& oTableName ) {
Vector<Double>& CalAnalysis::timeGet( const String& oTableName ) {
// Create a temporary new format calibration table instance
Table oTable( oTableName, Table::Old );
ScalarColumn<Double> oROSC( oTable, String("TIME") );
// Get the sorted and unique time stamps
Vector<Double> oTimeTemp;
oROSC.getColumn( oTimeTemp, true );
Vector<Double> timev( 0 );
unique<Double>( oTimeTemp, timev );
Vector<Double>* poTime = new Vector<Double>( 0 );
*poTime = unique<Double>( oTimeTemp );
// Return the time stamps
// -----------------------------------------------------------------------------
dStartTimeIn - This reference to a Double variable contains the start time.
dStopTimeIn - This reference to a Double variable contains the stop time.
dStartTimeOut - This reference to a Double variable contains the start time.
dStopTimeOut - This reference to a Double variable contains the stop time.
oTimeOut - This reference to the Vector<Double> instance containing the
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 Jan 20 - Nick Elias, NRAO
2012 May 06 - Nick Elias, NRAO
Output start and stop times added.
// -----------------------------------------------------------------------------
Bool CalAnalysis::timeCheck( const Double& dStartTimeIn,
Bool& CalAnalysis::timeCheck( const Double& dStartTimeIn,
const Double& dStopTimeIn, Double& dStartTimeOut, Double& dStopTimeOut,
Vector<Double>& oTimeOut ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Check the start and stop times
if ( dStartTimeIn > dStopTimeIn ) {
if ( dStartTimeIn > oTime[uiNumTime-1] ) {
if ( dStopTimeIn < oTime[0] ) {
// Get the unique time values and the new start and stop times
for ( uInt t=0; t<uiNumTime; t++ ) {
if ( oTime[t] >= dStartTimeIn && oTime[t] <= dStopTimeIn ) {
oTimeOut.resize( ++uiNumTimeOut, true );
oTimeOut[uiNumTimeOut-1] = oTime[t];
if ( oTimeOut.nelements() == 0 ) {
dStartTimeOut = min( oTimeOut );
dStopTimeOut = max( oTimeOut );
// -----------------------------------------------------------------------------
NB: If the number of feeds in the column is a function of row, this function
oTableName - This reference to a String instance contains the new format
The Vector<String> instance containing the feeds, returned via
The reference to the Vector<String> instance containing the feeds, returned via
2012 Apr 04 - Nick Elias, NRAO
2012 May 02 - Nick Elias, NRAO
The new format calibration table iterator is no longer used. A
call to the main table is now used instead.
// -----------------------------------------------------------------------------
Vector<String> CalAnalysis::feedGet( const String& oTableName ) {
Vector<String>& CalAnalysis::feedGet( const String& oTableName ) {
// Get the number of feeds from the new format calibration table
Table oTable( oTableName, Table::Old );
Array<Float> oParamErrCell0;
ArrayColumn<Float> oROAC( oTable, String("PARAMERR") );
catch ( AipsError oAipsError ) {
uInt uiNumFeedTemp = oParamErrCell0.shape()[0];
Vector<String> feed( uiNumFeedTemp, "" );
Vector<String>* poFeed = new Vector<String>( uiNumFeedTemp, "" );
if ( uiNumFeedTemp == 1 ) {
poFeed->operator[](0) = "S";
if ( polBasisGet(oTableName) == "L" ) {
poFeed->operator[](0) = "X";
poFeed->operator[](1) = "Y";
} else if ( polBasisGet(oTableName) == "R" ) {
poFeed->operator[](0) = "R";
poFeed->operator[](1) = "L";
poFeed->operator[](0) = "1";
poFeed->operator[](1) = "2";
// -----------------------------------------------------------------------------
oFeedIn - This reference to a Vector<String> instance contains the feeds ("R"
and "L" for circular, "X" and "Y" for linear).
oFeedOut - This reference to the Vector<String> instance contains the checked
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 Jan 20 - Nick Elias, NRAO
2012 Mar 13 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::feedCheck( const Vector<String>& oFeedIn,
Bool& CalAnalysis::feedCheck( const Vector<String>& oFeedIn,
Vector<String>& oFeedOut ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Check the input feed values
if ( oFeedIn.nelements() == 0 ) {
for ( uInt f=0; f<oFeedIn.nelements(); f++ ) {
if ( exists<String>( oFeedIn[f], oFeed ) ) {
oFeedOut.resize( uiNumFeedOut, true );
oFeedOut[uiNumFeedOut-1] = oFeedIn[f];
if ( uiNumFeedOut == 0 ) {
// Get the unique feed vector
unique<String>( oFeedIn, oFeedOut );
oFeedOut = unique<String>( oFeedIn );
if ( oFeedOut.nelements() > 2 ) {
if ( oFeedOut.nelements() == 1 ) {
if ( oFeedOut[0] != "R" && oFeedOut[0] != "L" &&
oFeedOut[0] != "X" && oFeedOut[0] != "Y" &&
oFeedOut[0] != "1" && oFeedOut[0] != "2" && oFeedOut[0] != "S" ) {
if ( oFeedOut.nelements() == 2 ) {
if ( oFeedOut[0] != "R" && oFeedOut[0] != "L" &&
oFeedOut[0] != "X" && oFeedOut[0] != "Y" &&
oFeedOut[0] != "1" && oFeedOut[0] != "2" ) {
if ( oFeedOut[1] != "R" && oFeedOut[1] != "L" &&
oFeedOut[1] != "X" && oFeedOut[1] != "Y" &&
oFeedOut[1] != "1" && oFeedOut[1] != "2" ) {
if ( oFeedOut[0] == "L" && oFeedOut[1] == "R" ) {
if ( oFeedOut[0] == "Y" && oFeedOut[1] == "X" ) {
if ( oFeedOut[0] == "2" && oFeedOut[1] == "1" ) {
// -----------------------------------------------------------------------------
oInputIn - This reference to an INPUT instance contains the inputs to the
CalAnalysis::stats<T>() member function.
oInputOut - This reference to an INPUT instance contains the checked and fixed
inputs to the CalAnalysis::stats<T>() member function.
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 Apr 27 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::statsCheckInput( const CalAnalysis::INPUT& oInputIn,
Bool& CalAnalysis::statsCheckInput( const CalAnalysis::INPUT& oInputIn,
CalAnalysis::INPUT& oInputOut ) {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Check the fields and create a new field vector
if ( !fieldCheck( oInputIn.oField, oInputOut.oField ) ) {
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput()", WHERE ) );
log << LogIO::WARN << "One or more invalid fields" << LogIO::POST;
// Check the antennas and create the new antenna vectors
if ( !antenna1Check( oInputIn.oAntenna1, oInputOut.oAntenna1 ) ) {
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput()", WHERE ) );
log << LogIO::WARN << "One or more invalid antenna 1" << LogIO::POST;
if ( !antenna2Check( oInputIn.oAntenna2, oInputOut.oAntenna2 ) ) {
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
log << LogIO::WARN << "One or more invalid antenna 2" << LogIO::POST;
// Check the time range and create the corresponding time vector
Bool bTimeCheck = timeCheck( oInputIn.dStartTime, oInputIn.dStopTime,
oInputOut.dStartTime, oInputOut.dStopTime, oInputOut.oTime );
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
log << LogIO::WARN << "Invalid start and/or stop times" << LogIO::POST;
// Check the feeds and create the new feed vector
if ( !feedCheck( oInputIn.oFeed, oInputOut.oFeed ) ) {
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
log << LogIO::WARN << "Invalid feed(s)" << LogIO::POST;
// Check the spectral window info and create the frequency vector
Vector<uInt> oSPWOld( oInputIn.oSPW );
Vector<Vector<uInt> > oChannelOld( oInputIn.oChannel );
Vector<Vector<uInt> > oChannelNew;
Bool bSPWCheck = oSPWInfo.spwInfoCheck( oInputIn.oSPW, oInputIn.oChannel,
oInputOut.oSPW, oInputOut.oChannel );
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
log << LogIO::WARN << "Invalid spectral window information" << LogIO::POST;
// Check the user-defined iteration axis
if ( oInputIn.eAxisIterUserID != CalStats::FREQUENCY &&
oInputIn.eAxisIterUserID != CalStats::TIME ) {
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
log << LogIO::WARN << "User-defined iteration axis must be frequency/time"
oInputOut.eAxisIterUserID = oInputIn.eAxisIterUserID;
// Check the RAP (real, amplitude, phase) parameter
if ( oInputIn.eRAP != CalAnalysis::REAL &&
oInputIn.eRAP != CalAnalysis::AMPLITUDE &&
oInputIn.eRAP != CalAnalysis::PHASE ) {
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
log << LogIO::WARN << "Invalid RAP parameter" << LogIO::POST;
oInputOut.eRAP = oInputIn.eRAP;
// Set the normalization and unwrap booleans
oInputOut.bNorm = oInputIn.bNorm;
oInputOut.bUnwrap = oInputIn.bUnwrap;
// Check the maximum phase jump parameter
if ( oInputIn.dJumpMax < 0.0 ) {
LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
log << LogIO::WARN << "Invalid maximum jump parameter" << LogIO::POST;
oInputOut.dJumpMax = oInputIn.dJumpMax;
// -----------------------------------------------------------------------------
oCParamGroup - This Vector<Cube<DComplex> > instance contains the complex
parameters. This instance is empty for new format calibration
tables with real parameters.
oFParamGroup - This Vector<Cube<Double> > instance contains the real
parameters. This instance is empty for new format calibration
tables with complex parameters.
oParamErrGroup - This Vector<Cube<Double> > instance contains the parameter
oFlagGroup - This Vector<Cube<Bool> > instance contains the flags.
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 May 06 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::getGroup( const NewCalTable& oNCT,
Bool& CalAnalysis::getGroup( const NewCalTable& oNCT,
const CalAnalysis::INPUT& oInput, Vector<uInt>& oFieldGroup,
Vector<uInt>& oAntenna1Group, Vector<Int>& oAntenna2Group,
Vector<Vector<Double> >& oTimeUniqueGroup,
Vector<Vector<Double> >& oFreqGroup, Vector<Cube<DComplex> >& oCParamGroup,
Vector<Cube<Double> >& oFParamGroup, Vector<Cube<Double> >& oParamErrGroup,
Vector<Cube<Bool> >& oFlagGroup ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
if ( !rowSelect( oNCT, oInput, oRowSelect ) ) {
LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
log << LogIO::WARN << "No matching rows selected" << LogIO::POST;
// Group the selected rows according to unique combinations of field, antenna
Vector<Vector<uInt> > oRowGroup;
Vector<Vector<uInt> > oSPWGroup;
Vector<Vector<uInt> > oSPWUniqueGroup;
Vector<Vector<Double> > oTimeGroup;
Bool bRowGroup = rowGroup( oNCT, oRowSelect, oRowGroup, oFieldGroup,
oAntenna1Group, oAntenna2Group, oSPWGroup, oSPWUniqueGroup, oTimeGroup,
LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
log << LogIO::WARN << "Cannot group the data" << LogIO::POST;
// Get the frequency vector, start channel vector, and relative channel vector
Bool bFreqGroup = freqGroup( oInput, oSPWUniqueGroup, oFreqGroup );
LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
log << LogIO::WARN << "Cannot group frequencies" << LogIO::POST;
// Get the cubes for each group
Bool bCubeGroup = cubeGroup( oNCT, oInput, oRowGroup, oSPWGroup,
oSPWUniqueGroup, oTimeGroup, oTimeUniqueGroup, oFreqGroup, oCParamGroup,
oFParamGroup, oParamErrGroup, oFlagGroup );
LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
log << LogIO::WARN << "Cannot group cubes" << LogIO::POST;
// -----------------------------------------------------------------------------
oNCT - This NewCalTable instance contains the new format calibration table.
oInput - This INPUT instance contains the input selections.
oRowSelect - This Vector<uInt> instance contains the row numbers selected by the
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 May 06 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::rowSelect( const NewCalTable& oNCT,
Bool& CalAnalysis::rowSelect( const NewCalTable& oNCT,
const CalAnalysis::INPUT& oInput, Vector<uInt>& oRowSelect ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Create the column accessors
ScalarColumn<Int> oFieldCol( oNCT, String("FIELD_ID") );
ScalarColumn<Int> oAntenna1Col( oNCT, String("ANTENNA1") );
ScalarColumn<Int> oAntenna2Col( oNCT, String("ANTENNA2") );
ScalarColumn<Int> oSPWCol( oNCT, String("SPECTRAL_WINDOW_ID") );
ScalarColumn<Double> oTimeCol( oNCT, String("TIME") );
// Record the selected row
oRowSelect.resize( ++uiNumRowSelect, true );
oRowSelect[uiNumRowSelect-1] = r;
// Were any rows found? It not, return false
if ( uiNumRowSelect == 0 ) {
// -----------------------------------------------------------------------------
oAntenna2Group - This Vector<Int> instance contains the antenna 2 for each
oSPWGroup - This Vector<Vector<uInt> > instance contains the spectral
oSPWUniqueGroup - This Vector<Vector<uInt> > instance contains the unique
spectral windows for each group.
oTimeGroup - This Vector<Vector<Double> > instance contains the times for
oTimeUniqueGroup - This Vector<Vector<Double> > instance contains the unique
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 May 06 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::rowGroup( const NewCalTable& oNCT,
Bool& CalAnalysis::rowGroup( const NewCalTable& oNCT,
const Vector<uInt>& oRowSelect, Vector<Vector<uInt> >& oRowGroup,
Vector<uInt>& oFieldGroup, Vector<uInt>& oAntenna1Group,
Vector<Int>& oAntenna2Group, Vector<Vector<uInt> >& oSPWGroup,
Vector<Vector<uInt> >& oSPWUniqueGroup, Vector<Vector<Double> >& oTimeGroup,
Vector<Vector<Double> >& oTimeUniqueGroup ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// If there are no rows, return false
uInt uiNumRow = oRowSelect.nelements();
// Create the column accessors
ScalarColumn<Int> oFieldCol( oNCT, String("FIELD_ID") );
ScalarColumn<Int> oAntenna1Col( oNCT, String("ANTENNA1") );
ScalarColumn<Int> oAntenna2Col( oNCT, String("ANTENNA2") );
ScalarColumn<Int> oSPWCol( oNCT, String("SPECTRAL_WINDOW_ID") );
ScalarColumn<Double> oTimeCol( oNCT, String("TIME") );
// Create the unique sorted spectral window and time vectors for each group
oSPWUniqueGroup.resize( uiNumGroup, false );
oTimeUniqueGroup.resize( uiNumGroup, false );
for ( uInt g=0; g<uiNumGroup; g++ ) {
oSPWUniqueGroup[g].resize();
unique<uInt>( oSPWGroup[g], oSPWUniqueGroup[g] );
oSPWUniqueGroup[g] = unique<uInt>( oSPWGroup[g] );
oTimeUniqueGroup[g].resize();
unique<Double>( oTimeGroup[g], oTimeUniqueGroup[g] );
oTimeUniqueGroup[g] = unique<Double>( oTimeGroup[g] );
// -----------------------------------------------------------------------------
oSPW - This Vector<uInt> instance contains the unique and sorted spectral
oInput - This INPUT instance contains the input selections.
oSPWMap - This Vector<uInt> instance contains the mapped spectral windows.
oChanStart - This Vector<uInt> instance contains the start channels.
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 May 06 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::chanSPW( const Vector<uInt>& oSPW, const INPUT& oInput,
Bool& CalAnalysis::chanSPW( const Vector<uInt>& oSPW, const INPUT& oInput,
Vector<uInt>& oSPWMap, Vector<uInt>& oChanStart ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Initialize the number of spectral windows, the spectral window map and
uInt uiNumSPW = oSPW.nelements();
oSPWMap.resize( uiNumSPW, false );
oChanStart.resize( uiNumSPW, false );
// Load the spectral window map
for ( uInt s=0; s<uiNumSPW; s++ ) {
if ( !where( oSPW[s], oInput.oSPW, oSPWMap[s] ) ) {
// Load the start channels
for ( uInt s=1; s<uiNumSPW; s++ ) {
oChanStart[s] = oChanStart[s-1];
oChanStart[s] += oInput.oChannel[oSPWMap[s-1]].nelements();
// -----------------------------------------------------------------------------
oInput - This INPUT instance contains the input selections.
oSPWUniqueGroup - This Vector<Vector<uInt> > instance contains the unique
spectral windows for each group.
oFreqGroup - This Vector<Vector<Double> >instance contains the frequencies (for
each group. They can come from multiple spectral windows (which
The Bool variable containing the success boolean, returned via
The reference to the Bool variable containing the success boolean, returned via
2012 May 06 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::freqGroup( const INPUT& oInput,
Bool& CalAnalysis::freqGroup( const INPUT& oInput,
const Vector<Vector<uInt> >& oSPWUniqueGroup,
Vector<Vector<Double> >& oFreqGroup ) const {
// Declare the success boolean
Bool success = new Bool( false );
Bool* poSuccess = new Bool( false );
// Create the instance for the spectral window subtable of the new format
// calibration table and the accessor instance for the CHAN_FREQ column
Table oTableSPW( oCalName+String("/SPECTRAL_WINDOW"), Table::Old );
ArrayColumn<Double> oChanFreqCol( oTableSPW, String("CHAN_FREQ") );
// Load the output instances
for ( uInt g=0; g<uiNumGroup; g++ ) {
// Get the start channels for all spectral windows in the group
if ( !chanSPW( oSPWUniqueGroup[g], oInput, oSPWMap, oChanStart ) ) {
for ( uInt s=0; s<oSPWUniqueGroup[g].nelements(); s++ ) {
// Get the number of channels for the mapped spectral window
uInt uiNumChannelInput = oInput.oChannel[oSPWMap[s]].nelements();
// Resize the frequency vector for the group
oFreqGroup[g].resize( oChanStart[s]+uiNumChannelInput, true );
oFreqGroup[g][uiChanGroup] = oFreqTemp[uiChanTemp];
// -----------------------------------------------------------------------------
oCParamGroup - This Vector<Cube<DComplex> > instance contains the complex
parameters. This instance is empty for new format calibration
tables with real parameters.
oFParamGroup - This Vector<Cube<Double> > instance contains the real
parameters. This instance is empty for new format calibration
tables with complex parameters.
oParamErrGroup - This Vector<Cube<Double> > instance contains the parameter
oFlagGroup - This Vector<Cube<Bool> > instance contains the flags.
The Bool variable containing the check boolean, returned via
The reference to the Bool variable containing the check boolean, returned via
2012 May 06 - Nick Elias, NRAO
// -----------------------------------------------------------------------------
Bool CalAnalysis::cubeGroup( const NewCalTable& oNCT, const INPUT& oInput,
Bool& CalAnalysis::cubeGroup( const NewCalTable& oNCT, const INPUT& oInput,
const Vector<Vector<uInt> >& oRowGroup,
const Vector<Vector<uInt> >& oSPWGroup,
const Vector<Vector<uInt> >& oSPWUniqueGroup,
const Vector<Vector<Double> >& oTimeGroup,
const Vector<Vector<Double> >& oTimeUniqueGroup,
const Vector<Vector<Double> >& oFreqGroup,
Vector<Cube<DComplex> >& oCParamGroup, Vector<Cube<Double> >& oFParamGroup,
Vector<Cube<Double> >& oParamErrGroup,
Vector<Cube<Bool> >& oFlagGroup ) const {
// Declare the success boolean
Bool* poSuccess = new Bool( false );
// Create accessors for the CPARAM/FPARAM, PARAMERR, and FLAG columns
ArrayColumn<Complex>* poCParamCol = NULL;
ArrayColumn<Float>* poFParamCol = NULL;
if ( oParType == String("Complex") ) {
poCParamCol = new ArrayColumn<Complex>( oNCT, String("CPARAM") );
// Load the output instances for each group
for ( uInt g=0; g<uiNumGroup; g++ ) { // Loop over group
// Get the spectral window maps and start channels for the group
if ( !chanSPW( oSPWUniqueGroup[g], oInput, oSPWMap, oChanStart ) ) {
// Initialize the shape of the output instances for the group
uInt uiNumFreq = oFreqGroup[g].nelements();
uInt uiNumTimeUnique = oTimeUniqueGroup[g].nelements();
IPosition oShape( 3, uiNumFeed, uiNumFreq, uiNumTimeUnique );
// Allocate the output instances for the group
oCParamGroup[g].resize( oShape, false );
oFParamGroup[g].resize( oShape, false );
Array<Float> oParamErrCube( oParamErrCol(uiRow).shape(), 0.0 );
oParamErrCube = oParamErrCol( uiRow );
// Get the FLAG cell from the new format calibration table
Array<Bool> oFlagCube( oFlagCol(uiRow).shape(), false );
oFlagCube = oFlagCol( uiRow );
// Map the spectral window
if ( !where( oSPWGroup[g][r], oSPWUniqueGroup[g], s ) ) {
// Get the number of input channels and the channels for the mapped
uInt uiNumChannelC = oInput.oChannel[oSPWMap[s]].nelements();
Vector<uInt> oChannelC( oInput.oChannel[oSPWMap[s]] );
if ( !where( oTimeGroup[g][r], oTimeUniqueGroup[g], t ) ) {
// Map the cubes from the new format calibration tables to the output
// instances for each group
for ( uInt f=0; f<uiNumFeed; f++ ) { // Loop over feeds
for ( uInt c=0; c<uiNumChannelC; c++ ) { // Loop over channnels
IPosition oPosG( 3, f, oChanStart[s]+c, t );
IPosition oPosC( 2, f, oChannelC[c] );
oCParamGroup[g](oPosG) = (DComplex) oCParamCube(oPosC);
oFParamGroup[g](oPosG) = (Double) oFParamCube(oPosC);
// -----------------------------------------------------------------------------
// End of CalAnalysis private member functions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Start of CalAnalysis protected member functions
// -----------------------------------------------------------------------------