source: trunk/src/python_asap.cpp @ 2707

Last change on this file since 2707 was 2707, checked in by Kana Sugimoto, 11 years ago

New Development: Yes

JIRA Issue: Yes (CAS-4141)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed:

  • a new c++ class, STSideBandSep and its python interface.
  • a new method set_lo1 in the sbseparator module.

Test Programs: manual tests by CSV scientists.

Put in Release Notes: No

Module(s): STSidebandSep (a new class) and sbseparator

Description:

Added a new c++ class, STSideBandSep, and its python interface (python_STSideBandSep.cpp).
The class works on calculating frequency information of image side band and fill scantable.
Also added a new python method, set_lo1(double), in sbseparator module. This is to allow
user to set LO1 frequency to solve frequencies of image side band manually.


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