Changeset 2459 for branches/hpc33/src
- Timestamp:
- 04/09/12 18:49:51 (13 years ago)
- Location:
- branches/hpc33/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/src/STGrid.cpp
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/src/STGrid.cpp merged eligible /branches/alma/src/STGrid.cpp 1386-1818 /branches/asap4casa3.1.0/src/STGrid.cpp 1935-1936,1940 /branches/parallel/src/STGrid.cpp 2196-2288
r2398 r2459 1 #include <iostream> 2 #include <fstream> 3 #include <cfloat> 4 1 // 2 // C++ Implementation: STGrid 3 // 4 // Description: 5 // 6 // 7 // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2011 8 // 9 // Copyright: See COPYING file that comes with this distribution 10 // 11 // 5 12 #include <casa/BasicSL/String.h> 6 13 #include <casa/Arrays/Vector.h> 7 #include <casa/Arrays/Matrix.h>8 #include <casa/Arrays/Cube.h>9 14 #include <casa/Arrays/ArrayMath.h> 10 #include <casa/Arrays/ArrayIter.h>11 15 #include <casa/Quanta/Quantum.h> 12 16 #include <casa/Quanta/QuantumHolder.h> … … 16 20 #include <tables/Tables/Table.h> 17 21 #include <tables/Tables/TableRecord.h> 22 #include <tables/Tables/TableRow.h> 18 23 #include <tables/Tables/ExprNode.h> 19 24 #include <tables/Tables/ScalarColumn.h> 20 25 #include <tables/Tables/ArrayColumn.h> 21 #include <tables/Tables/Table Iter.h>26 #include <tables/Tables/TableCopy.h> 22 27 23 28 #include <measures/Measures/MDirection.h> 24 29 25 #include <MathUtils.h> 30 #include "MathUtils.h" 31 #include <atnf/PKSIO/SrcType.h> 26 32 27 33 #include "STGrid.h" … … 407 413 selectData() ; 408 414 t1 = mathutil::gettimeofday_sec() ; 409 os << "selectData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ;415 os << LogIO::DEBUGGING << "selectData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 410 416 411 417 setupGrid() ; … … 640 646 setConvFunc( common.convFunc ) ; 641 647 t1 = mathutil::gettimeofday_sec() ; 642 os << "setConvFunc: elapsed time is " << t1-t0 << " sec." << LogIO::POST ;648 os << LogIO::DEBUGGING << "setConvFunc: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 643 649 644 650 // for performance check … … 681 687 os << "end table " << ifile << LogIO::POST ; 682 688 } 683 os << "initPol: elapsed time is " << eInitPol << " sec." << LogIO::POST ;684 os << "getData: elapsed time is " << eGetData_-eToInt-eGetWeight << " sec." << LogIO::POST ;685 os << "toPixel: elapsed time is " << eToPixel_ << " sec." << LogIO::POST ;686 os << "ggridsd: elapsed time is " << eGGridSD_ << " sec." << LogIO::POST ;687 os << "toInt: elapsed time is " << eToInt << " sec." << LogIO::POST ;688 os << "getWeight: elapsed time is " << eGetWeight << " sec." << LogIO::POST ;689 os << LogIO::DEBUGGING << "initPol: elapsed time is " << eInitPol << " sec." << LogIO::POST ; 690 os << LogIO::DEBUGGING << "getData: elapsed time is " << eGetData_-eToInt-eGetWeight << " sec." << LogIO::POST ; 691 os << LogIO::DEBUGGING << "toPixel: elapsed time is " << eToPixel_ << " sec." << LogIO::POST ; 692 os << LogIO::DEBUGGING << "ggridsd: elapsed time is " << eGGridSD_ << " sec." << LogIO::POST ; 693 os << LogIO::DEBUGGING << "toInt: elapsed time is " << eToInt << " sec." << LogIO::POST ; 694 os << LogIO::DEBUGGING << "getWeight: elapsed time is " << eGetWeight << " sec." << LogIO::POST ; 689 695 690 696 delete chanMap ; … … 790 796 setConvFunc( common.convFunc ) ; 791 797 t1 = mathutil::gettimeofday_sec() ; 792 os << "setConvFunc: elapsed time is " << t1-t0 << " sec." << LogIO::POST ;798 os << LogIO::DEBUGGING << "setConvFunc: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 793 799 794 800 // for performance check … … 831 837 os << "end table " << ifile << LogIO::POST ; 832 838 } 833 os << "initPol: elapsed time is " << eInitPol << " sec." << LogIO::POST ;834 os << "getData: elapsed time is " << eGetData_-eToInt-eGetWeight << " sec." << LogIO::POST ;835 os << "toPixel: elapsed time is " << eToPixel_ << " sec." << LogIO::POST ;836 os << "ggridsd2: elapsed time is " << eGGridSD_ << " sec." << LogIO::POST ;837 os << "toInt: elapsed time is " << eToInt << " sec." << LogIO::POST ;838 os << "getWeight: elapsed time is " << eGetWeight << " sec." << LogIO::POST ;839 os << LogIO::DEBUGGING << "initPol: elapsed time is " << eInitPol << " sec." << LogIO::POST ; 840 os << LogIO::DEBUGGING << "getData: elapsed time is " << eGetData_-eToInt-eGetWeight << " sec." << LogIO::POST ; 841 os << LogIO::DEBUGGING << "toPixel: elapsed time is " << eToPixel_ << " sec." << LogIO::POST ; 842 os << LogIO::DEBUGGING << "ggridsd2: elapsed time is " << eGGridSD_ << " sec." << LogIO::POST ; 843 os << LogIO::DEBUGGING << "toInt: elapsed time is " << eToInt << " sec." << LogIO::POST ; 844 os << LogIO::DEBUGGING << "getWeight: elapsed time is " << eGetWeight << " sec." << LogIO::POST ; 839 845 840 846 delete chanMap ; … … 855 861 common.clipCMax ) ; 856 862 t1 = mathutil::gettimeofday_sec() ; 857 os << "clipMinMax: elapsed time is " << t1-t0 << " sec." << LogIO::POST ;863 os << LogIO::DEBUGGING << "clipMinMax: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 858 864 // os << "AFTER CLIPPING" << LogIO::POST ; 859 865 // os << "gdataArrC=" << common.gdataArrC << LogIO::POST ; … … 960 966 } 961 967 else 962 ptab_ = tab_( tab_.col("POLNO") == (uInt)ipol) ;968 ptab_ = tab_( tab_.col("POLNO") == pollist_[ipol] ) ; 963 969 964 970 attach( ptab_ ) ; … … 996 1002 data_.putStorage( gwgt_p, b2 ) ; 997 1003 t1 = mathutil::gettimeofday_sec() ; 998 os << "setData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ;1004 os << LogIO::DEBUGGING << "setData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 999 1005 } 1000 1006 … … 1111 1117 } 1112 1118 cellx_ = qcellx.getValue( "rad" ) ; 1119 // DEC correction 1120 cellx_ /= cos( center_[1] ) ; 1113 1121 celly_ = qcelly.getValue( "rad" ) ; 1122 //os << "cellx_=" << cellx_ << ", celly_=" << celly_ << ", cos("<<center_(1)<<")=" << cos(center_(1)) << LogIO::POST ; 1114 1123 if ( nx_ < 0 ) { 1115 1124 if ( wx == 0.0 ) { … … 1156 1165 Int ifno = ifno_ ; 1157 1166 tableList_.resize( nfile_ ) ; 1158 if ( ifno == -1 ) {1167 if ( ifno_ == -1 ) { 1159 1168 Table taborg( infileList_[0] ) ; 1160 1169 ROScalarColumn<uInt> ifnoCol( taborg, "IFNO" ) ; 1161 ifno = ifnoCol( 0 ) ;1170 ifno_ = ifnoCol( 0 ) ; 1162 1171 os << LogIO::WARN 1163 << "IFNO is not given. Using default IFNO: " << ifno << LogIO::POST ;1172 << "IFNO is not given. Using default IFNO: " << ifno_ << LogIO::POST ; 1164 1173 } 1165 1174 for ( uInt i = 0 ; i < nfile_ ; i++ ) { 1166 1175 Table taborg( infileList_[i] ) ; 1167 1176 TableExprNode node ; 1168 if ( i sMultiIF( taborg ) ) {1177 if ( ifno != -1 || isMultiIF( taborg ) ) { 1169 1178 os << "apply selection on IFNO" << LogIO::POST ; 1170 node = taborg.col("IFNO") == ifno ;1179 node = taborg.col("IFNO") == ifno_ ; 1171 1180 } 1172 1181 if ( scanlist_.size() > 0 ) { … … 1180 1189 tableList_[i] = taborg( node ) ; 1181 1190 } 1182 os << "tableList_[" << i << "].nrow()=" << tableList_[i].nrow() << LogIO::POST ;1191 os << LogIO::DEBUGGING << "tableList_[" << i << "].nrow()=" << tableList_[i].nrow() << LogIO::POST ; 1183 1192 if ( tableList_[i].nrow() == 0 ) { 1184 1193 os << LogIO::SEVERE 1185 << "No corresponding rows for given selection: IFNO " << ifno ;1194 << "No corresponding rows for given selection: IFNO " << ifno_ ; 1186 1195 if ( scanlist_.size() > 0 ) 1187 1196 os << " SCANNO " << scanlist_ ; … … 1565 1574 // to take into account Gaussian tail 1566 1575 if ( convSupport_ < 0 ) 1567 convSupport_ = 12 ; // 3* 41576 convSupport_ = 4 ; // 1 * 4 1568 1577 else { 1569 1578 convSupport_ = userSupport_ * 4 ; … … 1650 1659 1651 1660 t1 = mathutil::gettimeofday_sec() ; 1652 os << "saveData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 1661 os << LogIO::DEBUGGING << "saveData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 1662 1663 fillMainColumns( tab ) ; 1653 1664 1654 1665 return outfile_ ; … … 1660 1671 t.deepCopy( name, Table::New, False, t.endianFormat(), True ) ; 1661 1672 tab = Table( name, Table::Update ) ; 1662 } 1663 1664 } 1673 // 2012/02/13 TN 1674 // explicitly copy subtables since no rows including subtables are 1675 // copied by Table::deepCopy with noRows=True 1676 TableCopy::copySubTables( tab, t ) ; 1677 } 1678 1679 void STGrid::fillMainColumns( Table &tab ) 1680 { 1681 // values for fill 1682 Table t( infileList_[0], Table::Old ) ; 1683 Table tsel = t( t.col( "IFNO" ) == (uInt)ifno_, 1 ) ; 1684 ROTableRow row( tsel ) ; 1685 row.get( 0 ) ; 1686 const TableRecord &rec = row.record() ; 1687 uInt freqId = rec.asuInt( "FREQ_ID" ) ; 1688 uInt molId = rec.asuInt( "MOLECULE_ID" ) ; 1689 uInt tcalId = rec.asuInt( "TCAL_ID" ) ; 1690 uInt focusId = rec.asuInt( "FOCUS_ID" ) ; 1691 uInt weatherId = rec.asuInt( "WEATHER_ID" ) ; 1692 String srcname = rec.asString( "SRCNAME" ) ; 1693 String fieldname = rec.asString( "FIELDNAME" ) ; 1694 Vector<Float> defaultTsys( 1, 1.0 ) ; 1695 // @todo how to set flagtra for gridded spectra? 1696 Vector<uChar> flagtra = rec.asArrayuChar( "FLAGTRA" ) ; 1697 flagtra = (uChar)0 ; 1698 Float opacity = rec.asFloat( "OPACITY" ) ; 1699 Double srcvel = rec.asDouble( "SRCVELOCITY" ) ; 1700 Vector<Double> srcpm = rec.asArrayDouble( "SRCPROPERMOTION" ) ; 1701 Vector<Double> srcdir = rec.asArrayDouble( "SRCDIRECTION" ) ; 1702 Vector<Double> scanrate = rec.asArrayDouble( "SCANRATE" ) ; 1703 Double time = rec.asDouble( "TIME" ) ; 1704 Double interval = rec.asDouble( "INTERVAL" ) ; 1705 1706 // fill columns 1707 Int nrow = tab.nrow() ; 1708 ScalarColumn<uInt> scannoCol( tab, "SCANNO" ) ; 1709 ScalarColumn<uInt> ifnoCol( tab, "IFNO" ) ; 1710 ScalarColumn<uInt> freqIdCol( tab, "FREQ_ID" ) ; 1711 ScalarColumn<uInt> molIdCol( tab, "MOLECULE_ID" ) ; 1712 ScalarColumn<uInt> tcalidCol( tab, "TCAL_ID" ) ; 1713 ScalarColumn<Int> fitidCol( tab, "FIT_ID" ) ; 1714 ScalarColumn<uInt> focusidCol( tab, "FOCUS_ID" ) ; 1715 ScalarColumn<uInt> weatheridCol( tab, "WEATHER_ID" ) ; 1716 ArrayColumn<uChar> flagtraCol( tab, "FLAGTRA" ) ; 1717 ScalarColumn<uInt> rflagCol( tab, "FLAGROW" ) ; 1718 ArrayColumn<Float> tsysCol( tab, "TSYS" ) ; 1719 ScalarColumn<String> srcnameCol( tab, "SRCNAME" ) ; 1720 ScalarColumn<String> fieldnameCol( tab, "FIELDNAME" ) ; 1721 ScalarColumn<Int> srctypeCol( tab, "SRCTYPE" ) ; 1722 ScalarColumn<Float> opacityCol( tab, "OPACITY" ) ; 1723 ScalarColumn<Double> srcvelCol( tab, "SRCVELOCITY" ) ; 1724 ArrayColumn<Double> srcpmCol( tab, "SRCPROPERMOTION" ) ; 1725 ArrayColumn<Double> srcdirCol( tab, "SRCDIRECTION" ) ; 1726 ArrayColumn<Double> scanrateCol( tab, "SCANRATE" ) ; 1727 ScalarColumn<Double> timeCol( tab, "TIME" ) ; 1728 ScalarColumn<Double> intervalCol( tab, "INTERVAL" ) ; 1729 for ( Int i = 0 ; i < nrow ; i++ ) { 1730 scannoCol.put( i, (uInt)i ) ; 1731 ifnoCol.put( i, (uInt)ifno_ ) ; 1732 freqIdCol.put( i, freqId ) ; 1733 molIdCol.put( i, molId ) ; 1734 tcalidCol.put( i, tcalId ) ; 1735 fitidCol.put( i, -1 ) ; 1736 focusidCol.put( i, focusId ) ; 1737 weatheridCol.put( i, weatherId ) ; 1738 flagtraCol.put( i, flagtra ) ; 1739 rflagCol.put( i, 0 ) ; 1740 tsysCol.put( i, defaultTsys ) ; 1741 srcnameCol.put( i, srcname ) ; 1742 fieldnameCol.put( i, fieldname ) ; 1743 srctypeCol.put( i, (Int)SrcType::PSON ) ; 1744 opacityCol.put( i, opacity ) ; 1745 srcvelCol.put( i, srcvel ) ; 1746 srcpmCol.put( i, srcpm ) ; 1747 srcdirCol.put( i, srcdir ) ; 1748 scanrateCol.put( i, scanrate ) ; 1749 timeCol.put( i, time ) ; 1750 intervalCol.put( i, interval ) ; 1751 } 1752 } 1753 1754 } -
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/hpc33/src/STGrid.h
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/src/STGrid.h merged eligible /branches/alma/src/STGrid.h 1386-1818 /branches/asap4casa3.1.0/src/STGrid.h 1935-1936,1940 /branches/parallel/src/STGrid.h 2196-2288
r2398 r2459 195 195 void initTable( uInt idx ) ; 196 196 Bool isMultiIF( Table &tab ) ; 197 void fillMainColumns( Table &tab ) ; 197 198 static bool produceChunk(void *ctx) throw(concurrent::PCException); 198 199 static void consumeChunk(void *ctx) throw(concurrent::PCException); -
Property svn:mergeinfo
set to (toggle deleted branches)
Note:
See TracChangeset
for help on using the changeset viewer.