source: trunk/src/STGrid.h @ 2388

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

Introduced some parameter for user input.
setupGrid() is called within grid(), not defineImage().


File size: 5.1 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() ;
75  void setupGrid( Int &nx,
76                  Int &ny,
77                  String &cellx,
78                  String &celly,
79                  Double &xmin,
80                  Double &xmax,
81                  Double &ymin,
82                  Double &ymax,
83                  String &center ) ;
84  void mapExtent( Double &xmin, Double &xmax,
85                  Double &ymin, Double &ymax ) ;
86
87  void setData( Array<Complex> &gdata,
88                Array<Float> &gwgt ) ;
89 
90  void getDataPerPol( Array<Complex> &spectra,
91                      Array<Double> &direction,
92                      Array<Int> &flagtra,
93                      Array<Int> &rflag,
94                      Array<Float> &weight ) ;
95  void getDataPerPol( Array<Float> &spectra,
96                      Array<Double> &direction,
97                      Array<uChar> &flagtra,
98                      Array<uInt> &rflag,
99                      Array<Float> &weight ) ;
100  Int getDataChunk( Array<Complex> &spectra,
101                    Array<Double> &direction,
102                    Array<Int> &flagtra,
103                    Array<Int> &rflag,
104                    Array<Float> &weight ) ;
105  Int getDataChunk( Array<Float> &spectra,
106                    Array<Double> &direction,
107                    Array<uChar> &flagtra,
108                    Array<uInt> &rflag,
109                    Array<Float> &weight ) ;
110
111  void getWeight( Array<Float> &w,
112                  Array<Float> &tsys,
113                  Array<Double> &tint ) ;
114 
115  void toInt( Array<uChar> &u, Array<Int> &v ) ;
116  void toInt( Array<uInt> &u, Array<Int> &v ) ;
117
118  void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
119 
120  void boxFunc( Vector<Float> &convFunc, Int &convSize ) ;
121  void spheroidalFunc( Vector<Float> &convFunc ) ;
122  void gaussFunc( Vector<Float> &convFunc ) ;
123  void pbFunc( Vector<Float> &convFunc ) ;
124  void setConvFunc( Vector<Float> &convFunc ) ;
125
126  void prepareTable( Table &tab, String &name ) ;
127
128  Bool pastEnd() ;
129
130  void selectData() ;
131  void setupArray() ;
132
133  Bool examine() ;
134  void attach( Table &tab ) ;
135
136  void call_ggridsd( Array<Double> &xy,
137                     Array<Complex> &values,
138                     Int &nvispol,
139                     Int &nvischan,
140                     Array<Int> &flag,
141                     Array<Int> &rflag,
142                     Array<Float> &weight,
143                     Int &nrow,
144                     Int &irow,
145                     Array<Complex> &grid,
146                     Array<Float> &wgrid,
147                     Int &nx,
148                     Int &ny,
149                     Int &npol,
150                     Int &nchan,
151                     Int &support,
152                     Int &sampling,
153                     Vector<Float> &convFunc,
154                     Int *chanMap,
155                     Int *polMap ) ;
156
157  void initPol( Int ipol ) ;
158  Bool isMultiIF( Table &tab ) ;
159
160
161  // user input
162  Int nxUI_ ;
163  Int nyUI_ ;
164  String cellxUI_ ;
165  String cellyUI_ ;
166  String centerUI_ ;
167
168  String infile_ ;
169  Int ifno_ ;
170  Int nx_ ;
171  Int ny_ ;
172  Int npol_ ;
173  Int npolOrg_ ;
174  Int nchan_ ;
175  Int nrow_ ;
176  Double cellx_ ;
177  Double celly_ ;
178  Vector<Double> center_ ;
179  String convType_ ;
180  Int convSupport_ ;
181  Int userSupport_ ;
182  Int convSampling_ ;
183  Array<Float> data_ ;
184  Vector<uInt> pollist_ ;
185  Vector<uInt> scanlist_ ;
186  String wtype_ ;
187
188  Table tab_ ;
189  Table ptab_ ;
190  ROArrayColumn<Float> spectraCol_ ;
191  ROArrayColumn<uChar> flagtraCol_ ;
192  ROArrayColumn<Double> directionCol_ ;
193  ROScalarColumn<uInt> flagRowCol_ ;
194  ROArrayColumn<Float> tsysCol_ ;
195  ROScalarColumn<Double> intervalCol_ ;
196  Int nprocessed_ ;
197  Vector<uInt> rows_ ;
198  Int nchunk_ ;
199
200  Array<Float> spectraF_ ;
201  Array<uChar> flagtraUC_ ;
202  Array<uInt> rflagUI_ ;
203
204};
205}
206#endif
Note: See TracBrowser for help on using the repository browser.