source: trunk/src/STGrid.h @ 2390

Last change on this file since 2390 was 2390, 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...

More than one input data are supported.


File size: 5.3 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  STGrid( const vector<string> infile ) ;
44  virtual ~STGrid() {} ;
45
46  void setFileIn( const string infile ) ;
47  void setFileList( const vector<string> infile ) ;
48
49  void setIF( unsigned int ifno ) { ifno_ = ifno ; } ;
50
51  void setPolList( vector<unsigned int> pols ) ;
52
53  void setScanList( vector<unsigned int> scans ) ;
54
55  void defineImage( int nx=-1,
56                    int ny=-1,
57                    string scellx="",
58                    string scelly="",
59                    string scenter="" ) ;
60  void setFunc( string convtype="box",
61                int convsupport=-1 ) ;
62
63  void setWeight( const string wType="uniform" ) ;
64
65  void grid() ;
66 
67  string saveData( string outfile="" ) ;
68
69private:
70  void init() ;
71
72  // actual gridding
73  void gridPerRow() ;
74  void gridPerPol() ;
75
76  void setupGrid() ;
77  void setupGrid( Int &nx,
78                  Int &ny,
79                  String &cellx,
80                  String &celly,
81                  Double &xmin,
82                  Double &xmax,
83                  Double &ymin,
84                  Double &ymax,
85                  String &center ) ;
86  void mapExtent( Double &xmin, Double &xmax,
87                  Double &ymin, Double &ymax ) ;
88
89  void setData( Array<Complex> &gdata,
90                Array<Float> &gwgt ) ;
91 
92  void getDataPerPol( Array<Complex> &spectra,
93                      Array<Double> &direction,
94                      Array<Int> &flagtra,
95                      Array<Int> &rflag,
96                      Array<Float> &weight ) ;
97  void getDataPerPol( Array<Float> &spectra,
98                      Array<Double> &direction,
99                      Array<uChar> &flagtra,
100                      Array<uInt> &rflag,
101                      Array<Float> &weight ) ;
102  Int getDataChunk( Array<Complex> &spectra,
103                    Array<Double> &direction,
104                    Array<Int> &flagtra,
105                    Array<Int> &rflag,
106                    Array<Float> &weight ) ;
107  Int getDataChunk( Array<Float> &spectra,
108                    Array<Double> &direction,
109                    Array<uChar> &flagtra,
110                    Array<uInt> &rflag,
111                    Array<Float> &weight ) ;
112
113  void getWeight( Array<Float> &w,
114                  Array<Float> &tsys,
115                  Array<Double> &tint ) ;
116 
117  void toInt( Array<uChar> &u, Array<Int> &v ) ;
118  void toInt( Array<uInt> &u, Array<Int> &v ) ;
119
120  void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
121 
122  void boxFunc( Vector<Float> &convFunc, Int &convSize ) ;
123  void spheroidalFunc( Vector<Float> &convFunc ) ;
124  void gaussFunc( Vector<Float> &convFunc ) ;
125  void pbFunc( Vector<Float> &convFunc ) ;
126  void setConvFunc( Vector<Float> &convFunc ) ;
127
128  void prepareTable( Table &tab, String &name ) ;
129
130  Bool pastEnd() ;
131
132  void selectData() ;
133  void setupArray() ;
134
135  Bool examine() ;
136  void attach( Table &tab ) ;
137
138  void call_ggridsd( Array<Double> &xy,
139                     Array<Complex> &values,
140                     Int &nvispol,
141                     Int &nvischan,
142                     Array<Int> &flag,
143                     Array<Int> &rflag,
144                     Array<Float> &weight,
145                     Int &nrow,
146                     Int &irow,
147                     Array<Complex> &grid,
148                     Array<Float> &wgrid,
149                     Int &nx,
150                     Int &ny,
151                     Int &npol,
152                     Int &nchan,
153                     Int &support,
154                     Int &sampling,
155                     Vector<Float> &convFunc,
156                     Int *chanMap,
157                     Int *polMap ) ;
158
159  void initPol( Int ipol ) ;
160  void initTable( uInt idx ) ;
161  Bool isMultiIF( Table &tab ) ;
162
163
164  // user input
165  Int nxUI_ ;
166  Int nyUI_ ;
167  String cellxUI_ ;
168  String cellyUI_ ;
169  String centerUI_ ;
170
171  Block<String> infileList_ ;
172  uInt nfile_ ;
173  Int ifno_ ;
174  Int nx_ ;
175  Int ny_ ;
176  Int npol_ ;
177  Int npolOrg_ ;
178  Int nchan_ ;
179  Int nrow_ ;
180  Block<Int> rows_ ;
181  Double cellx_ ;
182  Double celly_ ;
183  Vector<Double> center_ ;
184  String convType_ ;
185  Int convSupport_ ;
186  Int userSupport_ ;
187  Int convSampling_ ;
188  Array<Float> data_ ;
189  Vector<uInt> pollist_ ;
190  Vector<uInt> scanlist_ ;
191  String wtype_ ;
192
193  Table tab_ ;
194  Block<Table> tableList_ ;
195  Table ptab_ ;
196  ROArrayColumn<Float> spectraCol_ ;
197  ROArrayColumn<uChar> flagtraCol_ ;
198  ROArrayColumn<Double> directionCol_ ;
199  ROScalarColumn<uInt> flagRowCol_ ;
200  ROArrayColumn<Float> tsysCol_ ;
201  ROScalarColumn<Double> intervalCol_ ;
202  Int nprocessed_ ;
203  Int nchunk_ ;
204
205  Array<Float> spectraF_ ;
206  Array<uChar> flagtraUC_ ;
207  Array<uInt> rflagUI_ ;
208
209};
210}
211#endif
Note: See TracBrowser for help on using the repository browser.