Changeset 55 for trunk/src


Ignore:
Timestamp:
07/15/04 16:04:14 (20 years ago)
Author:
mmarquar
Message:

Added wrappers for all the new functions. Changed the file to reflect the split up of SDMemTableWrapper.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/python_SDMath.cc

    r43 r55  
    3131#include <boost/python.hpp>
    3232
    33 #include "SDMemTableWrapper.h"
     33#include "SDMathWrapper.h"
    3434
    3535using namespace boost::python;
     
    3737namespace atnf_sd {
    3838  namespace python {
     39
     40SDMemTableWrapper SDMathWrapper::averages(boost::python::tuple tp,
     41                                          const std::vector<bool>& mask) {
     42  int n;
     43  n = extract<int>(tp.attr("__len__")());
     44  Block<CountedPtr<atnf_sd::SDMemTable> > b(n);
     45  for (int i=0;i< n;++i) {
     46    SDMemTableWrapper sdmw =
     47      extract<SDMemTableWrapper>( tp.attr("__getitem__")(i) );
     48    b[i] = sdmw.getCP();
     49  }
     50  Vector<Bool> msk(mask);
     51  return SDMemTableWrapper(SDMath::averages(b,msk));
     52};
    3953
    4054void python_SDMath() {
     
    4559    .def("baseline", &SDMathWrapper::baseline)
    4660    .def("hanning", &SDMathWrapper::hanning)
     61    .def("averages", &SDMathWrapper::averages)
     62    .def("averagepol", &SDMathWrapper::averagePol)
     63    .def("bin", &SDMathWrapper::bin)
     64    .def("rms", &SDMathWrapper::rms)
    4765    ;
    4866};
    4967
    5068  } // python
    51 }
     69} // atnf_sd
     70
Note: See TracChangeset for help on using the changeset viewer.