Changeset 2018
- Timestamp:
- 02/28/11 19:41:13 (14 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSWriter.cpp
r2016 r2018 420 420 os_ << "tcalIdArr = " << tcalIdArr << LogIO::POST ; 421 421 String key = String::toString( tcalIdArr[0] ) ; 422 if ( !tcalIdRec_.isDefined( key ) ) //{422 if ( !tcalIdRec_.isDefined( key ) ) { 423 423 tcalIdRec_.define( key, tcalIdArr ) ; 424 //tcalRowRec_.define( key, t5.rowNumbers() ) ;425 //}426 //else {427 //Vector<uInt> pastrows = tcalRowRec_.asArrayuInt( key ) ;428 // tcalRowRec_.define(concatenateArray( pastrows, t5.rowNumbers() ) ) ;429 //}424 tcalRowRec_.define( key, t5.rowNumbers() ) ; 425 } 426 else { 427 Vector<uInt> pastrows = tcalRowRec_.asArrayuInt( key ) ; 428 tcalRowRec_.define( key, concatenateArray( pastrows, t5.rowNumbers() ) ) ; 429 } 430 430 431 431 // fill STATE_ID … … 981 981 982 982 // access to MAIN table 983 // Table tab = table_->table() ; 984 Block<String> cols( 5 ) ; 983 Block<String> cols( 6 ) ; 985 984 cols[0] = "TIME" ; 986 985 cols[1] = "TCAL_ID" ; … … 988 987 cols[3] = "BEAMNO" ; 989 988 cols[4] = "IFNO" ; 989 cols[5] = "INTERVAL" ; 990 990 Table tab = table_->table().project( cols ) ; 991 991 … … 994 994 995 995 nrow = tcalIdRec_.nfields() ; 996 997 os_ << "fillSysCal() nrow = " << nrow << LogIO::POST ;998 996 999 997 Double midTime ; … … 1024 1022 ROArrayColumn<Float> tcalCol( sortedstt, "TCAL" ) ; 1025 1023 ROTableColumn idCol( sortedstt, "ID" ) ; 1026 ROArrayColumn<Float> tsysCol ; 1027 //Block<Bool> rowmask( tab.nrow(), True ) ; 1028 //Table tab2 = tab( rowmask ) ; 1024 ROArrayColumn<Float> tsysCol( tab, "TSYS" ) ; 1025 ROTableColumn tcalidCol( tab, "TCAL_ID" ) ; 1026 ROTableColumn timeCol( tab, "TIME" ) ; 1027 ROTableColumn intervalCol( tab, "INTERVAL" ) ; 1028 ROTableColumn beamnoCol( tab, "BEAMNO" ) ; 1029 ROTableColumn ifnoCol( tab, "IFNO" ) ; 1029 1030 for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 1030 1031 double t1 = gettimeofday_sec() ; … … 1032 1033 os_ << "ids = " << ids << LogIO::POST ; 1033 1034 uInt npol = ids.size() ; 1034 Table tsel = tab( tab.col("TCAL_ID").in(ids) ) ; 1035 //Table tsel = tab( tab.col("TCAL_ID").in(ids) ).sort( "TCAL_ID" ) ; 1036 //Table tsel = tab2( tab2.col("TCAL_ID").in(ids) ).sort( "TCAL_ID" ) ; 1037 uInt nrowsel = tsel.nrow() ; 1038 //Vector<uInt> selectedcols = tsel.rowNumbers() ; 1039 Vector<uInt> selectedcols = tsel.rowNumbers( tab, True ) ; 1040 os_ << "selectedcols = " << selectedcols << LogIO::POST ; 1041 Block<Bool> rowmask( tab.nrow(), True ) ; 1042 for ( uInt icol = 0 ; icol < selectedcols.nelements() ; icol++ ) 1043 rowmask[selectedcols[icol]] = False ; 1044 //tab2 = tab( rowmask ) ; 1045 tab = tab( rowmask ) ; 1046 os_ << "tab.nrow() = " << tab.nrow() << LogIO::POST ; 1047 tsel = tsel.sort( "TCAL_ID" ) ; 1035 Vector<uInt> rows = tcalRowRec_.asArrayuInt( irow ) ; 1036 os_ << "rows = " << rows << LogIO::POST ; 1037 Vector<Double> atime( rows.nelements() ) ; 1038 Vector<Double> ainterval( rows.nelements() ) ; 1039 Vector<uInt> atcalid( rows.nelements() ) ; 1040 for( uInt jrow = 0 ; jrow < rows.nelements() ; jrow++ ) { 1041 atime[jrow] = (Double)timeCol.asdouble( rows[jrow] ) ; 1042 ainterval[jrow] = (Double)intervalCol.asdouble( rows[jrow] ) ; 1043 atcalid[jrow] = tcalidCol.asuInt( rows[jrow] ) ; 1044 } 1045 Vector<Float> dummy = tsysCol( rows[0] ) ; 1046 Matrix<Float> tsys( npol,dummy.nelements() ) ; 1047 tsys.row( 0 ) = dummy ; 1048 for ( uInt jrow = 1 ; jrow < npol ; jrow++ ) 1049 tsys.row( jrow ) = tsysCol( rows[jrow] ) ; 1048 1050 1049 1051 // FEED_ID 1050 ROScalarColumn<uInt> uintCol( tsel, "BEAMNO" ) ; 1051 *feedRF = uintCol( 0 ) ; 1052 *feedRF = beamnoCol.asuInt( rows[0] ) ; 1052 1053 1053 1054 // SPECTRAL_WINDOW_ID 1054 uintCol.attach( tsel, "IFNO" ) ; 1055 *spwRF = uintCol( 0 ) ; 1055 *spwRF = ifnoCol.asuInt( rows[0] ) ; 1056 1056 1057 1057 // TIME and INTERVAL 1058 Table tsel1 = tsel( tsel.col("TCAL_ID") == ids[0] ) ; 1059 os_ << "tsel.nrow = " << tsel.nrow() << " tsel1.nrow = " << tsel1.nrow() << LogIO::POST ; 1060 getValidTimeRange( midTime, interval, tsel1 ) ; 1058 getValidTimeRange( midTime, interval, atime, ainterval ) ; 1061 1059 *timeRF = midTime ; 1062 1060 *intervalRF = interval ; … … 1078 1076 tcal.row( 0 ) = dummyC ; 1079 1077 } 1080 tsysCol.attach( tsel, "TSYS" ) ;1081 Vector<Float> dummyS = tsysCol( 0 ) ;1082 Matrix<Float> tsys( npol, dummyS.size() ) ;1083 tsys.row( 0 ) = dummyS ;1084 // get TSYS and TCAL1085 1078 if ( npol == 2 ) { 1086 1079 if ( idCol.asuInt( ids[1] ) == ids[1] ) { … … 1094 1087 tcal.row( 1 ) = tcalCol( 1 ) ; 1095 1088 } 1096 tsys.row( 1 ) = tsysCol( nrowsel-1 ) ;1097 1089 } 1098 1090 else if ( npol == 3 ) { … … 1111 1103 tcal.row( 2 ) = tcalCol( 0 ) ; 1112 1104 } 1113 tsys.row( 1 ) = tsysCol( nrowsel/npol ) ;1114 tsys.row( 2 ) = tsysCol( nrowsel-1 ) ;1115 1105 } 1116 1106 else if ( npol == 4 ) { … … 1136 1126 tcal.row( 3 ) = tcalCol( 0 ) ; 1137 1127 } 1138 tsys.row( 1 ) = tsysCol( nrowsel/3 ) ;1139 tsys.row( 2 ) = tsys.row( 1 ) ;1140 tsys.row( 3 ) = tsysCol( nrowsel-1 ) ;1141 1128 } 1142 1129 if ( tcalSpec_ ) { … … 1639 1626 } 1640 1627 1628 void MSWriter::getValidTimeRange( Double &me, Double &interval, Vector<Double> &atime, Vector<Double> &ainterval ) 1629 { 1630 double startSec = gettimeofday_sec() ; 1631 os_ << "start MSWriter::getVaridTimeRange() startSec=" << startSec << LogIO::POST ; 1632 1633 // sort table 1634 //Table stab = tab.sort( "TIME" ) ; 1635 1636 Double minTime ; 1637 Double maxTime ; 1638 minMax( minTime, maxTime, atime ) ; 1639 Double midTime = 0.5 * ( minTime + maxTime ) * 86400.0 ; 1640 // unit for TIME 1641 // Scantable: "d" 1642 // MS: "s" 1643 me = midTime ; 1644 interval = ( maxTime - minTime ) * 86400.0 ; 1645 1646 double endSec = gettimeofday_sec() ; 1647 os_ << "end MSWriter::getValidTimeRange() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1648 } 1649 1641 1650 //void MSWriter::queryType( Int type, String &stype, Bool &b ) 1642 1651 void MSWriter::queryType( Int type, String &stype, Bool &b, Double &t, Double &l ) -
trunk/src/MSWriter.h
r2016 r2018 79 79 casa::Vector<casa::Int> toCorrType( casa::Vector<casa::Int> polnos ) ; 80 80 void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Table &tab ) ; 81 void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Vector<casa::Double> &atime, casa::Vector<casa::Double> &ainterval ) ; 81 82 //void queryType( casa::Int type, casa::String &stype, casa::Bool &b ) ; 82 83 void queryType( casa::Int type, casa::String &stype, casa::Bool &b, casa::Double &t, Double &l ) ;
Note:
See TracChangeset
for help on using the changeset viewer.