Changeset 176


Ignore:
Timestamp:
01/07/05 11:18:03 (20 years ago)
Author:
kil064
Message:

add function 'replaceMaskByZero'
change interface for function 'statistics' to use only casa:: types

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MathUtils.cc

    r137 r176  
    3131
    3232#include <casa/aips.h>
     33#include <casa/Arrays/Vector.h>
    3334#include <casa/Arrays/MaskedArray.h>
    3435#include <casa/Arrays/MaskArrMath.h>
     
    3839
    3940using namespace casa;
    40 //using namespace asap;
    4141
    4242
    4343
    44 float mathutil::statistics (const std::string& which,  const MaskedArray<Float>& data)
     44float mathutil::statistics (const String& which,  const MaskedArray<Float>& data)
    4545{
    4646   String str(which);
     
    7070}
    7171 
     72
     73void mathutil::replaceMaskByZero (Vector<Float>& data, const Vector<Bool>& mask)
     74{
     75   for (uInt i=0; i<data.nelements(); i++) {
     76      if (!mask[i]) data[i] = 0.0;
     77   }
     78}
     79
  • trunk/src/MathUtils.h

    r136 r176  
    3838
    3939template <class T>
     40
     41// Hanning smoothing
    4042void hanning(casa::Vector<T>& out, casa::Vector<casa::Bool>& outmask,
    4143             const casa::Vector<T>& in, const casa::Vector<casa::Bool>& mask,
    4244             casa::Bool relaxed=False, casa::Bool ignoreOther=False);
    4345
    44 float statistics (const std::string& which,  const casa::MaskedArray<casa::Float>& data);
     46// Generate specified statistic
     47float statistics (const casa::String& which,  const casa::MaskedArray<casa::Float>& data);
     48
     49// Replace masked value by zero
     50void replaceMaskByZero (casa::Vector<casa::Float>& data, const casa::Vector<casa::Bool>& mask);
    4551};
    4652
Note: See TracChangeset for help on using the changeset viewer.