- Timestamp:
- 01/16/09 15:03:06 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r1439 r1475 1746 1746 1747 1747 InterpolateArray1D<Double,Float>::InterpolationMethod interp = stringToIMethod(method); 1748 /* 1749 // Comment from MV. 1750 // the following code has been commented out because different FREQ_IDs have to be aligned together even 1751 // if the frame doesn't change. So far, lack of this check didn't cause any problems. 1748 1752 // test if user frame is different to base frame 1749 1753 if ( in->frequencies().getFrameString(true) … … 1752 1756 " (use set_freqframe) or it is aligned already.")); 1753 1757 } 1758 */ 1754 1759 MFrequency::Types system = in->frequencies().getFrame(); 1755 1760 MVTime mvt(refEpoch.getValue()); … … 1777 1782 1778 1783 ROArrayColumn<Float> sCol(t, "SPECTRA"); 1779 MDirection direction = dirCol(0); 1780 uInt nchan = sCol(0).nelements(); 1784 const MDirection direction = dirCol(0); 1785 const uInt nchan = sCol(0).nelements(); 1786 1787 // skip operations if there is nothing to align 1788 if (fiter.pastEnd()) { 1789 continue; 1790 } 1791 1792 Table ftab = fiter.table(); 1793 // align all frequency ids with respect to the first encountered id 1794 ScalarColumn<uInt> freqidCol(ftab, "FREQ_ID"); 1795 // get the SpectralCoordinate for the freqid, which we are iterating over 1796 SpectralCoordinate sC = in->frequencies().getSpectralCoordinate(freqidCol(0)); 1797 FrequencyAligner<Float> fa( sC, nchan, refEpoch, 1798 direction, refPos, system ); 1799 // realign the SpectralCoordinate and put into the output Scantable 1800 Vector<String> units(1); 1801 units = String("Hz"); 1802 Bool linear=True; 1803 SpectralCoordinate sc2 = fa.alignedSpectralCoordinate(linear); 1804 sc2.setWorldAxisUnits(units); 1805 const uInt id = out->frequencies().addEntry(sc2.referencePixel()[0], 1806 sc2.referenceValue()[0], 1807 sc2.increment()[0]); 1781 1808 while ( !fiter.pastEnd() ) { 1782 Table ftab = fiter.table(); 1783 ScalarColumn<uInt> freqidCol(ftab, "FREQ_ID"); 1784 // get the SpectralCoordinate for the freqid, which we are iterating over 1785 SpectralCoordinate sC = in->frequencies().getSpectralCoordinate(freqidCol(0)); 1786 FrequencyAligner<Float> fa( sC, nchan, refEpoch, 1787 direction, refPos, system ); 1788 // realign the SpectralCoordinate and put into the output Scantable 1789 Vector<String> units(1); 1790 units = String("Hz"); 1791 Bool linear=True; 1792 SpectralCoordinate sc2 = fa.alignedSpectralCoordinate(linear); 1793 sc2.setWorldAxisUnits(units); 1794 uInt id = out->frequencies().addEntry(sc2.referencePixel()[0], 1795 sc2.referenceValue()[0], 1796 sc2.increment()[0]); 1797 TableVector<uInt> tvec(ftab, "FREQ_ID"); 1798 tvec = id; 1809 ftab = fiter.table(); 1810 // spectral coordinate for the current FREQ_ID 1811 ScalarColumn<uInt> freqidCol2(ftab, "FREQ_ID"); 1812 sC = in->frequencies().getSpectralCoordinate(freqidCol2(0)); 1799 1813 // create the "global" abcissa for alignment with same FREQ_ID 1800 1814 Vector<Double> abc(nchan); 1801 Double w;1802 1815 for (uInt i=0; i<nchan; i++) { 1803 sC.toWorld(w,Double(i)); 1804 abc[i] = w; 1816 Double w; 1817 sC.toWorld(w,Double(i)); 1818 abc[i] = w; 1805 1819 } 1820 TableVector<uInt> tvec(ftab, "FREQ_ID"); 1821 // assign new frequency id to all rows 1822 tvec = id; 1806 1823 // cache abcissa for same time stamps, so iterate over those 1807 1824 TableIterator timeiter(ftab, "TIME"); … … 1812 1829 MEpoch::ROScalarColumn timeCol(tab, "TIME"); 1813 1830 // use align abcissa cache after the first row 1831 // these rows should be just be POLNO 1814 1832 bool first = true; 1815 // these rows should be just be POLNO1816 1833 for (int i=0; i<int(tab.nrow()); ++i) { 1817 1834 // input values
Note:
See TracChangeset
for help on using the changeset viewer.