source: trunk/src/python_Scantable.cpp

Last change on this file was 2888, checked in by Kana Sugimoto, 10 years ago

New Development: Yes

JIRA Issue: Yes (CAS-5860)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: Added scantable a method, asap.scantable.._get_root_row_idx(), and underlying c++ functions, ScantableWrapper:::getRootTableRowNumbers() and Scantable:::getRootTableRowNumbers()

Test Programs: TBD

Put in Release Notes: No

Module(s): asap.scantable and CASA task, tsdstat

Description:

Added a scantable method, asap.scantable._get_root_row_idx().
The method returns row indices (uint std::vecotr) in the root table for selected rows of scantable.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1//#---------------------------------------------------------------------------
2//# python_Scantable.cc: python exposure of c++ Scantable class
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_Scantable.cpp 2888 2013-12-26 02:21:30Z KanaSugimoto $
30//#---------------------------------------------------------------------------
31
32#include <boost/python.hpp>
33#include <boost/python/args.hpp>
34#include <vector>
35
36#include "ScantableWrapper.h"
37
38using namespace boost::python;
39
40namespace asap {
41  namespace python {
42
43void python_Scantable() {
44  class_<ScantableWrapper>("Scantable")
45    //.def( init <> () )
46    .def( init < int > () )
47    .def( init < const std::string&, int > () )
48    .def( init < const ScantableWrapper& > () )
49    .def("_copy", &ScantableWrapper::copy)
50    .def("_assign", &ScantableWrapper::assign)
51    .def("getif", &ScantableWrapper::getIF)
52    .def("getifnos", &ScantableWrapper::getIFNos)
53    .def("getbeam", &ScantableWrapper::getBeam)
54    .def("getbeamnos", &ScantableWrapper::getBeamNos)
55    .def("getpol", &ScantableWrapper::getPol)
56    .def("getpolnos", &ScantableWrapper::getPolNos)
57    .def("getscan", &ScantableWrapper::getScan)
58    .def("getscannos", &ScantableWrapper::getScanNos)
59    .def("getcycle", &ScantableWrapper::getCycle)
60    .def("getcyclenos", &ScantableWrapper::getCycleNos)
61    .def("getmolnos", &ScantableWrapper::getMolNos)
62    .def("nif", &ScantableWrapper::nif,
63         (boost::python::arg("scanno")=-1) )
64    .def("nbeam", &ScantableWrapper::nbeam,
65         (boost::python::arg("scanno")=-1) )
66    .def("npol", &ScantableWrapper::npol,
67         (boost::python::arg("scanno")=-1) )
68    .def("nchan", &ScantableWrapper::nchan,
69         (boost::python::arg("ifno")=-1) )
70    .def("ncycle", &ScantableWrapper::ncycle,
71         (boost::python::arg("scanno")=-1) )
72    .def("nscan", &ScantableWrapper::nscan)
73    .def("nrow", &ScantableWrapper::nrow)
74    .def("get_fluxunit", &ScantableWrapper::getFluxUnit)
75    .def("set_fluxunit", &ScantableWrapper::setFluxUnit)
76    .def("_setInstrument", &ScantableWrapper::setInstrument)
77    .def("_setfeedtype", &ScantableWrapper::setFeedType)
78    .def("_getspectrum", &ScantableWrapper::getSpectrum,
79         (boost::python::arg("whichrow")=0,
80          boost::python::arg("poltype")=std::string("")) )
81    .def("poltype", &ScantableWrapper::getPolType )
82    .def("get_column_names", &ScantableWrapper::columnNames)
83    .def("_getpollabel", &ScantableWrapper::getPolarizationLabel)
84    .def("_setspectrum",&ScantableWrapper::setSpectrum,
85         (boost::python::arg("whichrow")=0) )
86    .def("_getabcissa", &ScantableWrapper::getAbcissa,
87         (boost::python::arg("whichrow")=0) )
88    .def("_getabcissalabel", &ScantableWrapper::getAbcissaLabel,
89         (boost::python::arg("whichrow")=0) )
90    .def("_getmask", &ScantableWrapper::getMask,
91         (boost::python::arg("whichrow")=0) )
92    .def("_getclipmask", &ScantableWrapper::getClipMask,
93         (boost::python::arg("whichrow")=0) )
94    .def("_gettsys", &ScantableWrapper::getTsys)
95    .def("_gettsysspectrum", &ScantableWrapper::getTsysSpectrum )
96    .def("_settsys", &ScantableWrapper::setTsys)
97    .def("_getsourcename", &ScantableWrapper::getSourceName,
98         (boost::python::arg("whichrow")=0) )
99    .def("_getelevation", &ScantableWrapper::getElevation,
100         (boost::python::arg("whichrow")=0) )
101    .def("_getazimuth", &ScantableWrapper::getAzimuth,
102         (boost::python::arg("whichrow")=0) )
103    .def("_getparangle", &ScantableWrapper::getParAngle,
104         (boost::python::arg("whichrow")=0) )
105    .def("_gettime", &ScantableWrapper::getTime,
106         (boost::python::arg("whichrow")=0,
107          boost::python::arg("prec")=0) )
108    .def("_getinttime", &ScantableWrapper::getIntTime,
109         (boost::python::arg("whichrow")=0) )
110    .def("_getdirection", &ScantableWrapper::getDirectionString,
111         (boost::python::arg("whichrow")=0) )
112    .def("get_antennaname", &ScantableWrapper::getAntennaName)
113    .def("_flag", &ScantableWrapper::flag)
114    .def("_flag_row", &ScantableWrapper::flagRow)
115    .def("_getflagrow", &ScantableWrapper::getFlagRow,
116         (boost::python::arg("whichrow")=0) )
117    .def("_clip", &ScantableWrapper::clip,
118         (boost::python::arg("clipoutside")=true,
119          boost::python::arg("unflag")=false) )
120    .def("_save",  &ScantableWrapper::makePersistent)
121    .def("_summary",  &ScantableWrapper::summary,
122         (boost::python::arg("filename")=""))
123    .def("_list_header",  &ScantableWrapper::listHeader)
124    .def("_getrestfreqs",  &ScantableWrapper::getRestFrequency)
125    .def("_setrestfreqs",  &ScantableWrapper::setRestFrequencies)
126    .def("shift_refpix", &ScantableWrapper::shift)
127    .def("_setcoordinfo", &ScantableWrapper::setCoordInfo)
128    .def("_getcoordinfo", &ScantableWrapper::getCoordInfo)
129    .def("set_dirframe", &ScantableWrapper::setDirection,
130         (boost::python::arg("refstr")="") )
131    .def("_gethistory", &ScantableWrapper::getHistory)
132    .def("_addhistory", &ScantableWrapper::addHistory)
133    .def("drop_history", &ScantableWrapper::dropHistory)
134    .def("_historylength", &ScantableWrapper::historyLength)
135    .def("_getselection", &ScantableWrapper::getSelection)
136    .def("_setselection", &ScantableWrapper::setSelection)
137    .def("_addfit", &ScantableWrapper::addFit)
138    .def("_getfit", &ScantableWrapper::getFit)
139    .def("_recalcazel", &ScantableWrapper::calculateAZEL)
140    .def("_setsourcetype", &ScantableWrapper::setSourceType)
141    .def("_setsourcename", &ScantableWrapper::setSourceName)
142    .def("_getdirectionvec", &ScantableWrapper::getDirectionVector)
143    .def("_parallactify", &ScantableWrapper::parallactify)
144    .def("get_coordinate", &ScantableWrapper::getCoordinate)
145    .def("_get_weather", &ScantableWrapper::getWeather)
146    .def("_reshape", &ScantableWrapper::reshapeSpectrum,
147         (boost::python::arg("nmin")=-1,
148          boost::python::arg("nmax")=-1) )
149    .def("_regrid_specchan", &ScantableWrapper::regridSpecChannel,
150         (boost::python::arg("nchan")=-1) )
151    .def("_apply_bltable", &ScantableWrapper::applyBaselineTable)
152    .def("_sub_baseline", &ScantableWrapper::subBaseline)
153    .def("_poly_baseline", &ScantableWrapper::polyBaseline)
154    .def("_auto_poly_baseline", &ScantableWrapper::autoPolyBaseline)
155    .def("_chebyshev_baseline", &ScantableWrapper::chebyshevBaseline)
156    .def("_auto_chebyshev_baseline", &ScantableWrapper::autoChebyshevBaseline)
157    .def("_cspline_baseline", &ScantableWrapper::cubicSplineBaseline)
158    .def("_auto_cspline_baseline", &ScantableWrapper::autoCubicSplineBaseline)
159    .def("_sinusoid_baseline", &ScantableWrapper::sinusoidBaseline)
160    .def("_auto_sinusoid_baseline", &ScantableWrapper::autoSinusoidBaseline)
161    .def("get_rms", &ScantableWrapper::getRms)
162    .def("format_blparams_row", &ScantableWrapper::formatBaselineParams)
163    .def("format_piecewise_blparams_row", &ScantableWrapper::formatPiecewiseBaselineParams)
164    .def("_is_all_chan_flagged", &ScantableWrapper::isAllChannelsFlagged,
165         (boost::python::arg("whichrow")=0) )
166    .def("_fft", &ScantableWrapper::execFFT)
167    //.def("_sspline_baseline", &ScantableWrapper::smoothingSplineBaseline)
168    //.def("_test_cin", &ScantableWrapper::testCin)
169    .def("_getmolidcol_list", &ScantableWrapper::getMoleculeIdColumnData)
170    .def("_setmolidcol_list", &ScantableWrapper::setMoleculeIdColumnData)
171    .def("_get_root_row_idx", &ScantableWrapper::getRootTableRowNumbers)
172    .def("_calc_aic", &ScantableWrapper::calculateModelSelectionCriteria)
173    .def("drop_xpol", &ScantableWrapper::dropXPol)
174  ;
175};
176
177  } // python
178} // asap
Note: See TracBrowser for help on using the repository browser.