Changeset 2431
- Timestamp:
- 03/14/12 15:15:57 (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r2429 r2431 275 275 Parameters: 276 276 277 name: the name of the outputfile. For format "ASCII"277 name: the name of the outputfile. For format 'ASCII' 278 278 this is the root file name (data in 'name'.txt 279 279 and header in 'name'_header.txt) … … 533 533 534 534 selection: a selector object (default unset the selection), or 535 any combination of "pols", "ifs", "beams", "scans",536 "cycles", "name", "query"535 any combination of 'pols', 'ifs', 'beams', 'scans', 536 'cycles', 'name', 'query' 537 537 538 538 Examples:: … … 1202 1202 end: the end frequency or period to remove 1203 1203 1204 unit: the frequency unit (default "MHz") or ""for1204 unit: the frequency unit (default 'MHz') or '' for 1205 1205 explicit lag channels 1206 1206 … … 1754 1754 # provided your scantable is called scan 1755 1755 selection = selector() 1756 selection.set_name( "ORION*")1756 selection.set_name('ORION*') 1757 1757 selection.set_ifs([1]) 1758 1758 scan.set_selection(selection) … … 1995 1995 The first row of the ascii file must give the column 1996 1996 names and these MUST include columns 1997 "ELEVATION" (degrees) and "FACTOR"(multiply data1997 'ELEVATION' (degrees) and 'FACTOR' (multiply data 1998 1998 by this) somewhere. 1999 1999 The second row must give the data type of the … … 2012 2012 2013 2013 method: Interpolation method when correcting from a table. 2014 Values are "nearest", "linear" (default), "cubic"2015 and "spline"2014 Values are 'nearest', 'linear' (default), 'cubic' 2015 and 'spline' 2016 2016 2017 2017 insitu: if False a new scantable is returned. … … 2047 2047 2048 2048 method: Interpolation method for regridding the spectra. 2049 Choose from "nearest", "linear", "cubic"(default)2050 and "spline"2049 Choose from 'nearest', 'linear', 'cubic' (default) 2050 and 'spline' 2051 2051 2052 2052 insitu: if False a new scantable is returned. … … 2138 2138 2139 2139 method: Interpolation method when correcting from a table. 2140 Values are "nearest", "linear", "cubic"(default)2141 and "spline"2140 Values are 'nearest', 'linear', 'cubic' (default) 2141 and 'spline' 2142 2142 2143 2143 insitu: if False a new scantable is returned. … … 2222 2222 2223 2223 poltype: The new polarisation type. Valid types are: 2224 "linear", "circular", "stokes" and "linpol"2224 'linear', 'circular', 'stokes' and 'linpol' 2225 2225 2226 2226 """ -
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.