Changeset 1033
- Timestamp:
- 04/26/06 13:51:58 (19 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1024 r1033 1026 1026 self._math._setinsitu(insitu) 1027 1027 varlist = vars() 1028 s = scantable(self._math._smooth(self,kernel ,width))1028 s = scantable(self._math._smooth(self,kernel.lower(),width)) 1029 1029 s._add_history("smooth", varlist) 1030 1030 print_log() -
trunk/src/MathUtils.h
r1030 r1033 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id :$29 //# $Id$ 30 30 //#--------------------------------------------------------------------------- 31 31 #ifndef MATHUTILS_H … … 41 41 42 42 // Hanning smoothing 43 template <class T>44 43 /** 45 44 * Hanning smooth a masked vector … … 51 50 * @param ignoreOther drop every second channel (NYI) 52 51 */ 52 template <class T> 53 53 void hanning(casa::Vector<T>& out, casa::Vector<casa::Bool>& outmask, 54 55 56 54 const casa::Vector<T>& in, const casa::Vector<casa::Bool>& mask, 55 casa::Bool relaxed=casa::False, 56 casa::Bool ignoreOther=casa::False); 57 57 58 58 // Generate specified statistic 59 59 float statistics(const casa::String& which, 60 60 const casa::MaskedArray<casa::Float>& data); 61 61 62 62 // Replace masked value by zero 63 63 void replaceMaskByZero(casa::Vector<casa::Float>& data, 64 64 const casa::Vector<casa::Bool>& mask); 65 65 66 66 /** -
trunk/src/MathUtils2.cpp
r983 r1033 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id: 29 //# $Id:$ 30 30 //#--------------------------------------------------------------------------- 31 31 … … 42 42 template <class T> 43 43 void 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) { 47 46 Vector< Vector<T> > weights(8); 48 47 Vector<Float> vals(3); … … 68 67 out.resize(in.nelements()); 69 68 outmask.resize(mask.nelements()); 70 71 69 // make special case for first and last 72 70 /// ...here 73 71 // loop from 1..n-2 74 uInt i = 1;75 VectorSTLIterator<T> outit(out);76 out it++;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; 78 76 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) { 81 78 m = mask[i-1] + 2*mask[i] + 4*mask[i+1]; 82 79 w = &(weights[m]); 83 80 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; 86 83 } else { // mask it 87 (*outmit) = False; 84 out[i] = in[i];//use arbitrary value 85 outmask[i] = False; 88 86 } 89 ++i;90 ++outmit;91 87 } 92 88 } -
trunk/src/STMath.cpp
r1015 r1033 792 792 { 793 793 CountedPtr< Scantable > out = getScantable(in, false); 794 Table& table = in->table();794 Table& table = out->table(); 795 795 VectorKernel::KernelTypes type = VectorKernel::toKernelType(kernel); 796 796 // same IFNO should have same no of channels … … 815 815 if ( type == VectorKernel::HANNING ) { 816 816 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); 819 819 flagCol.put(i, flag); 820 } else { 820 specCol.put(i, specout); 821 } else { 821 822 mathutil::replaceMaskByZero(specout, mask); 822 823 conv.linearConv(specout, spec); 824 specCol.put(i, specout); 823 825 } 824 specCol.put(i, specout);825 826 } 826 827 ++iter;
Note:
See TracChangeset
for help on using the changeset viewer.