Changeset 480
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMath.cc
r478 r480 1074 1074 cout << "Jy/K = " << JyPerK << endl; 1075 1075 Vector<Float> factors(in.nRow(), factor); 1076 correctFromVector (pTabOut, in, doAll, factors);1076 scaleByVector(pTabOut, in, doAll, factors, False); 1077 1077 } else if (etaAp>0.0) { 1078 1078 Bool throwIt = True; … … 1088 1088 // 1089 1089 Vector<Float> factors(in.nRow(), factor); 1090 correctFromVector (pTabOut, in, doAll, factors);1090 scaleByVector(pTabOut, in, doAll, factors, False); 1091 1091 } else { 1092 1092 … … 1164 1164 Vector<Float> factor(nRow); 1165 1165 for (uInt i=0; i<nRow; i++) { 1166 factor[i] = (*pPoly)(x[i]);1166 factor[i] = 1.0 / (*pPoly)(x[i]); 1167 1167 } 1168 1168 delete pPoly; 1169 1169 // 1170 correctFromVector (pTabOut, in, doAll, factor);1170 scaleByVector (pTabOut, in, doAll, factor, True); 1171 1171 } else { 1172 1172 … … 1179 1179 1180 1180 cout << "Making correction from ascii Table" << endl; 1181 correctFromAsciiTable (pTabOut, in, fileName, col0, col1,1182 methodStr, doAll, x);1181 scaleFromAsciiTable (pTabOut, in, fileName, col0, col1, 1182 methodStr, doAll, x, True); 1183 1183 } 1184 1184 // … … 1214 1214 // Correct 1215 1215 1216 correctFromVector (pTabOut, in, doAll, factor);1216 scaleByVector (pTabOut, in, doAll, factor, True); 1217 1217 // 1218 1218 return pTabOut; … … 1799 1799 1800 1800 1801 void SDMath:: correctFromAsciiTable(SDMemTable* pTabOut,1802 1803 1804 1805 const Vector<Float>& xOut) const1801 void SDMath::scaleFromAsciiTable(SDMemTable* pTabOut, 1802 const SDMemTable& in, const String& fileName, 1803 const String& col0, const String& col1, 1804 const String& methodStr, Bool doAll, 1805 const Vector<Float>& xOut, Bool doTSys) const 1806 1806 { 1807 1807 … … 1810 1810 Table geTable = readAsciiFile (fileName); 1811 1811 // 1812 correctFromTable (pTabOut, in, geTable, col0, col1, methodStr, doAll, xOut);1813 } 1814 1815 void SDMath:: correctFromTable(SDMemTable* pTabOut, const SDMemTable& in,1816 1817 1818 1819 const Vector<Float>& xOut) const1812 scaleFromTable (pTabOut, in, geTable, col0, col1, methodStr, doAll, xOut, doTSys); 1813 } 1814 1815 void SDMath::scaleFromTable(SDMemTable* pTabOut, const SDMemTable& in, 1816 const Table& tTable, const String& col0, 1817 const String& col1, 1818 const String& methodStr, Bool doAll, 1819 const Vector<Float>& xOut, Bool doTsys) const 1820 1820 { 1821 1821 … … 1841 1841 // Apply 1842 1842 1843 correctFromVector (pTabOut, in, doAll, yOut); 1844 } 1845 1846 1847 void SDMath::correctFromVector (SDMemTable* pTabOut, const SDMemTable& in, 1848 Bool doAll, const Vector<Float>& factor) const 1843 scaleByVector(pTabOut, in, doAll, Float(1.0)/yOut, doTsys); 1844 } 1845 1846 1847 void SDMath::scaleByVector(SDMemTable* pTabOut, const SDMemTable& in, 1848 Bool doAll, const Vector<Float>& factor, 1849 Bool doTSys) const 1849 1850 { 1850 1851 … … 1853 1854 IPosition start, end; 1854 1855 setCursorSlice (start, end, doAll, in); 1856 1857 // Get Tsys column 1858 1859 const Table& tIn = in.table(); 1860 ArrayColumn<Float> tSysCol(tIn, "TSYS"); 1861 Array<Float> tSys; 1855 1862 1856 1863 // Loop over rows and apply correction factor … … 1863 1870 MaskedArray<Float> dataIn(in.rowAsMaskedArray(i)); 1864 1871 MaskedArray<Float> dataIn2 = dataIn(start,end); // reference to dataIn 1872 // 1873 if (doTSys) { 1874 tSysCol.get(i, tSys); 1875 Array<Float> tSys2 = tSys(start,end) * factor[i]; 1876 tSysCol.put(i, tSys); 1877 } 1865 1878 1866 1879 // Apply factor … … 1971 1984 } 1972 1985 } 1986 1987 Vector<uInt> SDMath::getRowRange (const SDMemTable& in) const 1988 { 1989 Vector<uInt> range(2); 1990 range[0] = 0; 1991 range[1] = in.nRow()-1; 1992 return range; 1993 } 1994 1995 1996 Bool SDMath::rowInRange (uInt i, const Vector<uInt>& range) const 1997 { 1998 return (i>=range[0] && i<=range[1]); 1999 } -
trunk/src/SDMath.h
r457 r480 159 159 const casa::String& interp) const; 160 160 161 // Correct datafrom an ascii Table162 void correctFromAsciiTable(SDMemTable* pTabOut, const SDMemTable& in,161 // Scale data with values from an ascii Table 162 void scaleFromAsciiTable(SDMemTable* pTabOut, const SDMemTable& in, 163 163 const casa::String& fileName, 164 164 const casa::String& col0, const casa::String& col1, 165 165 const casa::String& methodStr, casa::Bool doAll, 166 const casa::Vector<casa::Float>& xOut ) const;167 168 // Correct datafrom a Table169 void correctFromTable(SDMemTable* pTabOut, const SDMemTable& in, const casa::Table& tTable,166 const casa::Vector<casa::Float>& xOut, casa::Bool doTSys) const; 167 168 // Scale data with values from a Table 169 void scaleFromTable(SDMemTable* pTabOut, const SDMemTable& in, const casa::Table& tTable, 170 170 const casa::String& col0, const casa::String& col1, 171 171 const casa::String& methodStr, casa::Bool doAll, 172 const casa::Vector<casa::Float>& xOut) const; 173 174 // Correct data from a Vector 175 void correctFromVector (SDMemTable* pTabOut, const SDMemTable& in, 176 casa::Bool doAll, const casa::Vector<casa::Float>& factor) const; 172 const casa::Vector<casa::Float>& xOut, casa::Bool doTSys) const; 173 174 // Scale data and optionally TSys by values in a Vector 175 void scaleByVector (SDMemTable* pTabOut, const SDMemTable& in, 176 casa::Bool doAll, const casa::Vector<casa::Float>& factor, 177 casa::Bool doTSys) const; 177 178 178 179 // Convert time String to Epoch … … 215 216 casa::Bool perFreqID) const; 216 217 218 // Get row range from SDMemTable state 219 casa::Vector<casa::uInt> getRowRange (const SDMemTable& in) const; 220 221 // Is row in the row range ? 222 casa::Bool rowInRange (casa::uInt i, const casa::Vector<casa::uInt>& range) const; 223 217 224 // Set slice to cursor or all axes 218 225 void setCursorSlice (casa::IPosition& start, casa::IPosition& end,
Note:
See TracChangeset
for help on using the changeset viewer.