source: trunk/src/STGrid.h@ 2397

Last change on this file since 2397 was 2396, checked in by Takeshi Nakazato, 13 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...

Added min/max clipping functionality.
Introduced control parameter and methods for clipping.

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
29#include "concurrent.h"
[2381]30//#include <tables/Tables/TableRow.h>
[2356]31
32// #include <measures/Measures/MDirection.h>
33
34// #include "Scantable.h"
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",
63 int convsupport=-1 ) ;
[2361]64
65 void setWeight( const string wType="uniform" ) ;
66
[2396]67 void enableClip() { doclip_ = True ; } ;
68 void disableClip() { doclip_ = False ; } ;
69
[2356]70 void grid() ;
71
72 string saveData( string outfile="" ) ;
73
74private:
75 void init() ;
76
[2382]77 // actual gridding
78 void gridPerRow() ;
[2396]79 void gridPerRowWithClipping() ;
[2382]80 void gridPerPol() ;
81
[2396]82 // clipping
83 void clipMinMax( Array<Complex> &data,
84 Array<Float> &weight,
85 Array<Int> &npoints,
86 Array<Complex> &clipmin,
87 Array<Float> &clipwmin,
88 Array<Float> &clipcmin,
89 Array<Complex> &clipmax,
90 Array<Float> &clipwmax,
91 Array<Float> &clipcmax ) ;
92
93
[2388]94 void setupGrid() ;
[2356]95 void setupGrid( Int &nx,
96 Int &ny,
97 String &cellx,
98 String &celly,
99 Double &xmin,
100 Double &xmax,
101 Double &ymin,
102 Double &ymax,
103 String &center ) ;
[2388]104 void mapExtent( Double &xmin, Double &xmax,
105 Double &ymin, Double &ymax ) ;
[2368]106
[2378]107 void setData( Array<Complex> &gdata,
[2368]108 Array<Float> &gwgt ) ;
[2356]109
[2382]110 void getDataPerPol( Array<Complex> &spectra,
111 Array<Double> &direction,
112 Array<Int> &flagtra,
113 Array<Int> &rflag,
114 Array<Float> &weight ) ;
115 void getDataPerPol( Array<Float> &spectra,
116 Array<Double> &direction,
117 Array<uChar> &flagtra,
118 Array<uInt> &rflag,
119 Array<Float> &weight ) ;
[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 ) ;
150 void gaussFunc( Vector<Float> &convFunc ) ;
151 void pbFunc( Vector<Float> &convFunc ) ;
152 void setConvFunc( Vector<Float> &convFunc ) ;
153
[2371]154 void prepareTable( Table &tab, String &name ) ;
155
[2393]156// Bool pastEnd() ;
[2378]157
[2379]158 void selectData() ;
159 void setupArray() ;
[2378]160
[2379]161 Bool examine() ;
[2382]162 void attach( Table &tab ) ;
[2379]163
[2384]164 void call_ggridsd( Array<Double> &xy,
165 Array<Complex> &values,
166 Int &nvispol,
167 Int &nvischan,
168 Array<Int> &flag,
169 Array<Int> &rflag,
170 Array<Float> &weight,
171 Int &nrow,
172 Int &irow,
173 Array<Complex> &grid,
174 Array<Float> &wgrid,
175 Int &nx,
176 Int &ny,
177 Int &npol,
178 Int &nchan,
179 Int &support,
180 Int &sampling,
181 Vector<Float> &convFunc,
[2381]182 Int *chanMap,
183 Int *polMap ) ;
[2396]184 void call_ggridsd2( Array<Double> &xy,
185 Array<Complex> &values,
186 Int &nvispol,
187 Int &nvischan,
188 Array<Int> &flag,
189 Array<Int> &rflag,
190 Array<Float> &weight,
191 Int &nrow,
192 Int &irow,
193 Array<Complex> &grid,
194 Array<Float> &wgrid,
195 Array<Int> &npoints,
196 Array<Complex> &clipmin,
197 Array<Float> &clipwmin,
198 Array<Float> &clipcmin,
199 Array<Complex> &clipmax,
200 Array<Float> &clipwmax,
201 Array<Float> &clipcmax,
202 Int &nx,
203 Int &ny,
204 Int &npol,
205 Int &nchan,
206 Int &support,
207 Int &sampling,
208 Vector<Float> &convFunc,
209 Int *chanMap,
210 Int *polMap ) ;
[2379]211
[2382]212 void initPol( Int ipol ) ;
[2390]213 void initTable( uInt idx ) ;
[2386]214 Bool isMultiIF( Table &tab ) ;
[2393]215 static bool produceChunk(void *ctx) throw(concurrent::PCException);
216 static void consumeChunk(void *ctx) throw(concurrent::PCException);
[2396]217 static void consumeChunkWithClipping(void *ctx) throw(concurrent::PCException);
[2381]218
[2382]219
[2388]220 // user input
221 Int nxUI_ ;
222 Int nyUI_ ;
223 String cellxUI_ ;
224 String cellyUI_ ;
225 String centerUI_ ;
226
[2389]227 Block<String> infileList_ ;
[2390]228 uInt nfile_ ;
[2362]229 Int ifno_ ;
[2396]230 Bool doclip_ ;
[2393]231
[2356]232 Int nx_ ;
233 Int ny_ ;
[2361]234 Int npol_ ;
[2386]235 Int npolOrg_ ;
[2361]236 Int nchan_ ;
[2356]237 Double cellx_ ;
238 Double celly_ ;
239 Vector<Double> center_ ;
240 String convType_ ;
241 Int convSupport_ ;
242 Int userSupport_ ;
243 Int convSampling_ ;
[2360]244 Vector<uInt> pollist_ ;
[2364]245 Vector<uInt> scanlist_ ;
[2361]246 String wtype_ ;
[2393]247 Block<Table> tableList_ ;
248 Vector<uInt> rows_ ;
249 Int nchunk_ ;
[2356]250
[2393]251 /////////////// gridPerRow variable
252 IPosition vshape_;
253 IPosition wshape_;
254 IPosition dshape_;
255 // loop variable
256 Int nrow_ ;
257 Array<Float> data_ ;
258
[2356]259 Table tab_ ;
[2393]260 // per pol
[2382]261 Table ptab_ ;
[2379]262 ROArrayColumn<Float> spectraCol_ ;
263 ROArrayColumn<uChar> flagtraCol_ ;
264 ROArrayColumn<Double> directionCol_ ;
265 ROScalarColumn<uInt> flagRowCol_ ;
266 ROArrayColumn<Float> tsysCol_ ;
267 ROScalarColumn<Double> intervalCol_ ;
[2393]268
[2379]269 Int nprocessed_ ;
[2381]270
271
[2393]272 double eGetData_;
273 double eToPixel_;
274 double eGGridSD_;
[2356]275};
276}
277#endif
Note: See TracBrowser for help on using the repository browser.