- Timestamp:
- 03/14/12 15:15:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r2427 r2431 1906 1906 1907 1907 // change channel number for specCol_ and flagCol_ 1908 Vector<Float> newspec( nChan, 0 ) ;1909 Vector<uChar> newflag( nChan, false ) ;1908 //Vector<Float> newspec( nChan, 0 ) ; 1909 //Vector<uChar> newflag( nChan, false ) ; 1910 1910 vector<string> coordinfo = getCoordInfo() ; 1911 1911 string oldinfo = coordinfo[0] ; … … 1933 1933 Vector<Float> oldspec = specCol_( irow ) ; 1934 1934 Vector<uChar> oldflag = flagsCol_( irow ) ; 1935 Vector<Float> oldtsys = tsysCol_( irow ) ; 1935 1936 Vector<Float> newspec( nChan, 0 ) ; 1936 Vector<uChar> newflag( nChan, false ) ; 1937 //Vector<uChar> newflag( nChan, false ) ; 1938 Vector<uChar> newflag( nChan, true ) ; 1939 Vector<Float> newtsys ; 1940 bool regridTsys = false ; 1941 if (oldtsys.size() == oldspec.size()) { 1942 regridTsys = true ; 1943 newtsys.resize(nChan,false) ; 1944 newtsys = 0 ; 1945 } 1937 1946 1938 1947 // regrid … … 1949 1958 Vector<Float> yi( oldsize + 1 ) ; 1950 1959 zi[0] = abcissa[0] - 0.5 * olddnu ; 1951 zi[1] = zi[1] + dnu ;1952 for ( int ii = 2; ii < nChan ; ii++ )1960 //zi[1] = zi[1] + dnu ; 1961 for ( int ii = 1 ; ii < nChan ; ii++ ) 1953 1962 zi[ii] = zi[0] + dnu * ii ; 1954 1963 zi[nChan] = zi[nChan-1] + dnu ; 1955 1964 yi[0] = abcissa[0] - 0.5 * olddnu ; 1956 yi[1] = abcissa[1] + 0.5 * olddnu ; 1957 for ( int ii = 2 ; ii < oldsize ; ii++ ) 1958 yi[ii] = abcissa[ii-1] + olddnu ; 1965 //yi[1] = abcissa[1] + 0.5 * olddnu ; 1966 for ( int ii = 1 ; ii < oldsize ; ii++ ) 1967 //yi[ii] = abcissa[ii-1] + olddnu ; 1968 yi[ii] = yi[0] + olddnu * ii ; 1959 1969 yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ; 1960 1970 if ( dnu > 0.0 ) { … … 1970 1980 } 1971 1981 else if ( yr <= zr ) { 1972 newspec[ii] += oldspec[j] * ( yr - zl ) ; 1973 newflag[ii] = newflag[ii] || oldflag[j] ; 1974 wsum += ( yr - zl ) ; 1982 if (!oldflag[j]) { 1983 newspec[ii] += oldspec[j] * ( yr - zl ) ; 1984 if (regridTsys) newtsys[ii] += oldtsys[j] * ( yr - zl ) ; 1985 wsum += ( yr - zl ) ; 1986 } 1987 //newflag[ii] = newflag[ii] || oldflag[j] ; 1988 newflag[ii] = newflag[ii] && oldflag[j] ; 1975 1989 } 1976 1990 else { 1977 newspec[ii] += oldspec[j] * dnu ; 1978 newflag[ii] = newflag[ii] || oldflag[j] ; 1979 wsum += dnu ; 1991 if (!oldflag[j]) { 1992 newspec[ii] += oldspec[j] * dnu ; 1993 if (regridTsys) newtsys[ii] += oldtsys[j] * dnu ; 1994 wsum += dnu ; 1995 } 1996 //newflag[ii] = newflag[ii] || oldflag[j] ; 1997 newflag[ii] = newflag[ii] && oldflag[j] ; 1980 1998 ichan = j ; 1981 1999 break ; … … 1984 2002 else if ( yl < zr ) { 1985 2003 if ( yr <= zr ) { 1986 newspec[ii] += oldspec[j] * ( yr - yl ) ; 1987 newflag[ii] = newflag[ii] || oldflag[j] ; 2004 if (!oldflag[j]) { 2005 newspec[ii] += oldspec[j] * ( yr - yl ) ; 2006 if (regridTsys) newtsys[ii] += oldtsys[j] * ( yr - yl ) ; 1988 2007 wsum += ( yr - yl ) ; 2008 } 2009 //newflag[ii] = newflag[ii] || oldflag[j] ; 2010 newflag[ii] = newflag[ii] && oldflag[j] ; 1989 2011 } 1990 2012 else { 1991 newspec[ii] += oldspec[j] * ( zr - yl ) ; 1992 newflag[ii] = newflag[ii] || oldflag[j] ; 1993 wsum += ( zr - yl ) ; 2013 if (!oldflag[j]) { 2014 newspec[ii] += oldspec[j] * ( zr - yl ) ; 2015 if (regridTsys) newtsys[ii] += oldtsys[j] * ( zr - yl ) ; 2016 wsum += ( zr - yl ) ; 2017 } 2018 //newflag[ii] = newflag[ii] || oldflag[j] ; 2019 newflag[ii] = newflag[ii] && oldflag[j] ; 1994 2020 ichan = j ; 1995 2021 break ; … … 2001 2027 } 2002 2028 } 2003 if ( wsum != 0.0 ) 2029 if ( wsum != 0.0 ) { 2004 2030 newspec[ii] /= wsum ; 2031 if (regridTsys) newtsys[ii] /= wsum ; 2032 } 2005 2033 wsum = 0.0 ; 2006 2034 } … … 2018 2046 } 2019 2047 else if ( yr >= zr ) { 2020 newspec[ii] += oldspec[j] * abs( yr - zl ) ; 2021 newflag[ii] = newflag[ii] || oldflag[j] ; 2022 wsum += abs( yr - zl ) ; 2048 if (!oldflag[j]) { 2049 newspec[ii] += oldspec[j] * abs( yr - zl ) ; 2050 if (regridTsys) newtsys[ii] += oldtsys[j] * abs( yr - zl ) ; 2051 wsum += abs( yr - zl ) ; 2052 } 2053 //newflag[ii] = newflag[ii] || oldflag[j] ; 2054 newflag[ii] = newflag[ii] && oldflag[j] ; 2023 2055 } 2024 2056 else { 2025 newspec[ii] += oldspec[j] * abs( dnu ) ; 2026 newflag[ii] = newflag[ii] || oldflag[j] ; 2027 wsum += abs( dnu ) ; 2057 if (!oldflag[j]) { 2058 newspec[ii] += oldspec[j] * abs( dnu ) ; 2059 if (regridTsys) newtsys[ii] += oldtsys[j] * abs( dnu ) ; 2060 wsum += abs( dnu ) ; 2061 } 2062 //newflag[ii] = newflag[ii] || oldflag[j] ; 2063 newflag[ii] = newflag[ii] && oldflag[j] ; 2028 2064 ichan = j ; 2029 2065 break ; … … 2032 2068 else if ( yl > zr ) { 2033 2069 if ( yr >= zr ) { 2034 newspec[ii] += oldspec[j] * abs( yr - yl ) ; 2035 newflag[ii] = newflag[ii] || oldflag[j] ; 2036 wsum += abs( yr - yl ) ; 2070 if (!oldflag[j]) { 2071 newspec[ii] += oldspec[j] * abs( yr - yl ) ; 2072 if (regridTsys) newtsys[ii] += oldtsys[j] * abs( yr - yl ) ; 2073 wsum += abs( yr - yl ) ; 2074 } 2075 //newflag[ii] = newflag[ii] || oldflag[j] ; 2076 newflag[ii] = newflag[ii] && oldflag[j] ; 2037 2077 } 2038 2078 else { 2039 newspec[ii] += oldspec[j] * abs( zr - yl ) ; 2040 newflag[ii] = newflag[ii] || oldflag[j] ; 2041 wsum += abs( zr - yl ) ; 2079 if (!oldflag[j]) { 2080 newspec[ii] += oldspec[j] * abs( zr - yl ) ; 2081 if (regridTsys) newtsys[ii] += oldtsys[j] * abs( zr - yl ) ; 2082 wsum += abs( zr - yl ) ; 2083 } 2084 //newflag[ii] = newflag[ii] || oldflag[j] ; 2085 newflag[ii] = newflag[ii] && oldflag[j] ; 2042 2086 ichan = j ; 2043 2087 break ; … … 2049 2093 } 2050 2094 } 2051 if ( wsum != 0.0 ) 2095 if ( wsum != 0.0 ) { 2052 2096 newspec[ii] /= wsum ; 2097 if (regridTsys) newtsys[ii] /= wsum ; 2098 } 2053 2099 wsum = 0.0 ; 2054 2100 } … … 2138 2184 specCol_.put( irow, newspec ) ; 2139 2185 flagsCol_.put( irow, newflag ) ; 2186 if (regridTsys) tsysCol_.put( irow, newtsys ); 2140 2187 2141 2188 return ;
Note:
See TracChangeset
for help on using the changeset viewer.