[2] | 1 | //#---------------------------------------------------------------------------
|
---|
[875] | 2 | //# python_asap.cc: python module for single dish package asap
|
---|
[2] | 3 | //#---------------------------------------------------------------------------
|
---|
| 4 | //# Copyright (C) 2004
|
---|
[125] | 5 | //# ATNF
|
---|
[2] | 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 | //#
|
---|
[30] | 29 | //# $Id: python_asap.cpp 1818 2010-08-02 06:10:43Z KanaSugimoto $
|
---|
[2] | 30 | //#---------------------------------------------------------------------------
|
---|
| 31 | #include <string>
|
---|
| 32 | #include <vector>
|
---|
[125] | 33 |
|
---|
[2] | 34 | #include <boost/python.hpp>
|
---|
[95] | 35 | #include <boost/python/exception_translator.hpp>
|
---|
[2] | 36 |
|
---|
[125] | 37 | #include <casa/aips.h>
|
---|
| 38 | #include <casa/Exceptions/Error.h>
|
---|
[875] | 39 | #include "ScantableWrapper.h"
|
---|
[125] | 40 |
|
---|
[1603] | 41 | #ifndef HAVE_LIBPYRAP
|
---|
| 42 | #include "pyconversions.h"
|
---|
| 43 | #else
|
---|
| 44 | #include <pyrap/Converters/PycExcp.h>
|
---|
| 45 | #include <pyrap/Converters/PycBasicData.h>
|
---|
| 46 | #endif
|
---|
[875] | 47 |
|
---|
| 48 | #include "python_asap.h"
|
---|
[2] | 49 |
|
---|
[1603] | 50 | #ifndef HAVE_LIBPYRAP
|
---|
[95] | 51 | namespace asap {
|
---|
| 52 | namespace python {
|
---|
[1603] | 53 |
|
---|
[125] | 54 | void translate_ex(const casa::AipsError& e)
|
---|
[95] | 55 | {
|
---|
| 56 | // Use the Python 'C' API to set up an exception object
|
---|
| 57 | PyErr_SetString(PyExc_RuntimeError, e.what());
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
[1603] | 62 | #endif
|
---|
| 63 |
|
---|
[2] | 64 | using namespace boost::python;
|
---|
| 65 |
|
---|
[95] | 66 | BOOST_PYTHON_MODULE(_asap) {
|
---|
[875] | 67 | asap::python::python_Scantable();
|
---|
| 68 | asap::python::python_STFiller();
|
---|
[1818] | 69 | asap::python::python_Filler();
|
---|
[875] | 70 | asap::python::python_STSelector();
|
---|
| 71 | asap::python::python_STMath();
|
---|
[894] | 72 | asap::python::python_Fitter();
|
---|
[881] | 73 | asap::python::python_STLineFinder();
|
---|
[960] | 74 | asap::python::python_STFitEntry();
|
---|
[988] | 75 | asap::python::python_STWriter();
|
---|
[1126] | 76 | asap::python::python_LineCatalog();
|
---|
[1603] | 77 | asap::python::python_Logger();
|
---|
[1818] | 78 | asap::python::python_LogSink();
|
---|
[1757] | 79 | asap::python::python_STCoordinate();
|
---|
| 80 | asap::python::python_STAtmosphere();
|
---|
[1693] | 81 | asap::python::python_SrcType();
|
---|
[988] | 82 |
|
---|
[1603] | 83 | #ifndef HAVE_LIBPYRAP
|
---|
| 84 | // Use built-in pyconversions.h
|
---|
[125] | 85 | register_exception_translator<casa::AipsError>(&asap::python::translate_ex);
|
---|
[875] | 86 | from_python_sequence < std::vector< asap::ScantableWrapper >,
|
---|
| 87 | variable_capacity_policy > ();
|
---|
[2] | 88 | std_vector_to_tuple < int > ();
|
---|
[95] | 89 | from_python_sequence < std::vector < int >,
|
---|
[2] | 90 | variable_capacity_policy > ();
|
---|
[1112] | 91 | std_vector_to_tuple < uint > ();
|
---|
| 92 | from_python_sequence < std::vector < uint >,
|
---|
| 93 | variable_capacity_policy > ();
|
---|
[2] | 94 | std_vector_to_tuple < float > ();
|
---|
[95] | 95 | from_python_sequence < std::vector < float >,
|
---|
[2] | 96 | variable_capacity_policy > ();
|
---|
[42] | 97 | std_vector_to_tuple < double > ();
|
---|
[95] | 98 | from_python_sequence < std::vector < double >,
|
---|
[42] | 99 | variable_capacity_policy > ();
|
---|
[2] | 100 | std_vector_to_tuple < std::string > ();
|
---|
[95] | 101 | from_python_sequence < std::vector < std::string >,
|
---|
[2] | 102 | variable_capacity_policy > ();
|
---|
| 103 | std_vector_to_tuple < bool> ();
|
---|
[95] | 104 | from_python_sequence < std::vector < bool >,
|
---|
[2] | 105 | variable_capacity_policy > ();
|
---|
[1603] | 106 | #else
|
---|
| 107 | casa::pyrap::register_convert_excp();
|
---|
| 108 | casa::pyrap::register_convert_basicdata();
|
---|
| 109 | casa::pyrap::register_convert_std_vector<asap::ScantableWrapper>();
|
---|
| 110 | #endif
|
---|
[2] | 111 | }
|
---|