Changeset 317


Ignore:
Timestamp:
01/28/05 14:46:42 (19 years ago)
Author:
kil064
Message:

add interpolatiun method argument to function 'frequencyAlign'

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMath.cc

    r315 r317  
    108108
    109109
    110 SDMemTable* SDMath::frequencyAlignment (const SDMemTable& in, const String& refTime) const
     110SDMemTable* SDMath::frequencyAlignment (const SDMemTable& in, const String& refTime, const String& method) const
    111111{
    112112
     
    128128// Do it
    129129
    130    return frequencyAlign (in, freqSystem, refTime);
     130   return frequencyAlign (in, freqSystem, refTime, method);
    131131}
    132132
     
    635635   }
    636636
    637 
    638637// Interpolation method
    639638
    640   Int interpMethod = 0;
    641   convertInterpString(interpMethod, methodStr);
     639  InterpolateArray1D<Double,Float>::InterpolationMethod interp;
     640  convertInterpString(interp, methodStr);
     641  Int interpMethod(interp);
    642642
    643643// Make output table
     
    12531253SDMemTable* SDMath::frequencyAlign (const SDMemTable& in,
    12541254                                   MFrequency::Types freqSystem,
    1255                                    const String& refTime) const
     1255                                   const String& refTime, const String& methodStr) const
    12561256{
    12571257// Get Header
     
    13121312                              freqSystem, refPos, refEpoch);
    13131313
     1314// Interpolation method
     1315
     1316   InterpolateArray1D<Double,Float>::InterpolationMethod interp;
     1317   convertInterpString(interp, methodStr);
     1318
    13141319// New output Table
    13151320
     
    13191324
    13201325   const IPosition polChanAxes(2, asap::PolAxis, asap::ChanAxis);
    1321    FrequencyAligner<Float>::Method method = FrequencyAligner<Float>::LINEAR;
     1326
    13221327   Bool extrapolate=False;
    13231328   Bool useCachedAbcissa = False;
     
    13761381        while (!itValuesVec.pastEnd()) {     
    13771382           ok = a[faIdx]->align (yOut, maskOut, itValuesVec.vector(),
    1378                                   itMaskVec.vector(), epoch, useCachedAbcissa,
    1379                                   method, extrapolate);
     1383                                 itMaskVec.vector(), epoch, useCachedAbcissa,
     1384                                 interp, extrapolate);
    13801385           itValuesVec.vector() = yOut;
    13811386           itMaskVec.vector() = maskOut;
     
    16311636}
    16321637
    1633 void SDMath::convertInterpString(Int& type, const String& interp) const
     1638
     1639void SDMath::convertInterpString(casa::InterpolateArray1D<Double,Float>::InterpolationMethod& type, 
     1640                                 const casa::String& interp) const
    16341641{
    16351642  String tStr(interp);
    16361643  tStr.upcase();
    16371644  if (tStr.contains(String("NEAR"))) {
    1638      type = InterpolateArray1D<Float,Float>::nearestNeighbour;
     1645     type = InterpolateArray1D<Double,Float>::nearestNeighbour;
    16391646  } else if (tStr.contains(String("LIN"))) {
    1640      type = InterpolateArray1D<Float,Float>::linear;
     1647     type = InterpolateArray1D<Double,Float>::linear;
    16411648  } else if (tStr.contains(String("CUB"))) {
    1642      type = InterpolateArray1D<Float,Float>::cubic;
     1649     type = InterpolateArray1D<Double,Float>::cubic;
    16431650  } else if (tStr.contains(String("SPL"))) {
    1644      type = InterpolateArray1D<Float,Float>::spline;
     1651     type = InterpolateArray1D<Double,Float>::spline;
    16451652  } else {
    16461653    throw(AipsError("Unrecognized interpolation type"));
     
    16981705// Interpolate (and extrapolate) with desired method
    16991706
    1700    Int method = 0;
     1707   InterpolateArray1D<Double,Float>::InterpolationMethod method;
    17011708   convertInterpString(method, methodStr);
     1709   Int intMethod(method);
    17021710//
    17031711   Vector<Float> yOut;
    17041712   Vector<Bool> maskOut;
    17051713   InterpolateArray1D<Float,Float>::interpolate(yOut, maskOut, xOut,
    1706                                                 xIn, yIn, maskIn, method,
     1714                                                xIn, yIn, maskIn, intMethod,
    17071715                                                True, True);
    17081716// Apply
  • trunk/src/SDMath.h

    r315 r317  
    106106
    107107// Frequency Alignment
    108    SDMemTable* frequencyAlignment (const SDMemTable& in, const casa::String& refTime) const;
     108   SDMemTable* frequencyAlignment (const SDMemTable& in, const casa::String& refTime,
     109                                   const casa::String& method) const;
    109110
    110111// Opacity correction
     
    165166
    166167// Convert interpolation type string
    167    void convertInterpString(casa::Int& type, const casa::String& interp) const;
     168//   void convertInterpString(casa::Int& type, const casa::String& interp) const;
     169   void convertInterpString(casa::InterpolateArray1D<casa::Double,casa::Float>::InterpolationMethod& method, 
     170                             const casa::String& interp) const;
    168171
    169172// Correct data from an ascii Table
     
    206209   SDMemTable* frequencyAlign (const SDMemTable& in,
    207210                              casa::MFrequency::Types system,
    208                               const casa::String& timeRef) const;
     211                              const casa::String& timeRef,
     212                              const casa::String& method) const;
    209213
    210214// Convert time String to Epoch
Note: See TracChangeset for help on using the changeset viewer.