Ignore:
Timestamp:
03/06/06 11:24:02 (18 years ago)
Author:
mar637
Message:

SDMemTable -> Scnatable handling (asap2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/python_STMath.cpp

    r871 r872  
    11//#---------------------------------------------------------------------------
    2 //# python_SDMath.cc: python exposure of c++ SDMath class
     2//# python_STMathWrapper.cc: python exposure of c++ STMath class
    33//#---------------------------------------------------------------------------
    44//# Copyright (C) 2004
     
    2727//#                        AUSTRALIA
    2828//#
    29 //# $Id:
     29//# $Id:$
    3030//#---------------------------------------------------------------------------
     31#include <vector>
    3132#include <boost/python.hpp>
    32 #include <vector>
    3333
    34 #include <casa/aips.h>
    35 #include <casa/Containers/Block.h>
    36 #include <casa/Utilities/CountedPtr.cc>
     34#include "STMathWrapper.h"
    3735
    38 #include "SDMathWrapper.h"
    39 #include "SDMath.h"
    40 
    41 using namespace casa;
    4236using namespace boost::python;
    4337
    4438namespace asap {
    45   namespace SDMathWrapper {
    46     SDMemTableWrapper SDMathWrapper::average(boost::python::tuple tp,
    47                                              const std::vector<bool>& mask,
    48                                              bool scanAv,
    49                                              const std::string& weightStr) {
    50       int n;
    51       n = extract<int>(tp.attr("__len__")());
    52       std::vector<CountedPtr<asap::SDMemTable> > b(n);
    53       //Block<CountedPtr<asap::SDMemTable> > b(n);
    54       for (int i=0;i< n;++i) {
    55         SDMemTableWrapper sdmw =
    56           extract<SDMemTableWrapper>( tp.attr("__getitem__")(i) );
    57         b[i] = sdmw.getCP();
    58       }
    59       Vector<Bool> msk(mask);
    60 
    61       return SDMemTableWrapper(sdmath.average(b, msk, Bool(scanAv), weightStr));
    62     };
    63   } // namespace SDMathWrapper
    64 
    6539  namespace python {
    66     void python_SDMath() {
    67       def("b_operate", &SDMathWrapper::binaryOperate);
    68 
    69       def("quotient", &SDMathWrapper::quotient);
    70 
    71       def("scale", &SDMathWrapper::scale);
    72       def("scale_insitu", &SDMathWrapper::scaleInSitu);
    73 
    74       def("add", &SDMathWrapper::add);
    75       def("add_insitu", &SDMathWrapper::addInSitu);
    76 
    77       def("smooth", &SDMathWrapper::smooth);
    78       def("smooth_insitu", &SDMathWrapper::smoothInSitu);
    79 
    80       def("convertflux", &SDMathWrapper::convertFlux);
    81       def("convertflux_insitu", &SDMathWrapper::convertFluxInSitu);
    82 
    83       def("gainel", &SDMathWrapper::gainElevation);
    84       def("gainel_insitu", &SDMathWrapper::gainElevationInSitu);
    85 
    86       def("freq_align", &SDMathWrapper::frequencyAlignment);
    87       def("freq_align_insitu", &SDMathWrapper::frequencyAlignmentInSitu);
    88 
    89       def("opacity", &SDMathWrapper::opacity);
    90       def("opacity_insitu", &SDMathWrapper::opacityInSitu);
    91 
    92       def("average", &SDMathWrapper::average);
    93 
    94       def("averagepol", &SDMathWrapper::averagePol);
    95       def("averagepol_insitu", &SDMathWrapper::averagePolInSitu);
    96 
    97       def("bin", &SDMathWrapper::bin);
    98       def("bin_insitu", &SDMathWrapper::binInSitu);
    99 
    100       def("resample", &SDMathWrapper::resample);
    101       def("resample_insitu", &SDMathWrapper::resampleInSitu);
    102 
    103       def("stats", &SDMathWrapper::statistic);
    104 
    105       def("_rotate_xyphase", &SDMathWrapper::rotateXYPhaseInSitu);
    106       def("_rotate_linpolphase", &SDMathWrapper::rotateLinPolPhaseInSitu);
    107 
    108       def("_frequency_switch", &SDMathWrapper::frequencySwitch);
    109       def("_frequency_switch_insitu", &SDMathWrapper::frequencySwitchInSitu);
     40    void python_STMath() {
     41      class_<STMathWrapper>("stmath")
     42        .def( init < > () )
     43        .def( init < bool > () )
     44        .def("_insitu", &STMathWrapper::insitu)
     45        .def("_setinsitu", &STMathWrapper::setInsitu)
     46        .def("_average", &STMathWrapper::average)
     47        .def("_unaryop", &STMathWrapper::unaryOperate)
     48        .def("_quotient", &STMathWrapper::quotient)
     49        .def("_stats", &STMathWrapper::statistic)
     50        .def("_freqswitch", &STMathWrapper::freqSwitch)
     51        .def("_bin", &STMathWrapper::bin)
     52        .def("_resample", &STMathWrapper::resample)
     53        .def("_smooth", &STMathWrapper::smooth)
     54        .def("_gainel", &STMathWrapper::gainElevation)
     55        .def("_convertflux", &STMathWrapper::convertFlux)
     56        .def("_opacity", &STMathWrapper::opacity)
     57        .def("_merge", &STMathWrapper::merge)
     58      ;
    11059    };
    11160
    112   } // python
    113 } // asap
     61  } //namespace python
     62} // namespace asap
    11463
Note: See TracChangeset for help on using the changeset viewer.