source: trunk/src/STGrid.h @ 2384

Last change on this file since 2384 was 2384, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: Yes CAS-2816

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Updated call_ggridsd to be easy to call.


File size: 4.9 KB
Line 
1//
2// C++ Interface: STGrid
3//
4// Description:
5//
6//
7// Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2011
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#ifndef ASAPSTGRID_H
13#define ASAPSTGRID_H
14
15#include <iostream>
16#include <fstream>
17#include <string>
18#include <vector>
19
20#include <casa/BasicSL/String.h>
21#include <casa/Arrays/Array.h>
22#include <casa/Arrays/Vector.h>
23#include <casa/Containers/RecordField.h>
24
25#include <tables/Tables/Table.h>
26#include <tables/Tables/ScalarColumn.h>
27#include <tables/Tables/ArrayColumn.h>
28//#include <tables/Tables/TableRow.h>
29
30// #include <measures/Measures/MDirection.h>
31
32// #include "Scantable.h"
33
34using namespace std ;
35using namespace casa ;
36
37namespace asap {
38class STGrid
39{
40public:
41  STGrid() ;
42  STGrid( const string infile ) ;
43  virtual ~STGrid() {} ;
44
45  void setFileIn( const string infile ) ;
46
47  void setIF( unsigned int ifno ) { ifno_ = ifno ; } ;
48
49  void setPolList( vector<unsigned int> pols ) ;
50
51  void setScanList( vector<unsigned int> scans ) ;
52
53  void defineImage( int nx=-1,
54                    int ny=-1,
55                    string scellx="",
56                    string scelly="",
57                    string scenter="" ) ;
58  void setFunc( string convtype="box",
59                int convsupport=-1 ) ;
60
61  void setWeight( const string wType="uniform" ) ;
62
63  void grid() ;
64 
65  string saveData( string outfile="" ) ;
66
67private:
68  void init() ;
69
70  // actual gridding
71  void gridPerRow() ;
72  void gridPerPol() ;
73
74  void setupGrid( Int &nx,
75                  Int &ny,
76                  String &cellx,
77                  String &celly,
78                  Double &xmin,
79                  Double &xmax,
80                  Double &ymin,
81                  Double &ymax,
82                  String &center ) ;
83
84  void setData( Array<Complex> &gdata,
85                Array<Float> &gwgt ) ;
86 
87  void getDataPerPol( Array<Complex> &spectra,
88                      Array<Double> &direction,
89                      Array<Int> &flagtra,
90                      Array<Int> &rflag,
91                      Array<Float> &weight ) ;
92  void getDataPerPol( Array<Float> &spectra,
93                      Array<Double> &direction,
94                      Array<uChar> &flagtra,
95                      Array<uInt> &rflag,
96                      Array<Float> &weight ) ;
97  Int getDataChunk( Array<Complex> &spectra,
98                    Array<Double> &direction,
99                    Array<Int> &flagtra,
100                    Array<Int> &rflag,
101                    Array<Float> &weight ) ;
102  Int getDataChunk( Array<Float> &spectra,
103                    Array<Double> &direction,
104                    Array<uChar> &flagtra,
105                    Array<uInt> &rflag,
106                    Array<Float> &weight ) ;
107
108  void getWeight( Array<Float> &w,
109                  Array<Float> &tsys,
110                  Array<Double> &tint ) ;
111 
112  void toInt( Array<uChar> &u, Array<Int> &v ) ;
113  void toInt( Array<uInt> &u, Array<Int> &v ) ;
114
115  void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
116 
117  void boxFunc( Vector<Float> &convFunc, Int &convSize ) ;
118  void spheroidalFunc( Vector<Float> &convFunc ) ;
119  void gaussFunc( Vector<Float> &convFunc ) ;
120  void pbFunc( Vector<Float> &convFunc ) ;
121  void setConvFunc( Vector<Float> &convFunc ) ;
122
123  void prepareTable( Table &tab, String &name ) ;
124
125  Bool pastEnd() ;
126
127  void selectData() ;
128  void setupArray() ;
129
130  Bool examine() ;
131  void attach( Table &tab ) ;
132
133  void call_ggridsd( Array<Double> &xy,
134                     Array<Complex> &values,
135                     Int &nvispol,
136                     Int &nvischan,
137                     Array<Int> &flag,
138                     Array<Int> &rflag,
139                     Array<Float> &weight,
140                     Int &nrow,
141                     Int &irow,
142                     Array<Complex> &grid,
143                     Array<Float> &wgrid,
144                     Int &nx,
145                     Int &ny,
146                     Int &npol,
147                     Int &nchan,
148                     Int &support,
149                     Int &sampling,
150                     Vector<Float> &convFunc,
151                     Int *chanMap,
152                     Int *polMap ) ;
153
154  void initPol( Int ipol ) ;
155
156
157  String infile_ ;
158  Int ifno_ ;
159  Int nx_ ;
160  Int ny_ ;
161  Int npol_ ;
162  Int nchan_ ;
163  Int nrow_ ;
164  Double cellx_ ;
165  Double celly_ ;
166  Vector<Double> center_ ;
167  String convType_ ;
168  Int convSupport_ ;
169  Int userSupport_ ;
170  Int convSampling_ ;
171  Array<Float> data_ ;
172  Vector<uInt> pollist_ ;
173  Vector<uInt> scanlist_ ;
174  String wtype_ ;
175
176  Table tab_ ;
177  Table ptab_ ;
178  ROArrayColumn<Float> spectraCol_ ;
179  ROArrayColumn<uChar> flagtraCol_ ;
180  ROArrayColumn<Double> directionCol_ ;
181  ROScalarColumn<uInt> flagRowCol_ ;
182  ROArrayColumn<Float> tsysCol_ ;
183  ROScalarColumn<Double> intervalCol_ ;
184  Int nprocessed_ ;
185  Vector<uInt> rows_ ;
186  Int nchunk_ ;
187
188  Array<Float> spectraF_ ;
189  Array<uChar> flagtraUC_ ;
190  Array<uInt> rflagUI_ ;
191
192};
193}
194#endif
Note: See TracBrowser for help on using the repository browser.