source: trunk/src/STGrid.h @ 2382

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

Replaced gridAll() with gridPerPol(), which performs grigging for each
polarization components separately.

nchunk_ is tentatively set to 10000.


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