Changeset 2435 for trunk/src/Scantable.cpp
- Timestamp:
- 03/15/12 15:25:45 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r2433 r2435 1885 1885 } 1886 1886 1887 void asap::Scantable::regridSpecChannel( double dnu, int nChan ) 1888 { 1889 LogIO os( LogOrigin( "Scantable", "regridChannel()", WHERE ) ) ; 1890 os << "Regrid abcissa with spectral resoultion " << dnu << " " << freqTable_.getUnitString() << " with channel number " << ((nChan>0)? String(nChan) : "covering band width")<< LogIO::POST ; 1891 int freqnrow = freqTable_.table().nrow() ; 1892 Vector<bool> firstTime( freqnrow, true ) ; 1893 double oldincr, factor; 1894 uInt currId; 1895 Double refpix ; 1896 Double refval ; 1897 Double increment ; 1898 for ( int irow = 0 ; irow < nrow() ; irow++ ) { 1899 currId = mfreqidCol_(irow); 1900 vector<double> abcissa = getAbcissa( irow ) ; 1901 if (nChan < 0) { 1902 int oldsize = abcissa.size() ; 1903 double bw = (abcissa[oldsize-1]-abcissa[0]) + \ 1904 0.5 * (abcissa[1]-abcissa[0] + abcissa[oldsize-1]-abcissa[oldsize-2]) ; 1905 nChan = int( ceil( abs(bw/dnu) ) ) ; 1906 } 1907 // actual regridding 1908 regridChannel( nChan, dnu, irow ) ; 1909 1910 // update FREQUENCIES subtable 1911 if (firstTime[currId]) { 1912 oldincr = abcissa[1]-abcissa[0] ; 1913 factor = dnu/oldincr ; 1914 firstTime[currId] = false ; 1915 freqTable_.getEntry( refpix, refval, increment, currId ) ; 1916 /*** 1917 * need to shift refpix to 0 1918 ***/ 1919 refval = refval - ( refpix + 0.5 * (1 - factor) ) * increment ; 1920 refpix = 0 ; 1921 freqTable_.setEntry( refpix, refval, increment*factor, currId ) ; 1922 os << "ID" << currId << ": channel width (Orig) = " << oldincr << " [" << freqTable_.getUnitString() << "], scale factor = " << factor << LogIO::POST ; 1923 os << " frequency increment (Orig) = " << increment << "-> (New) " << increment*factor << LogIO::POST ; 1924 } 1925 } 1926 } 1887 1927 1888 1928 void asap::Scantable::regridChannel( int nChan, double dnu )
Note: See TracChangeset
for help on using the changeset viewer.