Changeset 1033


Ignore:
Timestamp:
04/26/06 13:51:58 (18 years ago)
Author:
mar637
Message:

Fix for Ticket #33; was confusing mask and flag again. == flag svn diff ../python/scantable.py!

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1024 r1033  
    10261026        self._math._setinsitu(insitu)
    10271027        varlist = vars()
    1028         s = scantable(self._math._smooth(self,kernel,width))
     1028        s = scantable(self._math._smooth(self,kernel.lower(),width))
    10291029        s._add_history("smooth", varlist)
    10301030        print_log()
  • trunk/src/MathUtils.h

    r1030 r1033  
    2727//#                        AUSTRALIA
    2828//#
    29 //# $Id:$
     29//# $Id$
    3030//#---------------------------------------------------------------------------
    3131#ifndef MATHUTILS_H
     
    4141
    4242// Hanning smoothing
    43 template <class T>
    4443/**
    4544 * Hanning smooth a masked vector
     
    5150 * @param ignoreOther drop every second channel (NYI)
    5251 */
     52template <class T>
    5353void hanning(casa::Vector<T>& out, casa::Vector<casa::Bool>& outmask,
    54              const casa::Vector<T>& in, const casa::Vector<casa::Bool>& mask,
    55              casa::Bool relaxed=casa::False,
    56              casa::Bool ignoreOther=casa::False);
     54             const casa::Vector<T>& in, const casa::Vector<casa::Bool>& mask,
     55             casa::Bool relaxed=casa::False,
     56             casa::Bool ignoreOther=casa::False);
    5757
    5858// Generate specified statistic
    5959float statistics(const casa::String& which,
    60                 const casa::MaskedArray<casa::Float>& data);
     60                const casa::MaskedArray<casa::Float>& data);
    6161
    6262// Replace masked value by zero
    6363void replaceMaskByZero(casa::Vector<casa::Float>& data,
    64                        const casa::Vector<casa::Bool>& mask);
     64                       const casa::Vector<casa::Bool>& mask);
    6565
    6666/**
  • trunk/src/MathUtils2.cpp

    r983 r1033  
    2727//#                        AUSTRALIA
    2828//#
    29 //# $Id:
     29//# $Id:$
    3030//#---------------------------------------------------------------------------
    3131
     
    4242template <class T>
    4343void mathutil::hanning(Vector<T>& out, Vector<Bool>& outmask,
    44                        const Vector<T>& in, const Vector<Bool>& mask,
    45                        Bool relaxed, Bool ignoreOther) {
    46 
     44                       const Vector<T>& in, const Vector<Bool>& mask,
     45                       Bool relaxed, Bool ignoreOther) {
    4746  Vector< Vector<T> > weights(8);
    4847  Vector<Float> vals(3);
     
    6867  out.resize(in.nelements());
    6968  outmask.resize(mask.nelements());
    70 
    7169  // make special case for first and last
    7270  /// ...here
    7371  // loop from 1..n-2
    74   uInt i = 1;
    75   VectorSTLIterator<T> outit(out);
    76   outit++;
    77   VectorSTLIterator<Bool> outmit(outmask);outmit++;
     72  out.resize(in.nelements());
     73  out[0] = in[0];out[out.nelements()-1] = in[in.nelements()-1];
     74  outmask.resize(mask.nelements());
     75  outmask = False;
    7876  uInt m;Vector<T>* w;
    79   for (VectorSTLIterator<T> it = outit;it != out.end()-1;++it) {
    80 
     77  for (uInt i=1; i < out.nelements()-1;++i) {
    8178    m = mask[i-1] + 2*mask[i] + 4*mask[i+1];
    8279    w = &(weights[m]);
    8380    if (weighted[m]) {
    84       (*it) = (*w)[0]*in[i-1] + (*w)[1]*in[i] + (*w)[2]*in[i+1];
    85       (*outmit) = True;
     81      out[i] = (*w)[0]*in[i-1] + (*w)[1]*in[i] + (*w)[2]*in[i+1];
     82      outmask[i] = True;
    8683    } else { // mask it
    87       (*outmit) = False;
     84      out[i] = in[i];//use arbitrary value
     85      outmask[i] = False;
    8886    }
    89     ++i;
    90     ++outmit;
    9187  }
    9288}
  • trunk/src/STMath.cpp

    r1015 r1033  
    792792{
    793793  CountedPtr< Scantable > out = getScantable(in, false);
    794   Table& table = in->table();
     794  Table& table = out->table();
    795795  VectorKernel::KernelTypes type = VectorKernel::toKernelType(kernel);
    796796  // same IFNO should have same no of channels
     
    815815      if ( type == VectorKernel::HANNING ) {
    816816        Vector<Bool> maskout;
    817         mathutil::hanning(specout, maskout, spec , mask);
    818         convertArray(flag, maskout);
     817        mathutil::hanning(specout, maskout, spec , !mask);
     818        convertArray(flag, !maskout);
    819819        flagCol.put(i, flag);
    820       } else {
     820        specCol.put(i, specout);
     821     } else {
    821822        mathutil::replaceMaskByZero(specout, mask);
    822823        conv.linearConv(specout, spec);
     824        specCol.put(i, specout);
    823825      }
    824       specCol.put(i, specout);
    825826    }
    826827    ++iter;
Note: See TracChangeset for help on using the changeset viewer.