Changeset 2502
- Timestamp:
- 05/11/12 18:38:39 (13 years ago)
- Location:
- branches/hpc33/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/src/STMath.cpp
r2473 r2502 3923 3923 3924 3924 // process each on scan 3925 ArrayColumn<Float> tsysCol ; 3926 tsysCol.attach( out->table(), "TSYS" ) ; 3927 for ( int i = 0 ; i < out->nrow() ; i++ ) { 3928 vector<float> sp = getCalibratedSpectra( out, aoff, i ) ; 3929 out->setSpectrum( sp, i ) ; 3925 // for ( int i = 0 ; i < out->nrow() ; i++ ) { 3926 // vector<float> sp = getCalibratedSpectra( out, aoff, i ) ; 3927 // out->setSpectrum( sp, i ) ; 3928 // } 3929 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 } 3930 3958 } 3931 3959 … … 4575 4603 vector<float> sp0 = s->getSpectrum( idx[0] ) ; 4576 4604 vector<float> sp1 = s->getSpectrum( idx[1] ) ; 4605 sp.resize( sp0.size() ) ; 4577 4606 for ( unsigned int i = 0 ; i < sp0.size() ; i++ ) { 4578 float v = ( sp1[i] - sp0[i] ) / ( t1 - t0 ) * ( tref - t0 ) + sp0[i] ; 4579 sp.push_back( v ) ; 4607 sp[i] = ( sp1[i] - sp0[i] ) / ( t1 - t0 ) * ( tref - t0 ) + sp0[i] ; 4580 4608 } 4581 4609 } … … 4975 5003 vector<int> ib( 1, on->getBeam( index ) ) ; 4976 5004 vector<int> ip( 1, on->getPol( index ) ) ; 4977 vector<int> ic( 1, on->getScan( index ) ) ;4978 5005 STSelector sel = STSelector() ; 4979 5006 sel.setIFs( ii ) ; … … 5025 5052 vector<int> ib( 1, on->getBeam( index ) ) ; 5026 5053 vector<int> ip( 1, on->getPol( index ) ) ; 5027 vector<int> ic( 1, on->getScan( index ) ) ;5028 5054 STSelector sel = STSelector() ; 5029 5055 sel.setIFs( ii ) ; … … 5058 5084 5059 5085 return sp ; 5086 } 5087 5088 void STMath::calibrateALMA( CountedPtr<Scantable>& on, 5089 CountedPtr<Scantable>& off ) 5090 { 5091 // string reftime = on->getTime( index ) ; 5092 ROTableColumn timeCol( on->table(), "TIME" ) ; 5093 ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ; 5094 vector<float> sp( on->nchan( on->getIF(0) ) ) ; 5095 unsigned int spsize = sp.size() ; 5096 for ( int index = 0 ; index < on->nrow() ; index++ ) { 5097 double reftime = timeCol.asdouble(index) ; 5098 vector<float> spoff = getSpectrumFromTime( reftime, off, "linear" ) ; 5099 vector<float> spec = on->getSpectrum( index ) ; 5100 Vector<Float> tsys = tsysCol( index ) ; 5101 // ALMA Calibration 5102 // 5103 // Ta* = Tsys * ( ON - OFF ) / OFF 5104 // 5105 // 2010/01/07 Takeshi Nakazato 5106 unsigned int tsyssize = tsys.nelements() ; 5107 for ( unsigned int j = 0 ; j < sp.size() ; j++ ) { 5108 float tscale = 0.0 ; 5109 if ( tsyssize == spsize ) 5110 tscale = tsys[j] ; 5111 else 5112 tscale = tsys[0] ; 5113 float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ; 5114 sp[j] = v ; 5115 } 5116 on->setSpectrum( sp, index ) ; 5117 } 5060 5118 } 5061 5119 -
branches/hpc33/src/STMath.h
r2443 r2502 421 421 casa::CountedPtr<Scantable>& off, 422 422 int index ) ; 423 void calibrateALMA( casa::CountedPtr<Scantable>& on, 424 casa::CountedPtr<Scantable>& off ) ; 423 425 vector<float> getFSCalibratedSpectra( casa::CountedPtr<Scantable>& sig, 424 426 casa::CountedPtr<Scantable>& ref,
Note:
See TracChangeset
for help on using the changeset viewer.