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 | |
---|
34 | using namespace std ; |
---|
35 | using namespace casa ; |
---|
36 | |
---|
37 | namespace asap { |
---|
38 | class STGrid |
---|
39 | { |
---|
40 | public: |
---|
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 | void gridAll() ; |
---|
65 | void gridPerRow() ; |
---|
66 | |
---|
67 | string saveData( string outfile="" ) ; |
---|
68 | |
---|
69 | private: |
---|
70 | void init() ; |
---|
71 | |
---|
72 | void setupGrid( Int &nx, |
---|
73 | Int &ny, |
---|
74 | String &cellx, |
---|
75 | String &celly, |
---|
76 | Double &xmin, |
---|
77 | Double &xmax, |
---|
78 | Double &ymin, |
---|
79 | Double &ymax, |
---|
80 | String ¢er ) ; |
---|
81 | |
---|
82 | void setData( Array<Complex> &gdata, |
---|
83 | Array<Float> &gwgt ) ; |
---|
84 | |
---|
85 | void getData( Array<Complex> &spectra, |
---|
86 | Array<Double> &direction, |
---|
87 | Array<Int> &flagtra, |
---|
88 | Array<Int> &rflag, |
---|
89 | Array<Float> &weight ) ; |
---|
90 | void getData( Array<Complex> &spectra, |
---|
91 | Array<Double> &direction, |
---|
92 | Array<uChar> &flagtra, |
---|
93 | Array<uInt> &rflag, |
---|
94 | Array<Float> &weight ) ; |
---|
95 | Int getDataChunk( Array<Complex> &spectra, |
---|
96 | Array<Double> &direction, |
---|
97 | Array<Int> &flagtra, |
---|
98 | Array<Int> &rflag, |
---|
99 | Array<Float> &weight ) ; |
---|
100 | Int getDataChunk( Array<Float> &spectra, |
---|
101 | Array<Double> &direction, |
---|
102 | Array<uChar> &flagtra, |
---|
103 | Array<uInt> &rflag, |
---|
104 | Array<Float> &weight ) ; |
---|
105 | |
---|
106 | void getWeight( Array<Float> &w, |
---|
107 | Array<Float> &tsys, |
---|
108 | Array<Double> &tint ) ; |
---|
109 | |
---|
110 | void toInt( Array<uChar> &u, Array<Int> &v ) ; |
---|
111 | void toInt( Array<uInt> &u, Array<Int> &v ) ; |
---|
112 | |
---|
113 | void toPixel( Array<Double> &world, Array<Double> &pixel ) ; |
---|
114 | |
---|
115 | void boxFunc( Vector<Float> &convFunc, Int &convSize ) ; |
---|
116 | void spheroidalFunc( Vector<Float> &convFunc ) ; |
---|
117 | void gaussFunc( Vector<Float> &convFunc ) ; |
---|
118 | void pbFunc( Vector<Float> &convFunc ) ; |
---|
119 | void setConvFunc( Vector<Float> &convFunc ) ; |
---|
120 | |
---|
121 | Float polMean( const Float *p ) ; |
---|
122 | Double polMean( const Double *p ) ; |
---|
123 | |
---|
124 | void prepareTable( Table &tab, String &name ) ; |
---|
125 | |
---|
126 | Bool pastEnd() ; |
---|
127 | |
---|
128 | void selectData() ; |
---|
129 | void setupArray() ; |
---|
130 | void sortData() ; |
---|
131 | |
---|
132 | Bool examine() ; |
---|
133 | void attach() ; |
---|
134 | |
---|
135 | void call_ggridsd( Double* xy, |
---|
136 | const Complex* values, |
---|
137 | Int* nvispol, |
---|
138 | Int* nvischan, |
---|
139 | const Int* flag, |
---|
140 | const Int* rflag, |
---|
141 | const Float* weight, |
---|
142 | Int* nrow, |
---|
143 | Int* irow, |
---|
144 | Complex* grid, |
---|
145 | Float* wgrid, |
---|
146 | Int* nx, |
---|
147 | Int* ny, |
---|
148 | Int * npol, |
---|
149 | Int * nchan, |
---|
150 | Int* support, |
---|
151 | Int* sampling, |
---|
152 | Float* convFunc, |
---|
153 | Int *chanMap, |
---|
154 | Int *polMap ) ; |
---|
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 | ROArrayColumn<Float> spectraCol_ ; |
---|
178 | ROArrayColumn<uChar> flagtraCol_ ; |
---|
179 | ROArrayColumn<Double> directionCol_ ; |
---|
180 | ROScalarColumn<uInt> flagRowCol_ ; |
---|
181 | ROArrayColumn<Float> tsysCol_ ; |
---|
182 | ROScalarColumn<Double> intervalCol_ ; |
---|
183 | // ROTableRow row_ ; |
---|
184 | // RORecordFieldPtr< Array<Float> > spectraRF_ ; |
---|
185 | // RORecordFieldPtr< Array<uChar> > flagtraRF_ ; |
---|
186 | // RORecordFieldPtr< Array<Double> > directionRF_ ; |
---|
187 | // RORecordFieldPtr<uInt> flagRowRF_ ; |
---|
188 | // RORecordFieldPtr< Array<Float> > tsysRF_ ; |
---|
189 | // RORecordFieldPtr<Double> intervalRF_ ; |
---|
190 | Int nprocessed_ ; |
---|
191 | Vector<uInt> rows_ ; |
---|
192 | Int nchunk_ ; |
---|
193 | |
---|
194 | Array<Float> spectraF_ ; |
---|
195 | Array<uChar> flagtraUC_ ; |
---|
196 | Array<uInt> rflagUI_ ; |
---|
197 | |
---|
198 | double subtime_ ; |
---|
199 | }; |
---|
200 | } |
---|
201 | #endif |
---|