source: trunk/src/STGrid.h@ 2729

Last change on this file since 2729 was 2686, 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: run sdgrid task with plot=True

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Fix for plotter failure.


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