source: branches/alma/src/python_asap.cpp @ 1693

Last change on this file since 1693 was 1693, checked in by Takeshi Nakazato, 14 years ago

New Development: No

JIRA Issue: Yes CAS-1908

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes

Module(s): Module Names change impacts.

Description: Describe your changes here...

Changed a tagging as the source type is tagged by using SRCTYPE, not
an extra string in SRCNAME. To do this, I have defined a selection method
by SRCTYPE in STSelector class. I have newly added python_SrcType.cpp
that defines a Python interface of SrcType? enums which is defined
in atnf/PKSIO/SrcType.h.

Since I have added new file in the src directory, I have modified src/Makefile
to compile new file.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
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 1693 2010-02-10 08:39:06Z TakeshiNakazato $
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#ifndef HAVE_LIBPYRAP
42  #include "pyconversions.h"
43#else
44  #include <pyrap/Converters/PycExcp.h>
45  #include <pyrap/Converters/PycBasicData.h>
46#endif
47
48#include "python_asap.h"
49
50#ifndef HAVE_LIBPYRAP
51namespace asap {
52  namespace python {
53
54void translate_ex(const casa::AipsError& e)
55{
56  // Use the Python 'C' API to set up an exception object
57  PyErr_SetString(PyExc_RuntimeError, e.what());
58}
59
60  }
61}
62#endif
63
64using namespace boost::python;
65
66BOOST_PYTHON_MODULE(_asap) {
67  asap::python::python_Scantable();
68  asap::python::python_STFiller();
69  asap::python::python_STSelector();
70  asap::python::python_STMath();
71  asap::python::python_Fitter();
72  asap::python::python_STLineFinder();
73  asap::python::python_STFitEntry();
74  asap::python::python_STWriter();
75  asap::python::python_LineCatalog();
76  asap::python::python_Logger();
77  asap::python::python_SrcType();
78
79#ifndef HAVE_LIBPYRAP
80  // Use built-in pyconversions.h
81  register_exception_translator<casa::AipsError>(&asap::python::translate_ex);
82  from_python_sequence < std::vector< asap::ScantableWrapper >,
83    variable_capacity_policy > ();
84  std_vector_to_tuple < int > ();
85  from_python_sequence < std::vector < int >,
86    variable_capacity_policy > ();
87  std_vector_to_tuple < uint > ();
88  from_python_sequence < std::vector < uint >,
89    variable_capacity_policy > ();
90  std_vector_to_tuple < float > ();
91  from_python_sequence < std::vector < float >,
92    variable_capacity_policy > ();
93  std_vector_to_tuple < double > ();
94  from_python_sequence < std::vector < double >,
95    variable_capacity_policy > ();
96  std_vector_to_tuple < std::string > ();
97  from_python_sequence < std::vector < std::string >,
98    variable_capacity_policy > ();
99  std_vector_to_tuple < bool> ();
100  from_python_sequence < std::vector < bool >,
101    variable_capacity_policy > ();
102#else
103  casa::pyrap::register_convert_excp();
104  casa::pyrap::register_convert_basicdata();
105  casa::pyrap::register_convert_std_vector<asap::ScantableWrapper>();
106#endif
107}
Note: See TracBrowser for help on using the repository browser.