[2] | 1 | //#---------------------------------------------------------------------------
|
---|
[875] | 2 | //# python_asap.cc: python module for single dish package asap
|
---|
[2] | 3 | //#---------------------------------------------------------------------------
|
---|
[2526] | 4 | //# Copyright (C) 2004-2012
|
---|
[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 2689 2012-12-07 04:26:15Z KanaSugimoto $
|
---|
[2] | 30 | //#---------------------------------------------------------------------------
|
---|
[125] | 31 |
|
---|
[2] | 32 | #include <boost/python.hpp>
|
---|
[95] | 33 | #include <boost/python/exception_translator.hpp>
|
---|
[2] | 34 |
|
---|
[2526] | 35 | #include <string>
|
---|
| 36 | #include <vector>
|
---|
| 37 |
|
---|
[125] | 38 | #include <casa/aips.h>
|
---|
| 39 | #include <casa/Exceptions/Error.h>
|
---|
[875] | 40 | #include "ScantableWrapper.h"
|
---|
[125] | 41 |
|
---|
[1501] | 42 | #ifndef HAVE_LIBPYRAP
|
---|
| 43 | #include "pyconversions.h"
|
---|
| 44 | #else
|
---|
| 45 | #include <pyrap/Converters/PycExcp.h>
|
---|
| 46 | #include <pyrap/Converters/PycBasicData.h>
|
---|
[1901] | 47 | #include <pyrap/Converters/PycValueHolder.h>
|
---|
| 48 | #include <pyrap/Converters/PycRecord.h>
|
---|
[1501] | 49 | #endif
|
---|
[875] | 50 |
|
---|
| 51 | #include "python_asap.h"
|
---|
[2] | 52 |
|
---|
[1501] | 53 | #ifndef HAVE_LIBPYRAP
|
---|
[95] | 54 | namespace asap {
|
---|
| 55 | namespace python {
|
---|
[1501] | 56 |
|
---|
[125] | 57 | void translate_ex(const casa::AipsError& e)
|
---|
[95] | 58 | {
|
---|
| 59 | // Use the Python 'C' API to set up an exception object
|
---|
| 60 | PyErr_SetString(PyExc_RuntimeError, e.what());
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | }
|
---|
| 64 | }
|
---|
[1501] | 65 | #endif
|
---|
| 66 |
|
---|
[2] | 67 | using namespace boost::python;
|
---|
| 68 |
|
---|
[95] | 69 | BOOST_PYTHON_MODULE(_asap) {
|
---|
[2587] | 70 | //asap::python::python_Plotter2();
|
---|
[875] | 71 | asap::python::python_Scantable();
|
---|
| 72 | asap::python::python_STFiller();
|
---|
[1819] | 73 | asap::python::python_Filler();
|
---|
[1974] | 74 | asap::python::python_MSFiller();
|
---|
[875] | 75 | asap::python::python_STSelector();
|
---|
| 76 | asap::python::python_STMath();
|
---|
[894] | 77 | asap::python::python_Fitter();
|
---|
[881] | 78 | asap::python::python_STLineFinder();
|
---|
[960] | 79 | asap::python::python_STFitEntry();
|
---|
[988] | 80 | asap::python::python_STWriter();
|
---|
[1974] | 81 | asap::python::python_MSWriter();
|
---|
[1126] | 82 | asap::python::python_LineCatalog();
|
---|
[1819] | 83 | asap::python::python_LogSink();
|
---|
[1598] | 84 | asap::python::python_STCoordinate();
|
---|
[1715] | 85 | asap::python::python_STAtmosphere();
|
---|
[1819] | 86 | asap::python::python_SrcType();
|
---|
[2356] | 87 | asap::python::python_STGrid();
|
---|
[2580] | 88 | asap::python::python_Iterator();
|
---|
[2613] | 89 | asap::python::python_EdgeMarker();
|
---|
[2689] | 90 | asap::python::python_PlotHelper();
|
---|
[988] | 91 |
|
---|
[1501] | 92 | #ifndef HAVE_LIBPYRAP
|
---|
| 93 | // Use built-in pyconversions.h
|
---|
[125] | 94 | register_exception_translator<casa::AipsError>(&asap::python::translate_ex);
|
---|
[875] | 95 | from_python_sequence < std::vector< asap::ScantableWrapper >,
|
---|
| 96 | variable_capacity_policy > ();
|
---|
[2] | 97 | std_vector_to_tuple < int > ();
|
---|
[95] | 98 | from_python_sequence < std::vector < int >,
|
---|
[2] | 99 | variable_capacity_policy > ();
|
---|
[1112] | 100 | std_vector_to_tuple < uint > ();
|
---|
| 101 | from_python_sequence < std::vector < uint >,
|
---|
| 102 | variable_capacity_policy > ();
|
---|
[2] | 103 | std_vector_to_tuple < float > ();
|
---|
[95] | 104 | from_python_sequence < std::vector < float >,
|
---|
[2] | 105 | variable_capacity_policy > ();
|
---|
[42] | 106 | std_vector_to_tuple < double > ();
|
---|
[95] | 107 | from_python_sequence < std::vector < double >,
|
---|
[42] | 108 | variable_capacity_policy > ();
|
---|
[2] | 109 | std_vector_to_tuple < std::string > ();
|
---|
[95] | 110 | from_python_sequence < std::vector < std::string >,
|
---|
[2] | 111 | variable_capacity_policy > ();
|
---|
| 112 | std_vector_to_tuple < bool> ();
|
---|
[95] | 113 | from_python_sequence < std::vector < bool >,
|
---|
[2] | 114 | variable_capacity_policy > ();
|
---|
[1501] | 115 | #else
|
---|
| 116 | casa::pyrap::register_convert_excp();
|
---|
| 117 | casa::pyrap::register_convert_basicdata();
|
---|
| 118 | casa::pyrap::register_convert_std_vector<asap::ScantableWrapper>();
|
---|
[1901] | 119 | casa::pyrap::register_convert_std_vector<int>();
|
---|
| 120 | casa::pyrap::register_convert_std_vector<uint>();
|
---|
| 121 | casa::pyrap::register_convert_std_vector<float>();
|
---|
| 122 | casa::pyrap::register_convert_std_vector<double>();
|
---|
| 123 | casa::pyrap::register_convert_std_vector<std::string>();
|
---|
| 124 | casa::pyrap::register_convert_std_vector<bool>();
|
---|
| 125 | casa::pyrap::register_convert_casa_valueholder();
|
---|
| 126 | casa::pyrap::register_convert_casa_record();
|
---|
[2666] | 127 |
|
---|
[1501] | 128 | #endif
|
---|
[2] | 129 | }
|
---|