Changeset 2567
- Timestamp:
- 06/14/12 10:01:40 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/src/STMath.cpp
r2566 r2567 4781 4781 const uInt *p = rows.data() ; 4782 4782 vector<int> ids( 2 ) ; 4783 Block<uInt> flagchan( spsize ) ; 4784 uInt nflag = 0 ; 4783 4785 for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) { 4784 4786 double reftime = timeCol.asdouble(*p) ; … … 4795 4797 // using gain array 4796 4798 for ( unsigned int j = 0 ; j < tcal.size() ; j++ ) { 4797 spec[j] = ( ( spec[j] - spoff[j] ) / spoff[j] ) 4798 * ( spsky[j] / ( sphot[j] - spsky[j] ) ) * tcal[j] ; 4799 if ( spoff[j] == 0.0 || (sphot[j]-spsky[j]) == 0.0 ) { 4800 spec[j] = 0.0 ; 4801 flagchan[nflag++] = j ; 4802 } 4803 else { 4804 spec[j] = ( ( spec[j] - spoff[j] ) / spoff[j] ) 4805 * ( spsky[j] / ( sphot[j] - spsky[j] ) ) * tcal[j] ; 4806 } 4799 4807 } 4800 4808 } … … 4802 4810 // Chopper-Wheel calibration (Ulich & Haas 1976) 4803 4811 for ( unsigned int j = 0 ; j < tcal.size() ; j++ ) { 4804 spec[j] = ( spec[j] - spoff[j] ) / ( sphot[j] - spsky[j] ) * tcal[j] ; 4812 if ( (sphot[j]-spsky[j]) == 0.0 ) { 4813 spec[j] = 0.0 ; 4814 flagchan[nflag++] = j ; 4815 } 4816 else { 4817 spec[j] = ( spec[j] - spoff[j] ) / ( sphot[j] - spsky[j] ) * tcal[j] ; 4818 } 4805 4819 } 4806 4820 } 4807 4821 out->specCol_.put( *p, spec ) ; 4808 4822 out->tsysCol_.put( *p, tsys ) ; 4823 if ( nflag > 0 ) { 4824 Vector<uChar> fl = out->flagsCol_( *p ) ; 4825 for ( unsigned int j = 0 ; j < nflag ; j++ ) { 4826 fl[flagchan[j]] = (uChar)True ; 4827 } 4828 out->flagsCol_.put( *p, fl ) ; 4829 } 4830 nflag = 0 ; 4809 4831 p++ ; 4810 4832 } … … 4831 4853 const uInt *p = rows.data() ; 4832 4854 vector<int> ids( 2 ) ; 4855 Block<uInt> flagchan( spsize ) ; 4856 uInt nflag = 0 ; 4833 4857 for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) { 4834 4858 double reftime = timeCol.asdouble(*p) ; … … 4845 4869 unsigned int tsyssize = tsys.nelements() ; 4846 4870 for ( unsigned int j = 0 ; j < spsize ; j++ ) { 4847 spec[j] = ( spec[j] - spoff[j] ) / spoff[j] ; 4871 if ( spoff[j] == 0.0 ) { 4872 spec[j] = 0.0 ; 4873 flagchan[nflag++] = j ; 4874 } 4875 else { 4876 spec[j] = ( spec[j] - spoff[j] ) / spoff[j] ; 4877 } 4848 4878 if ( tsyssize == spsize ) 4849 4879 spec[j] *= tsys[j] ; … … 4852 4882 } 4853 4883 out->specCol_.put( *p, spec ) ; 4884 if ( nflag > 0 ) { 4885 Vector<uChar> fl = out->flagsCol_( *p ) ; 4886 for ( unsigned int j = 0 ; j < nflag ; j++ ) { 4887 fl[flagchan[j]] = (uChar)True ; 4888 } 4889 out->flagsCol_.put( *p, fl ) ; 4890 } 4891 nflag = 0 ; 4854 4892 p++ ; 4855 4893 } … … 4890 4928 const uInt *p = rows.data() ; 4891 4929 vector<int> ids( 2 ) ; 4930 Block<uInt> flagchan( spsize ) ; 4931 uInt nflag = 0 ; 4892 4932 for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) { 4893 4933 double reftime = timeCol.asdouble(*p) ; … … 4908 4948 Vector<Float> spref = on[1]->specCol_( *p ) ; 4909 4949 for ( unsigned int j = 0 ; j < spsize ; j++ ) { 4910 spec[j] = tcalS[j] * spsig[j] / ( sphotS[j] - spskyS[j] ) 4911 - tcalR[j] * spref[j] / ( sphotR[j] - spskyR[j] ) ; 4950 if ( (sphotS[j]-spskyS[j]) == 0.0 || (sphotR[j]-spskyR[j]) == 0.0 ) { 4951 spec[j] = 0.0 ; 4952 flagchan[nflag++] = j ; 4953 } 4954 else { 4955 spec[j] = tcalS[j] * spsig[j] / ( sphotS[j] - spskyS[j] ) 4956 - tcalR[j] * spref[j] / ( sphotR[j] - spskyR[j] ) ; 4957 } 4912 4958 } 4913 4959 sig->specCol_.put( *p, spec ) ; … … 4916 4962 ref->specCol_.put( *p, spec ) ; 4917 4963 ref->tsysCol_.put( *p, tsysR ) ; 4964 if ( nflag > 0 ) { 4965 Vector<uChar> flsig = sig->flagsCol_( *p ) ; 4966 Vector<uChar> flref = ref->flagsCol_( *p ) ; 4967 for ( unsigned int j = 0 ; j < nflag ; j++ ) { 4968 flsig[flagchan[j]] = (uChar)True ; 4969 flref[flagchan[j]] = (uChar)True ; 4970 } 4971 sig->flagsCol_.put( *p, flsig ) ; 4972 ref->flagsCol_.put( *p, flref ) ; 4973 } 4974 nflag = 0 ; 4918 4975 p++ ; 4919 4976 } … … 4947 5004 const uInt *p = rows.data() ; 4948 5005 vector<int> ids( 2 ) ; 5006 Block<uInt> flagchan( spsize ) ; 5007 uInt nflag = 0 ; 4949 5008 for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) { 4950 5009 double reftime = timeCol.asdouble(*p) ; … … 4959 5018 // using gain array 4960 5019 for ( unsigned int j = 0 ; j < spsize ; j++ ) { 4961 spec[j] = ( ( spsig[j] - spref[j] ) / spref[j] ) 4962 * ( spsky[j] / ( sphot[j] - spsky[j] ) ) * tcal[j] ; 5020 if ( spref[j] == 0.0 || (sphot[j]-spsky[j]) == 0.0 ) { 5021 spec[j] = 0.0 ; 5022 flagchan[nflag++] = j ; 5023 } 5024 else { 5025 spec[j] = ( ( spsig[j] - spref[j] ) / spref[j] ) 5026 * ( spsky[j] / ( sphot[j] - spsky[j] ) ) * tcal[j] ; 5027 } 4963 5028 } 4964 5029 sig->specCol_.put( *p, spec ) ; 4965 5030 sig->tsysCol_.put( *p, tsys ) ; 5031 if ( nflag > 0 ) { 5032 Vector<uChar> fl = sig->flagsCol_( *p ) ; 5033 for ( unsigned int j = 0 ; j < nflag ; j++ ) { 5034 fl[flagchan[j]] = (uChar)True ; 5035 } 5036 sig->flagsCol_.put( *p, fl ) ; 5037 } 5038 nflag = 0 ; 4966 5039 4967 5040 reftime = timeCol2.asdouble(*p) ; … … 4973 5046 // using gain array 4974 5047 for ( unsigned int j = 0 ; j < spsize ; j++ ) { 4975 spec[j] = ( ( spref[j] - spsig[j] ) / spsig[j] ) 4976 * ( spsky[j] / ( sphot[j] - spsky[j] ) ) * tcal[j] ; 5048 if ( spsig[j] == 0.0 || (sphot[j]-spsky[j]) == 0.0 ) { 5049 spec[j] = 0.0 ; 5050 flagchan[nflag++] = j ; 5051 } 5052 else { 5053 spec[j] = ( ( spref[j] - spsig[j] ) / spsig[j] ) 5054 * ( spsky[j] / ( sphot[j] - spsky[j] ) ) * tcal[j] ; 5055 } 4977 5056 } 4978 5057 ref->specCol_.put( *p, spec ) ; 4979 5058 ref->tsysCol_.put( *p, tsys ) ; 5059 if ( nflag > 0 ) { 5060 Vector<uChar> fl = ref->flagsCol_( *p ) ; 5061 for ( unsigned int j = 0 ; j < nflag ; j++ ) { 5062 fl[flagchan[j]] = (uChar)True ; 5063 } 5064 ref->flagsCol_.put( *p, fl ) ; 5065 } 5066 nflag = 0 ; 4980 5067 p++ ; 4981 5068 }
Note:
See TracChangeset
for help on using the changeset viewer.