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/Vector.h>
|
---|
22 | #include <casa/Arrays/Matrix.h>
|
---|
23 | #include <casa/Arrays/Cube.h>
|
---|
24 | // #include <casa/Arrays/ArrayMath.h>
|
---|
25 | // #include <casa/Inputs/Input.h>
|
---|
26 | // #include <casa/Quanta/Quantum.h>
|
---|
27 | // #include <casa/Quanta/QuantumHolder.h>
|
---|
28 | // #include <casa/Utilities/CountedPtr.h>
|
---|
29 |
|
---|
30 | #include <tables/Tables/Table.h>
|
---|
31 | #include <tables/Tables/ScalarColumn.h>
|
---|
32 | #include <tables/Tables/ArrayColumn.h>
|
---|
33 |
|
---|
34 | // #include <measures/Measures/MDirection.h>
|
---|
35 |
|
---|
36 | // #include "Scantable.h"
|
---|
37 |
|
---|
38 | using namespace std ;
|
---|
39 | using namespace casa ;
|
---|
40 |
|
---|
41 | namespace asap {
|
---|
42 | class STGrid
|
---|
43 | {
|
---|
44 | public:
|
---|
45 | STGrid() ;
|
---|
46 | STGrid( const string infile ) ;
|
---|
47 | virtual ~STGrid() {} ;
|
---|
48 |
|
---|
49 | void setFileIn( const string infile ) ;
|
---|
50 |
|
---|
51 | void setIF( unsigned int ifno ) { ifno_ = ifno ; } ;
|
---|
52 |
|
---|
53 | void setPolList( vector<unsigned int> pols ) ;
|
---|
54 |
|
---|
55 | void setScanList( vector<unsigned int> scans ) ;
|
---|
56 |
|
---|
57 | void defineImage( int nx=-1,
|
---|
58 | int ny=-1,
|
---|
59 | string scellx="",
|
---|
60 | string scelly="",
|
---|
61 | string scenter="" ) ;
|
---|
62 | void setFunc( string convtype="box",
|
---|
63 | int convsupport=-1 ) ;
|
---|
64 |
|
---|
65 | void setWeight( const string wType="uniform" ) ;
|
---|
66 |
|
---|
67 | void grid() ;
|
---|
68 | void gridAll() ;
|
---|
69 | void gridPerRow() ;
|
---|
70 |
|
---|
71 | string saveData( string outfile="" ) ;
|
---|
72 |
|
---|
73 | private:
|
---|
74 | void init() ;
|
---|
75 |
|
---|
76 | void setupGrid( Int &nx,
|
---|
77 | Int &ny,
|
---|
78 | String &cellx,
|
---|
79 | String &celly,
|
---|
80 | Double &xmin,
|
---|
81 | Double &xmax,
|
---|
82 | Double &ymin,
|
---|
83 | Double &ymax,
|
---|
84 | String ¢er ) ;
|
---|
85 |
|
---|
86 | void setData( Array<Complex> &gdata,
|
---|
87 | Array<Float> &gwgt ) ;
|
---|
88 |
|
---|
89 | void getData( Array<Complex> &spectra,
|
---|
90 | Array<Double> &direction,
|
---|
91 | Array<Int> &flagtra,
|
---|
92 | Array<Int> &rflag,
|
---|
93 | Array<Float> &weight ) ;
|
---|
94 | void getData( Array<Complex> &spectra,
|
---|
95 | Array<Double> &direction,
|
---|
96 | Array<uChar> &flagtra,
|
---|
97 | Array<uInt> &rflag,
|
---|
98 | Array<Float> &weight ) ;
|
---|
99 | Int getDataChunk( Array<Complex> &spectra,
|
---|
100 | Array<Double> &direction,
|
---|
101 | Array<Int> &flagtra,
|
---|
102 | Array<Int> &rflag,
|
---|
103 | Array<Float> &weight ) ;
|
---|
104 | Int getDataChunk( Array<Float> &spectra,
|
---|
105 | Array<Double> &direction,
|
---|
106 | Array<uChar> &flagtra,
|
---|
107 | Array<uInt> &rflag,
|
---|
108 | Array<Float> &weight ) ;
|
---|
109 |
|
---|
110 | void getWeight( Array<Float> &w,
|
---|
111 | Array<Float> &tsys,
|
---|
112 | Array<Double> &tint ) ;
|
---|
113 |
|
---|
114 | void toInt( Array<uChar> &u, Array<Int> &v ) ;
|
---|
115 | void toInt( Array<uInt> &u, Array<Int> &v ) ;
|
---|
116 |
|
---|
117 | void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
|
---|
118 |
|
---|
119 | void boxFunc( Vector<Float> &convFunc, Int &convSize ) ;
|
---|
120 | void spheroidalFunc( Vector<Float> &convFunc ) ;
|
---|
121 | void gaussFunc( Vector<Float> &convFunc ) ;
|
---|
122 | void pbFunc( Vector<Float> &convFunc ) ;
|
---|
123 | void setConvFunc( Vector<Float> &convFunc ) ;
|
---|
124 |
|
---|
125 | Float polMean( const Float *p ) ;
|
---|
126 | Double polMean( const Double *p ) ;
|
---|
127 |
|
---|
128 | void prepareTable( Table &tab, String &name ) ;
|
---|
129 |
|
---|
130 | Bool pastEnd() ;
|
---|
131 |
|
---|
132 | void selectData() ;
|
---|
133 | void setupArray() ;
|
---|
134 | void sortData() ;
|
---|
135 |
|
---|
136 | Bool examine() ;
|
---|
137 | void attach() ;
|
---|
138 |
|
---|
139 |
|
---|
140 | String infile_ ;
|
---|
141 | Int ifno_ ;
|
---|
142 | Int nx_ ;
|
---|
143 | Int ny_ ;
|
---|
144 | Int npol_ ;
|
---|
145 | Int nchan_ ;
|
---|
146 | Int nrow_ ;
|
---|
147 | Double cellx_ ;
|
---|
148 | Double celly_ ;
|
---|
149 | Vector<Double> center_ ;
|
---|
150 | String convType_ ;
|
---|
151 | Int convSupport_ ;
|
---|
152 | Int userSupport_ ;
|
---|
153 | Int convSampling_ ;
|
---|
154 | Array<Float> data_ ;
|
---|
155 | Vector<uInt> pollist_ ;
|
---|
156 | Vector<uInt> scanlist_ ;
|
---|
157 | String wtype_ ;
|
---|
158 |
|
---|
159 | Table tab_ ;
|
---|
160 | ROArrayColumn<Float> spectraCol_ ;
|
---|
161 | ROArrayColumn<uChar> flagtraCol_ ;
|
---|
162 | ROArrayColumn<Double> directionCol_ ;
|
---|
163 | ROScalarColumn<uInt> flagRowCol_ ;
|
---|
164 | ROArrayColumn<Float> tsysCol_ ;
|
---|
165 | ROScalarColumn<Double> intervalCol_ ;
|
---|
166 | Int nprocessed_ ;
|
---|
167 | Vector<uInt> rows_ ;
|
---|
168 | Int nchunk_ ;
|
---|
169 | };
|
---|
170 | }
|
---|
171 | #endif
|
---|