[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> |
---|
[2381] | 28 | //#include <tables/Tables/TableRow.h> |
---|
[2356] | 29 | |
---|
| 30 | // #include <measures/Measures/MDirection.h> |
---|
| 31 | |
---|
| 32 | // #include "Scantable.h" |
---|
| 33 | |
---|
| 34 | using namespace std ; |
---|
| 35 | using namespace casa ; |
---|
| 36 | |
---|
| 37 | namespace asap { |
---|
| 38 | class STGrid |
---|
| 39 | { |
---|
| 40 | public: |
---|
| 41 | STGrid() ; |
---|
| 42 | STGrid( const string infile ) ; |
---|
[2390] | 43 | STGrid( const vector<string> infile ) ; |
---|
[2356] | 44 | virtual ~STGrid() {} ; |
---|
| 45 | |
---|
| 46 | void setFileIn( const string infile ) ; |
---|
[2390] | 47 | void setFileList( const vector<string> infile ) ; |
---|
[2356] | 48 | |
---|
[2362] | 49 | void setIF( unsigned int ifno ) { ifno_ = ifno ; } ; |
---|
| 50 | |
---|
[2360] | 51 | void setPolList( vector<unsigned int> pols ) ; |
---|
| 52 | |
---|
[2364] | 53 | void setScanList( vector<unsigned int> scans ) ; |
---|
| 54 | |
---|
[2356] | 55 | void defineImage( int nx=-1, |
---|
| 56 | int ny=-1, |
---|
| 57 | string scellx="", |
---|
| 58 | string scelly="", |
---|
| 59 | string scenter="" ) ; |
---|
[2364] | 60 | void setFunc( string convtype="box", |
---|
| 61 | int convsupport=-1 ) ; |
---|
[2361] | 62 | |
---|
| 63 | void setWeight( const string wType="uniform" ) ; |
---|
| 64 | |
---|
[2356] | 65 | void grid() ; |
---|
| 66 | |
---|
| 67 | string saveData( string outfile="" ) ; |
---|
| 68 | |
---|
| 69 | private: |
---|
| 70 | void init() ; |
---|
| 71 | |
---|
[2382] | 72 | // actual gridding |
---|
| 73 | void gridPerRow() ; |
---|
| 74 | void gridPerPol() ; |
---|
| 75 | |
---|
[2388] | 76 | void setupGrid() ; |
---|
[2356] | 77 | void setupGrid( Int &nx, |
---|
| 78 | Int &ny, |
---|
| 79 | String &cellx, |
---|
| 80 | String &celly, |
---|
| 81 | Double &xmin, |
---|
| 82 | Double &xmax, |
---|
| 83 | Double &ymin, |
---|
| 84 | Double &ymax, |
---|
| 85 | String ¢er ) ; |
---|
[2388] | 86 | void mapExtent( Double &xmin, Double &xmax, |
---|
| 87 | Double &ymin, Double &ymax ) ; |
---|
[2368] | 88 | |
---|
[2378] | 89 | void setData( Array<Complex> &gdata, |
---|
[2368] | 90 | Array<Float> &gwgt ) ; |
---|
[2356] | 91 | |
---|
[2382] | 92 | void getDataPerPol( Array<Complex> &spectra, |
---|
| 93 | Array<Double> &direction, |
---|
| 94 | Array<Int> &flagtra, |
---|
| 95 | Array<Int> &rflag, |
---|
| 96 | Array<Float> &weight ) ; |
---|
| 97 | void getDataPerPol( Array<Float> &spectra, |
---|
| 98 | Array<Double> &direction, |
---|
| 99 | Array<uChar> &flagtra, |
---|
| 100 | Array<uInt> &rflag, |
---|
| 101 | Array<Float> &weight ) ; |
---|
[2379] | 102 | Int getDataChunk( Array<Complex> &spectra, |
---|
| 103 | Array<Double> &direction, |
---|
| 104 | Array<Int> &flagtra, |
---|
| 105 | Array<Int> &rflag, |
---|
| 106 | Array<Float> &weight ) ; |
---|
| 107 | Int getDataChunk( Array<Float> &spectra, |
---|
| 108 | Array<Double> &direction, |
---|
| 109 | Array<uChar> &flagtra, |
---|
| 110 | Array<uInt> &rflag, |
---|
| 111 | Array<Float> &weight ) ; |
---|
[2356] | 112 | |
---|
[2375] | 113 | void getWeight( Array<Float> &w, |
---|
| 114 | Array<Float> &tsys, |
---|
| 115 | Array<Double> &tint ) ; |
---|
[2382] | 116 | |
---|
[2375] | 117 | void toInt( Array<uChar> &u, Array<Int> &v ) ; |
---|
| 118 | void toInt( Array<uInt> &u, Array<Int> &v ) ; |
---|
[2356] | 119 | |
---|
[2375] | 120 | void toPixel( Array<Double> &world, Array<Double> &pixel ) ; |
---|
[2356] | 121 | |
---|
| 122 | void boxFunc( Vector<Float> &convFunc, Int &convSize ) ; |
---|
| 123 | void spheroidalFunc( Vector<Float> &convFunc ) ; |
---|
| 124 | void gaussFunc( Vector<Float> &convFunc ) ; |
---|
| 125 | void pbFunc( Vector<Float> &convFunc ) ; |
---|
| 126 | void setConvFunc( Vector<Float> &convFunc ) ; |
---|
| 127 | |
---|
[2371] | 128 | void prepareTable( Table &tab, String &name ) ; |
---|
| 129 | |
---|
[2378] | 130 | Bool pastEnd() ; |
---|
| 131 | |
---|
[2379] | 132 | void selectData() ; |
---|
| 133 | void setupArray() ; |
---|
[2378] | 134 | |
---|
[2379] | 135 | Bool examine() ; |
---|
[2382] | 136 | void attach( Table &tab ) ; |
---|
[2379] | 137 | |
---|
[2384] | 138 | void call_ggridsd( Array<Double> &xy, |
---|
| 139 | Array<Complex> &values, |
---|
| 140 | Int &nvispol, |
---|
| 141 | Int &nvischan, |
---|
| 142 | Array<Int> &flag, |
---|
| 143 | Array<Int> &rflag, |
---|
| 144 | Array<Float> &weight, |
---|
| 145 | Int &nrow, |
---|
| 146 | Int &irow, |
---|
| 147 | Array<Complex> &grid, |
---|
| 148 | Array<Float> &wgrid, |
---|
| 149 | Int &nx, |
---|
| 150 | Int &ny, |
---|
| 151 | Int &npol, |
---|
| 152 | Int &nchan, |
---|
| 153 | Int &support, |
---|
| 154 | Int &sampling, |
---|
| 155 | Vector<Float> &convFunc, |
---|
[2381] | 156 | Int *chanMap, |
---|
| 157 | Int *polMap ) ; |
---|
[2379] | 158 | |
---|
[2382] | 159 | void initPol( Int ipol ) ; |
---|
[2390] | 160 | void initTable( uInt idx ) ; |
---|
[2386] | 161 | Bool isMultiIF( Table &tab ) ; |
---|
[2381] | 162 | |
---|
[2382] | 163 | |
---|
[2388] | 164 | // user input |
---|
| 165 | Int nxUI_ ; |
---|
| 166 | Int nyUI_ ; |
---|
| 167 | String cellxUI_ ; |
---|
| 168 | String cellyUI_ ; |
---|
| 169 | String centerUI_ ; |
---|
| 170 | |
---|
[2389] | 171 | Block<String> infileList_ ; |
---|
[2390] | 172 | uInt nfile_ ; |
---|
[2362] | 173 | Int ifno_ ; |
---|
[2356] | 174 | Int nx_ ; |
---|
| 175 | Int ny_ ; |
---|
[2361] | 176 | Int npol_ ; |
---|
[2386] | 177 | Int npolOrg_ ; |
---|
[2361] | 178 | Int nchan_ ; |
---|
| 179 | Int nrow_ ; |
---|
[2390] | 180 | Block<Int> rows_ ; |
---|
[2356] | 181 | Double cellx_ ; |
---|
| 182 | Double celly_ ; |
---|
| 183 | Vector<Double> center_ ; |
---|
| 184 | String convType_ ; |
---|
| 185 | Int convSupport_ ; |
---|
| 186 | Int userSupport_ ; |
---|
| 187 | Int convSampling_ ; |
---|
| 188 | Array<Float> data_ ; |
---|
[2360] | 189 | Vector<uInt> pollist_ ; |
---|
[2364] | 190 | Vector<uInt> scanlist_ ; |
---|
[2361] | 191 | String wtype_ ; |
---|
[2356] | 192 | |
---|
| 193 | Table tab_ ; |
---|
[2389] | 194 | Block<Table> tableList_ ; |
---|
[2382] | 195 | Table ptab_ ; |
---|
[2379] | 196 | ROArrayColumn<Float> spectraCol_ ; |
---|
| 197 | ROArrayColumn<uChar> flagtraCol_ ; |
---|
| 198 | ROArrayColumn<Double> directionCol_ ; |
---|
| 199 | ROScalarColumn<uInt> flagRowCol_ ; |
---|
| 200 | ROArrayColumn<Float> tsysCol_ ; |
---|
| 201 | ROScalarColumn<Double> intervalCol_ ; |
---|
| 202 | Int nprocessed_ ; |
---|
| 203 | Int nchunk_ ; |
---|
[2381] | 204 | |
---|
| 205 | Array<Float> spectraF_ ; |
---|
| 206 | Array<uChar> flagtraUC_ ; |
---|
| 207 | Array<uInt> rflagUI_ ; |
---|
| 208 | |
---|
[2356] | 209 | }; |
---|
| 210 | } |
---|
| 211 | #endif |
---|