Changeset 272
- Timestamp:
- 01/24/05 01:00:14 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMath.cc
r270 r272 49 49 #include <casa/Quanta/MVEpoch.h> 50 50 #include <casa/Quanta/QC.h> 51 #include <casa/Quanta/MVTime.h> 51 52 #include <casa/Utilities/Assert.h> 52 53 … … 107 108 108 109 109 SDMemTable* SDMath::velocityAlignment (const SDMemTable& in ) const110 SDMemTable* SDMath::velocityAlignment (const SDMemTable& in, const String& refTime) const 110 111 { 111 112 … … 139 140 // Do it 140 141 141 return velocityAlign (in, velSystem, velUnit, doppler );142 return velocityAlign (in, velSystem, velUnit, doppler, refTime); 142 143 } 143 144 … … 1103 1104 MFrequency::Types velSystem, 1104 1105 const String& velUnit, 1105 MDoppler::Types doppler) const 1106 MDoppler::Types doppler, 1107 const String& refTime) const 1106 1108 { 1107 1109 // Get Header … … 1132 1134 const uInt nSrcTab = srcTab.nelements(); 1133 1135 cerr << "Found " << srcTab.nelements() << " sources to align " << endl; 1134 /* 1135 cerr << "source table = " << srcTab << endl; 1136 cerr << "source idx = " << srcIdx << endl; 1137 cerr << "first row = " << firstRow << endl; 1138 */ 1139 1140 // Set reference Epoch to time of first row 1141 1142 MEpoch::Ref timeRef = MEpoch::Ref(in.getTimeReference()); 1136 1137 // Set reference Epoch to time of first row or given String 1138 1143 1139 Unit DAY(String("d")); 1144 Quantum<Double> tQ(times[0], DAY); 1145 MVEpoch mve(tQ); 1146 MEpoch refTime(mve, timeRef); 1140 MEpoch::Ref epochRef(in.getTimeReference()); 1141 MEpoch refEpoch; 1142 if (refTime.length()>0) { 1143 refEpoch = epochFromString(refTime, in.getTimeReference()); 1144 } else { 1145 Quantum<Double> tQ(times[0], DAY); 1146 MVEpoch mve(tQ); 1147 refEpoch = MEpoch(mve, epochRef); 1148 } 1149 cerr << "Aligning at reference Epoch " << formatEpoch(refEpoch) << endl; 1147 1150 1148 1151 // Set Reference Position … … 1166 1169 MDirection refDir = in.getDirection(firstRow[iSrc]); 1167 1170 uInt idx = (iSrc*nFreqIDs) + fqID; 1168 vA[idx] = new VelocityAligner<Float>(sC, nChan, ref Time, refDir, refPos,1171 vA[idx] = new VelocityAligner<Float>(sC, nChan, refEpoch, refDir, refPos, 1169 1172 velUnit, doppler, velSystem); 1170 1173 } … … 1196 1199 Quantum<Double> tQ2(times[iRow],DAY); 1197 1200 MVEpoch mv2(tQ2); 1198 MEpoch epoch(mv2, timeRef);1201 MEpoch epoch(mv2, epochRef); 1199 1202 1200 1203 // Get FreqID vector. One freqID per IF … … 1610 1613 } 1611 1614 } 1615 1616 MEpoch SDMath::epochFromString (const String& str, MEpoch::Types timeRef) const 1617 { 1618 Quantum<Double> qt; 1619 if (MVTime::read(qt,str)) { 1620 MVEpoch mv(qt); 1621 MEpoch me(mv, timeRef); 1622 return me; 1623 } else { 1624 throw(AipsError("Invalid format for Epoch string")); 1625 } 1626 } 1627 1628 1629 String SDMath::formatEpoch(const MEpoch& epoch) const 1630 { 1631 MVTime mvt(epoch.getValue()); 1632 return mvt.string(MVTime::YMD) + String(" (") + epoch.getRefString() + String(")"); 1633 } 1634 -
trunk/src/SDMath.h
r267 r272 39 39 40 40 class casa::Table; 41 class casa::MEpoch; 42 41 43 42 44 namespace asap { … … 95 97 96 98 // Velocity Alignment 97 SDMemTable* velocityAlignment (const SDMemTable& in ) const;99 SDMemTable* velocityAlignment (const SDMemTable& in, const casa::String& refTime) const; 98 100 99 101 // Opacity correction … … 186 188 casa::MFrequency::Types velSystem, 187 189 const casa::String& velUnit, 188 casa::MDoppler::Types doppler) const; 190 casa::MDoppler::Types doppler, 191 const casa::String& timeRef) const; 192 193 // Convert time String to Epoch 194 casa::MEpoch epochFromString (const casa::String& str, casa::MEpoch::Types timeRef) const; 195 196 // Format EPoch 197 casa::String formatEpoch(const casa::MEpoch& epoch) const; 189 198 }; 190 199 -
trunk/src/SDMathWrapper.cc
r268 r272 228 228 } 229 229 230 void SDMathWrapper::velocityAlignmentInSitu (SDMemTableWrapper& in) 231 { 232 SDMemTable* pIn = in.getPtr(); 233 SDMath sdm; 234 SDMemTable* pOut = sdm.velocityAlignment(*pIn); 235 *pIn = *pOut; 236 delete pOut; 237 } 238 239 240 SDMemTableWrapper SDMathWrapper::velocityAlignment (const SDMemTableWrapper& in) 241 { 242 const CountedPtr<SDMemTable>& pIn = in.getCP(); 243 SDMath sdm; 244 return CountedPtr<SDMemTable>(sdm.velocityAlignment(*pIn)); 230 void SDMathWrapper::velocityAlignmentInSitu (SDMemTableWrapper& in, const std::string& refTime) 231 { 232 SDMemTable* pIn = in.getPtr(); 233 SDMath sdm; 234 SDMemTable* pOut = sdm.velocityAlignment(*pIn, String(refTime)); 235 *pIn = *pOut; 236 delete pOut; 237 } 238 239 240 SDMemTableWrapper SDMathWrapper::velocityAlignment (const SDMemTableWrapper& in, 241 const std::string& refTime) 242 { 243 const CountedPtr<SDMemTable>& pIn = in.getCP(); 244 SDMath sdm; 245 return CountedPtr<SDMemTable>(sdm.velocityAlignment(*pIn, String(refTime))); 245 246 } 246 247 -
trunk/src/SDMathWrapper.h
r268 r272 85 85 86 86 // Apply velocity alignment 87 void velocityAlignmentInSitu (SDMemTableWrapper& in );88 SDMemTableWrapper velocityAlignment(const SDMemTableWrapper& in );87 void velocityAlignmentInSitu (SDMemTableWrapper& in, const std::string& refTime); 88 SDMemTableWrapper velocityAlignment(const SDMemTableWrapper& in, const std::string& refTime); 89 89 90 90 // Apply opacity correction
Note:
See TracChangeset
for help on using the changeset viewer.