source: trunk/src/STGrid.h@ 2660

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

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: test_sdgrid

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

toPixel is redefined using DirectionCoordinate.


File size: 7.5 KB
RevLine 
[2356]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>
[2360]18#include <vector>
[2356]19
20#include <casa/BasicSL/String.h>
[2381]21#include <casa/Arrays/Array.h>
[2356]22#include <casa/Arrays/Vector.h>
[2381]23#include <casa/Containers/RecordField.h>
[2356]24
25#include <tables/Tables/Table.h>
[2379]26#include <tables/Tables/ScalarColumn.h>
27#include <tables/Tables/ArrayColumn.h>
[2393]28
[2593]29#include "ScantableWrapper.h"
30#include "Scantable.h"
[2393]31#include "concurrent.h"
[2356]32
33using namespace std ;
34using namespace casa ;
35
36namespace asap {
37class STGrid
38{
39public:
40 STGrid() ;
41 STGrid( const string infile ) ;
[2390]42 STGrid( const vector<string> infile ) ;
[2356]43 virtual ~STGrid() {} ;
44
45 void setFileIn( const string infile ) ;
[2390]46 void setFileList( const vector<string> infile ) ;
[2356]47
[2362]48 void setIF( unsigned int ifno ) { ifno_ = ifno ; } ;
49
[2360]50 void setPolList( vector<unsigned int> pols ) ;
51
[2364]52 void setScanList( vector<unsigned int> scans ) ;
53
[2356]54 void defineImage( int nx=-1,
55 int ny=-1,
56 string scellx="",
57 string scelly="",
58 string scenter="" ) ;
[2364]59 void setFunc( string convtype="box",
60 int convsupport=-1 ) ;
[2361]61
62 void setWeight( const string wType="uniform" ) ;
63
[2396]64 void enableClip() { doclip_ = True ; } ;
65 void disableClip() { doclip_ = False ; } ;
66
[2356]67 void grid() ;
68
69 string saveData( string outfile="" ) ;
70
[2593]71//private:
72protected:
[2356]73 void init() ;
74
[2382]75 // actual gridding
76 void gridPerRow() ;
[2396]77 void gridPerRowWithClipping() ;
[2382]78
[2396]79 // clipping
80 void clipMinMax( Array<Complex> &data,
81 Array<Float> &weight,
82 Array<Int> &npoints,
83 Array<Complex> &clipmin,
84 Array<Float> &clipwmin,
85 Array<Float> &clipcmin,
86 Array<Complex> &clipmax,
87 Array<Float> &clipwmax,
88 Array<Float> &clipcmax ) ;
89
90
[2388]91 void setupGrid() ;
[2356]92 void setupGrid( Int &nx,
93 Int &ny,
94 String &cellx,
95 String &celly,
96 Double &xmin,
97 Double &xmax,
98 Double &ymin,
99 Double &ymax,
100 String &center ) ;
[2388]101 void mapExtent( Double &xmin, Double &xmax,
102 Double &ymin, Double &ymax ) ;
[2368]103
[2378]104 void setData( Array<Complex> &gdata,
[2368]105 Array<Float> &gwgt ) ;
[2356]106
[2393]107 Int getDataChunk( IPosition const &wshape,
108 IPosition const &vshape,
109 IPosition const &dshape,
110 Array<Complex> &spectra,
111 Array<Double> &direction,
112 Array<Int> &flagtra,
113 Array<Int> &rflag,
114 Array<Float> &weight ) ;
[2379]115 Int getDataChunk( Array<Complex> &spectra,
116 Array<Double> &direction,
117 Array<Int> &flagtra,
118 Array<Int> &rflag,
119 Array<Float> &weight ) ;
120 Int getDataChunk( Array<Float> &spectra,
121 Array<Double> &direction,
122 Array<uChar> &flagtra,
123 Array<uInt> &rflag,
124 Array<Float> &weight ) ;
[2356]125
[2375]126 void getWeight( Array<Float> &w,
127 Array<Float> &tsys,
128 Array<Double> &tint ) ;
[2382]129
[2375]130 void toInt( Array<uChar> &u, Array<Int> &v ) ;
131 void toInt( Array<uInt> &u, Array<Int> &v ) ;
[2356]132
[2375]133 void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
[2356]134
135 void boxFunc( Vector<Float> &convFunc, Int &convSize ) ;
136 void spheroidalFunc( Vector<Float> &convFunc ) ;
137 void gaussFunc( Vector<Float> &convFunc ) ;
138 void pbFunc( Vector<Float> &convFunc ) ;
139 void setConvFunc( Vector<Float> &convFunc ) ;
140
[2371]141 void prepareTable( Table &tab, String &name ) ;
142
[2379]143 void selectData() ;
144 void setupArray() ;
[2378]145
[2398]146 void updateChunkShape() ;
[2382]147 void attach( Table &tab ) ;
[2379]148
[2384]149 void call_ggridsd( Array<Double> &xy,
150 Array<Complex> &values,
151 Int &nvispol,
152 Int &nvischan,
153 Array<Int> &flag,
154 Array<Int> &rflag,
155 Array<Float> &weight,
156 Int &nrow,
157 Int &irow,
158 Array<Complex> &grid,
159 Array<Float> &wgrid,
160 Int &nx,
161 Int &ny,
162 Int &npol,
163 Int &nchan,
164 Int &support,
165 Int &sampling,
166 Vector<Float> &convFunc,
[2381]167 Int *chanMap,
168 Int *polMap ) ;
[2396]169 void call_ggridsd2( Array<Double> &xy,
170 Array<Complex> &values,
171 Int &nvispol,
172 Int &nvischan,
173 Array<Int> &flag,
174 Array<Int> &rflag,
175 Array<Float> &weight,
176 Int &nrow,
177 Int &irow,
178 Array<Complex> &grid,
179 Array<Float> &wgrid,
180 Array<Int> &npoints,
181 Array<Complex> &clipmin,
182 Array<Float> &clipwmin,
183 Array<Float> &clipcmin,
184 Array<Complex> &clipmax,
185 Array<Float> &clipwmax,
186 Array<Float> &clipcmax,
187 Int &nx,
188 Int &ny,
189 Int &npol,
190 Int &nchan,
191 Int &support,
192 Int &sampling,
193 Vector<Float> &convFunc,
194 Int *chanMap,
195 Int *polMap ) ;
[2379]196
[2382]197 void initPol( Int ipol ) ;
[2390]198 void initTable( uInt idx ) ;
[2386]199 Bool isMultiIF( Table &tab ) ;
[2413]200 void fillMainColumns( Table &tab ) ;
[2593]201 void fillTable( Table &tab ) ;
202 virtual void table( Table &tab, uInt i ) ;
[2393]203 static bool produceChunk(void *ctx) throw(concurrent::PCException);
204 static void consumeChunk(void *ctx) throw(concurrent::PCException);
[2396]205 static void consumeChunkWithClipping(void *ctx) throw(concurrent::PCException);
[2381]206
[2382]207
[2388]208 // user input
209 Int nxUI_ ;
210 Int nyUI_ ;
211 String cellxUI_ ;
212 String cellyUI_ ;
213 String centerUI_ ;
214
[2389]215 Block<String> infileList_ ;
[2390]216 uInt nfile_ ;
[2362]217 Int ifno_ ;
[2396]218 Bool doclip_ ;
[2393]219
[2356]220 Int nx_ ;
221 Int ny_ ;
[2361]222 Int npol_ ;
[2386]223 Int npolOrg_ ;
[2361]224 Int nchan_ ;
[2356]225 Double cellx_ ;
226 Double celly_ ;
227 Vector<Double> center_ ;
228 String convType_ ;
229 Int convSupport_ ;
230 Int userSupport_ ;
231 Int convSampling_ ;
[2360]232 Vector<uInt> pollist_ ;
[2364]233 Vector<uInt> scanlist_ ;
[2361]234 String wtype_ ;
[2393]235 Block<Table> tableList_ ;
236 Vector<uInt> rows_ ;
237 Int nchunk_ ;
[2356]238
[2393]239 /////////////// gridPerRow variable
240 IPosition vshape_;
241 IPosition wshape_;
242 IPosition dshape_;
243 // loop variable
244 Int nrow_ ;
245 Array<Float> data_ ;
246
[2356]247 Table tab_ ;
[2393]248 // per pol
[2382]249 Table ptab_ ;
[2379]250 ROArrayColumn<Float> spectraCol_ ;
251 ROArrayColumn<uChar> flagtraCol_ ;
252 ROArrayColumn<Double> directionCol_ ;
253 ROScalarColumn<uInt> flagRowCol_ ;
254 ROArrayColumn<Float> tsysCol_ ;
255 ROScalarColumn<Double> intervalCol_ ;
[2393]256
[2379]257 Int nprocessed_ ;
[2381]258
259
[2393]260 double eGetData_;
261 double eToPixel_;
262 double eGGridSD_;
[2356]263};
[2593]264
265class STGrid2 : public STGrid
266{
267public:
268 STGrid2() ;
269 STGrid2( const ScantableWrapper &s ) ;
270 STGrid2( const vector<ScantableWrapper> &v ) ;
271 void setScantable( const ScantableWrapper &s ) ;
272 void setScantableList( const vector<ScantableWrapper> &v ) ;
273 void selectData() ;
274 virtual void table( Table &tab, uInt i ) ;
[2594]275 ScantableWrapper getResultAsScantable( int tp ) ;
[2593]276
277private:
278 Block<ScantableWrapper> dataList_ ;
279};
[2356]280}
281#endif
Note: See TracBrowser for help on using the repository browser.