| 1 | //#--------------------------------------------------------------------------- | 
|---|
| 2 | //# python_asap.cc: python module for single dish package asap | 
|---|
| 3 | //#--------------------------------------------------------------------------- | 
|---|
| 4 | //# Copyright (C) 2004 | 
|---|
| 5 | //# ATNF | 
|---|
| 6 | //# | 
|---|
| 7 | //# This program is free software; you can redistribute it and/or modify it | 
|---|
| 8 | //# under the terms of the GNU General Public License as published by the Free | 
|---|
| 9 | //# Software Foundation; either version 2 of the License, or (at your option) | 
|---|
| 10 | //# any later version. | 
|---|
| 11 | //# | 
|---|
| 12 | //# This program is distributed in the hope that it will be useful, but | 
|---|
| 13 | //# WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General | 
|---|
| 15 | //# Public License for more details. | 
|---|
| 16 | //# | 
|---|
| 17 | //# You should have received a copy of the GNU General Public License along | 
|---|
| 18 | //# with this program; if not, write to the Free Software Foundation, Inc., | 
|---|
| 19 | //# 675 Massachusetts Ave, Cambridge, MA 02139, USA. | 
|---|
| 20 | //# | 
|---|
| 21 | //# Correspondence concerning this software should be addressed as follows: | 
|---|
| 22 | //#        Internet email: Malte.Marquarding@csiro.au | 
|---|
| 23 | //#        Postal address: Malte Marquarding, | 
|---|
| 24 | //#                        Australia Telescope National Facility, | 
|---|
| 25 | //#                        P.O. Box 76, | 
|---|
| 26 | //#                        Epping, NSW, 2121, | 
|---|
| 27 | //#                        AUSTRALIA | 
|---|
| 28 | //# | 
|---|
| 29 | //# $Id: python_asap.cpp 881 2006-03-08 00:58:43Z mar637 $ | 
|---|
| 30 | //#--------------------------------------------------------------------------- | 
|---|
| 31 | #include <string> | 
|---|
| 32 | #include <vector> | 
|---|
| 33 |  | 
|---|
| 34 | #include <boost/python.hpp> | 
|---|
| 35 | #include <boost/python/exception_translator.hpp> | 
|---|
| 36 |  | 
|---|
| 37 | #include <casa/aips.h> | 
|---|
| 38 | #include <casa/Exceptions/Error.h> | 
|---|
| 39 | #include "ScantableWrapper.h" | 
|---|
| 40 |  | 
|---|
| 41 |  | 
|---|
| 42 | #include "pyconversions.h" | 
|---|
| 43 | #include "python_asap.h" | 
|---|
| 44 |  | 
|---|
| 45 | namespace asap { | 
|---|
| 46 | namespace python { | 
|---|
| 47 | void translate_ex(const casa::AipsError& e) | 
|---|
| 48 | { | 
|---|
| 49 | // Use the Python 'C' API to set up an exception object | 
|---|
| 50 | PyErr_SetString(PyExc_RuntimeError, e.what()); | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | } | 
|---|
| 54 | } | 
|---|
| 55 | using namespace boost::python; | 
|---|
| 56 |  | 
|---|
| 57 | BOOST_PYTHON_MODULE(_asap) { | 
|---|
| 58 | asap::python::python_Scantable(); | 
|---|
| 59 | asap::python::python_STFiller(); | 
|---|
| 60 | asap::python::python_STSelector(); | 
|---|
| 61 | asap::python::python_STMath(); | 
|---|
| 62 | asap::python::python_SDFitter(); | 
|---|
| 63 | asap::python::python_STLineFinder(); | 
|---|
| 64 | /* | 
|---|
| 65 | asap::python::python_SDWriter(); | 
|---|
| 66 | asap::python::python_SDFitTable(); | 
|---|
| 67 | */ | 
|---|
| 68 | asap::python::python_SDLog(); | 
|---|
| 69 | register_exception_translator<casa::AipsError>(&asap::python::translate_ex); | 
|---|
| 70 |  | 
|---|
| 71 | //std_vector_to_tuple <  > (); | 
|---|
| 72 | from_python_sequence < std::vector< asap::ScantableWrapper >, | 
|---|
| 73 | variable_capacity_policy > (); | 
|---|
| 74 |  | 
|---|
| 75 | std_vector_to_tuple < int > (); | 
|---|
| 76 | from_python_sequence < std::vector < int >, | 
|---|
| 77 | variable_capacity_policy > (); | 
|---|
| 78 | std_vector_to_tuple < float > (); | 
|---|
| 79 | from_python_sequence < std::vector < float >, | 
|---|
| 80 | variable_capacity_policy > (); | 
|---|
| 81 | std_vector_to_tuple < double > (); | 
|---|
| 82 | from_python_sequence < std::vector < double >, | 
|---|
| 83 | variable_capacity_policy > (); | 
|---|
| 84 | std_vector_to_tuple < std::string > (); | 
|---|
| 85 | from_python_sequence < std::vector < std::string >, | 
|---|
| 86 | variable_capacity_policy > (); | 
|---|
| 87 | std_vector_to_tuple < bool> (); | 
|---|
| 88 | from_python_sequence < std::vector < bool >, | 
|---|
| 89 | variable_capacity_policy > (); | 
|---|
| 90 | } | 
|---|