Changeset 2519 for branches/hpc33
- Timestamp:
- 05/15/12 15:23:48 (13 years ago)
- Location:
- branches/hpc33/src
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/src
- Property svn:mergeinfo changed
/trunk/src (added) merged: 2412
- Property svn:mergeinfo changed
-
branches/hpc33/src/CMakeLists.txt
r2399 r2519 60 60 ${SRCDIR}/STUpgrade.cpp 61 61 ${SRCDIR}/STGrid.cpp 62 ${SRCDIR}/STIdxIter.cpp 62 63 ${SRCDIR}/Templates.cpp ) 63 64 … … 81 82 ${SRCDIR}/python_LogSink.cpp 82 83 ${SRCDIR}/python_STGrid.cpp 84 ${SRCDIR}/python_Iterator.cpp 83 85 ${SRCDIR}/python_asap.cpp ) 84 86 -
branches/hpc33/src/FillerWrapper.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/hpc33/src/SConscript
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/hpc33/src/STMath.cpp
r2502 r2519 54 54 #include "STSelector.h" 55 55 #include "Accelerator.h" 56 #include "STIdxIter.h" 56 57 57 58 using namespace casa; … … 3860 3861 } 3861 3862 else { 3863 // double t0 = mathutil::gettimeofday_sec() ; 3862 3864 vector<bool> masks = s->getMask( 0 ) ; 3863 3865 3864 3866 // off scan 3865 3867 STSelector sel = STSelector() ; 3866 vector<int> types ;3867 types.push_back( SrcType::PSOFF ) ;3868 vector<int> types( 1, SrcType::PSOFF ) ; 3869 //types.push_back( SrcType::PSOFF ) ; 3868 3870 sel.setTypes( types ) ; 3869 3871 s->setSelection( sel ) ; … … 3874 3876 CountedPtr<Scantable> soff = getScantable( s, false ) ; 3875 3877 Table ttab = soff->table() ; 3876 ROScalarColumn<Double> timeCol( ttab, "TIME" ) ; 3877 uInt nrow = timeCol.nrow() ; 3878 Vector<Double> timeSep( nrow - 1 ) ; 3878 // String tmpname = File::newUniqueName( "./", "temp" ).baseName() ; 3879 // Table ttab = s->table().copyToMemoryTable( tmpname, False ) ; 3880 ROScalarColumn<Double> *timeCol = new ROScalarColumn<Double>( ttab, "TIME" ) ; 3881 uInt nrow = timeCol->nrow() ; 3882 Vector<Double> timeSep = timeCol->getColumn() ; 3883 delete timeCol ; 3884 for ( uInt i = nrow-2 ; i > 0 ; i-- ) { 3885 timeSep[i] -= timeSep[i-1] ; 3886 } 3887 Vector<Double> interval = soff->integrCol_.getColumn() ; 3888 interval /= 86400.0 ; 3889 Block<uInt> gaplist( 100 ) ; 3890 uInt glidx = 0 ; 3891 uInt glsize = gaplist.size() ; 3879 3892 for ( uInt i = 0 ; i < nrow - 1 ; i++ ) { 3880 timeSep[i] = timeCol(i+1) - timeCol(i) ; 3881 } 3882 ScalarColumn<Double> intervalCol( ttab, "INTERVAL" ) ; 3883 Vector<Double> interval = intervalCol.getColumn() ; 3884 interval /= 86400.0 ; 3885 ScalarColumn<uInt> scanCol( ttab, "SCANNO" ) ; 3886 vector<uInt> glist ; 3887 for ( uInt i = 0 ; i < nrow - 1 ; i++ ) { 3888 double gap = 2.0 * timeSep[i] / ( interval[i] + interval[i+1] ) ; 3893 double gap = 2.0 * timeSep[i+1] / ( interval[i] + interval[i+1] ) ; 3889 3894 //cout << "gap[" << i << "]=" << setw(5) << gap << endl ; 3890 3895 if ( gap > 1.1 ) { 3891 glist.push_back( i ) ; 3892 } 3893 } 3894 Vector<uInt> gaplist( glist ) ; 3896 // cout << "detected gap between " << i << " and " << i+1 << endl ; 3897 gaplist[glidx] = i ; 3898 glidx++ ; 3899 } 3900 if ( glidx >= glsize ) { 3901 // cout << "resize gaplist" << endl ; 3902 glsize += 100 ; 3903 gaplist.resize( glsize ) ; 3904 } 3905 } 3895 3906 //cout << "gaplist = " << gaplist << endl ; 3896 3907 uInt newid = 0 ; 3897 3908 for ( uInt i = 0 ; i < nrow ; i++ ) { 3898 s canCol.put( i, newid ) ;3909 soff->scanCol_.put( i, newid ) ; 3899 3910 if ( i == gaplist[newid] ) { 3900 3911 newid++ ; … … 3907 3918 s->unsetSelection() ; 3908 3919 sel.reset() ; 3909 types.clear() ; 3920 //types.clear() ; 3921 // double t1 = mathutil::gettimeofday_sec() ; 3922 // cout << "elapsed time for off averaging: " << t1-t0 << " sec" << endl ; 3910 3923 3911 3924 // on scan 3925 // t0 = mathutil::gettimeofday_sec() ; 3912 3926 bool insitu = insitu_ ; 3913 3927 insitu_ = false ; 3914 3928 CountedPtr<Scantable> out = getScantable( s, true ) ; 3915 3929 insitu_ = insitu ; 3916 types.push_back( SrcType::PSON ) ; 3930 //types.push_back( SrcType::PSON ) ; 3931 types[0] = SrcType::PSON ; 3917 3932 sel.setTypes( types ) ; 3918 3933 s->setSelection( sel ) ; … … 3920 3935 s->unsetSelection() ; 3921 3936 sel.reset() ; 3922 types.clear() ; 3923 3937 //types.clear() ; 3938 // t1 = mathutil::gettimeofday_sec() ; 3939 // cout << "elapsed time for preparing output table: " << t1-t0 << " sec" << endl ; 3940 3924 3941 // process each on scan 3942 // t0 = mathutil::gettimeofday_sec() ; 3925 3943 // for ( int i = 0 ; i < out->nrow() ; i++ ) { 3926 3944 // vector<float> sp = getCalibratedSpectra( out, aoff, i ) ; … … 3928 3946 // } 3929 3947 3930 // selection first, then process 3931 vector<unsigned int> ifs = out->getIFNos() ; 3932 vector<unsigned int> beams = out->getBeamNos() ; 3933 vector<unsigned int> pols = out->getPolNos() ; 3934 vector<int> v( 1 ) ; 3935 for ( vector<unsigned int>::iterator i = ifs.begin() ; \ 3936 i != ifs.end() ; i++ ) { 3937 v[0] = *i ; 3938 sel.setIFs( v ) ; 3939 for ( vector<unsigned int>::iterator j = pols.begin() ; \ 3940 j != pols.end() ; j++ ) { 3941 v[0] = *j ; 3942 sel.setPolarizations( v ) ; 3943 for ( vector<unsigned int>::iterator k = beams.begin() ; \ 3944 k != beams.end() ; k++ ) { 3945 v[0] = *k ; 3946 sel.setBeams( v ) ; 3947 out->setSelection( sel ) ; 3948 aoff->setSelection( sel ) ; 3949 3950 // calibrate data 3951 calibrateALMA( out, aoff ) ; 3952 3953 out->unsetSelection() ; 3954 aoff->unsetSelection() ; 3955 sel.reset() ; 3956 } 3957 } 3958 } 3948 // using STIdxIterAcc 3949 vector<string> cols( 3 ) ; 3950 cols[0] = "BEAMNO" ; 3951 cols[1] = "POLNO" ; 3952 cols[2] = "IFNO" ; 3953 STIdxIter *iter = new STIdxIterAcc( out, cols ) ; 3954 while ( !iter->pastEnd() ) { 3955 Vector<uInt> ids = iter->current() ; 3956 stringstream ss ; 3957 ss << "SELECT FROM $1 WHERE " 3958 << "BEAMNO==" << ids[0] << "&&" 3959 << "POLNO==" << ids[1] << "&&" 3960 << "IFNO==" << ids[2] ; 3961 sel.setTaQL( ss.str() ) ; 3962 aoff->setSelection( sel ) ; 3963 Vector<uInt> rows = iter->getRows() ; 3964 calibrateALMA( out, aoff, rows ) ; 3965 aoff->unsetSelection() ; 3966 sel.reset() ; 3967 iter->next() ; 3968 } 3969 delete iter ; 3970 3971 // t1 = mathutil::gettimeofday_sec() ; 3972 // cout << "elapsed time for calibration: " << t1-t0 << " sec" << endl ; 3959 3973 3960 3974 // flux unit … … 5087 5101 5088 5102 void STMath::calibrateALMA( CountedPtr<Scantable>& on, 5089 5090 { 5091 // string reftime = on->getTime( index ) ;5103 CountedPtr<Scantable>& off ) 5104 { 5105 // string reftime = on->getTime( index ) ; 5092 5106 ROTableColumn timeCol( on->table(), "TIME" ) ; 5093 5107 ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ; … … 5115 5129 } 5116 5130 on->setSpectrum( sp, index ) ; 5131 } 5132 } 5133 5134 void STMath::calibrateALMA( CountedPtr<Scantable>& on, 5135 CountedPtr<Scantable>& off, 5136 Vector<uInt>& rows ) 5137 { 5138 // string reftime = on->getTime( index ) ; 5139 ROTableColumn timeCol( on->table(), "TIME" ) ; 5140 ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ; 5141 vector<float> sp( on->nchan( on->getIF(rows[0]) ) ) ; 5142 unsigned int spsize = sp.size() ; 5143 // I know that the data is contiguous 5144 const uInt *p = rows.data() ; 5145 for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) { 5146 //int index = rows[irow] ; 5147 //double reftime = timeCol.asdouble(index) ; 5148 double reftime = timeCol.asdouble(*p) ; 5149 vector<float> spoff = getSpectrumFromTime( reftime, off, "linear" ) ; 5150 //vector<float> spec = on->getSpectrum( index ) ; 5151 //Vector<Float> tsys = tsysCol( index ) ; 5152 vector<float> spec = on->getSpectrum( *p ) ; 5153 Vector<Float> tsys = tsysCol( *p ) ; 5154 // ALMA Calibration 5155 // 5156 // Ta* = Tsys * ( ON - OFF ) / OFF 5157 // 5158 // 2010/01/07 Takeshi Nakazato 5159 unsigned int tsyssize = tsys.nelements() ; 5160 for ( unsigned int j = 0 ; j < sp.size() ; j++ ) { 5161 float tscale = 0.0 ; 5162 if ( tsyssize == spsize ) 5163 tscale = tsys[j] ; 5164 else 5165 tscale = tsys[0] ; 5166 float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ; 5167 sp[j] = v ; 5168 } 5169 //on->setSpectrum( sp, index ) ; 5170 on->setSpectrum( sp, *p ) ; 5171 p++ ; 5117 5172 } 5118 5173 } -
branches/hpc33/src/STMath.h
r2502 r2519 423 423 void calibrateALMA( casa::CountedPtr<Scantable>& on, 424 424 casa::CountedPtr<Scantable>& off ) ; 425 void calibrateALMA( casa::CountedPtr<Scantable>& on, 426 casa::CountedPtr<Scantable>& off, 427 casa::Vector<casa::uInt>& rows ) ; 425 428 vector<float> getFSCalibratedSpectra( casa::CountedPtr<Scantable>& sig, 426 429 casa::CountedPtr<Scantable>& ref, -
branches/hpc33/src/python_asap.cpp
r2356 r2519 85 85 asap::python::python_SrcType(); 86 86 asap::python::python_STGrid(); 87 asap::python::python_Iterator(); 87 88 88 89 #ifndef HAVE_LIBPYRAP -
branches/hpc33/src/python_asap.h
r2356 r2519 53 53 void python_SrcType(); 54 54 void python_STGrid(); 55 void python_Iterator(); 55 56 56 57 } // python
Note:
See TracChangeset
for help on using the changeset viewer.