[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 ) ; |
---|
| 43 | virtual ~STGrid() {} ; |
---|
| 44 | |
---|
| 45 | void setFileIn( const string infile ) ; |
---|
| 46 | |
---|
[2362] | 47 | void setIF( unsigned int ifno ) { ifno_ = ifno ; } ; |
---|
| 48 | |
---|
[2360] | 49 | void setPolList( vector<unsigned int> pols ) ; |
---|
| 50 | |
---|
[2364] | 51 | void setScanList( vector<unsigned int> scans ) ; |
---|
| 52 | |
---|
[2356] | 53 | void defineImage( int nx=-1, |
---|
| 54 | int ny=-1, |
---|
| 55 | string scellx="", |
---|
| 56 | string scelly="", |
---|
| 57 | string scenter="" ) ; |
---|
[2364] | 58 | void setFunc( string convtype="box", |
---|
| 59 | int convsupport=-1 ) ; |
---|
[2361] | 60 | |
---|
| 61 | void setWeight( const string wType="uniform" ) ; |
---|
| 62 | |
---|
[2356] | 63 | void grid() ; |
---|
| 64 | |
---|
| 65 | string saveData( string outfile="" ) ; |
---|
| 66 | |
---|
| 67 | private: |
---|
| 68 | void init() ; |
---|
| 69 | |
---|
[2382] | 70 | // actual gridding |
---|
| 71 | void gridPerRow() ; |
---|
| 72 | void gridPerPol() ; |
---|
| 73 | |
---|
[2356] | 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 ¢er ) ; |
---|
[2368] | 83 | |
---|
[2378] | 84 | void setData( Array<Complex> &gdata, |
---|
[2368] | 85 | Array<Float> &gwgt ) ; |
---|
[2356] | 86 | |
---|
[2382] | 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 ) ; |
---|
[2379] | 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 ) ; |
---|
[2356] | 107 | |
---|
[2375] | 108 | void getWeight( Array<Float> &w, |
---|
| 109 | Array<Float> &tsys, |
---|
| 110 | Array<Double> &tint ) ; |
---|
[2382] | 111 | |
---|
[2375] | 112 | void toInt( Array<uChar> &u, Array<Int> &v ) ; |
---|
| 113 | void toInt( Array<uInt> &u, Array<Int> &v ) ; |
---|
[2356] | 114 | |
---|
[2375] | 115 | void toPixel( Array<Double> &world, Array<Double> &pixel ) ; |
---|
[2356] | 116 | |
---|
| 117 | void boxFunc( Vector<Float> &convFunc, Int &convSize ) ; |
---|
| 118 | void spheroidalFunc( Vector<Float> &convFunc ) ; |
---|
| 119 | void gaussFunc( Vector<Float> &convFunc ) ; |
---|
| 120 | void pbFunc( Vector<Float> &convFunc ) ; |
---|
| 121 | void setConvFunc( Vector<Float> &convFunc ) ; |
---|
| 122 | |
---|
[2371] | 123 | void prepareTable( Table &tab, String &name ) ; |
---|
| 124 | |
---|
[2378] | 125 | Bool pastEnd() ; |
---|
| 126 | |
---|
[2379] | 127 | void selectData() ; |
---|
| 128 | void setupArray() ; |
---|
[2378] | 129 | |
---|
[2379] | 130 | Bool examine() ; |
---|
[2382] | 131 | void attach( Table &tab ) ; |
---|
[2379] | 132 | |
---|
[2384] | 133 | void call_ggridsd( Array<Double> &xy, |
---|
| 134 | Array<Complex> &values, |
---|
| 135 | Int &nvispol, |
---|
| 136 | Int &nvischan, |
---|
| 137 | Array<Int> &flag, |
---|
| 138 | Array<Int> &rflag, |
---|
| 139 | Array<Float> &weight, |
---|
| 140 | Int &nrow, |
---|
| 141 | Int &irow, |
---|
| 142 | Array<Complex> &grid, |
---|
| 143 | Array<Float> &wgrid, |
---|
| 144 | Int &nx, |
---|
| 145 | Int &ny, |
---|
| 146 | Int &npol, |
---|
| 147 | Int &nchan, |
---|
| 148 | Int &support, |
---|
| 149 | Int &sampling, |
---|
| 150 | Vector<Float> &convFunc, |
---|
[2381] | 151 | Int *chanMap, |
---|
| 152 | Int *polMap ) ; |
---|
[2379] | 153 | |
---|
[2382] | 154 | void initPol( Int ipol ) ; |
---|
[2386] | 155 | Bool isMultiIF( Table &tab ) ; |
---|
[2381] | 156 | |
---|
[2382] | 157 | |
---|
[2356] | 158 | String infile_ ; |
---|
[2362] | 159 | Int ifno_ ; |
---|
[2356] | 160 | Int nx_ ; |
---|
| 161 | Int ny_ ; |
---|
[2361] | 162 | Int npol_ ; |
---|
[2386] | 163 | Int npolOrg_ ; |
---|
[2361] | 164 | Int nchan_ ; |
---|
| 165 | Int nrow_ ; |
---|
[2356] | 166 | Double cellx_ ; |
---|
| 167 | Double celly_ ; |
---|
| 168 | Vector<Double> center_ ; |
---|
| 169 | String convType_ ; |
---|
| 170 | Int convSupport_ ; |
---|
| 171 | Int userSupport_ ; |
---|
| 172 | Int convSampling_ ; |
---|
| 173 | Array<Float> data_ ; |
---|
[2360] | 174 | Vector<uInt> pollist_ ; |
---|
[2364] | 175 | Vector<uInt> scanlist_ ; |
---|
[2361] | 176 | String wtype_ ; |
---|
[2356] | 177 | |
---|
| 178 | Table tab_ ; |
---|
[2382] | 179 | Table ptab_ ; |
---|
[2379] | 180 | ROArrayColumn<Float> spectraCol_ ; |
---|
| 181 | ROArrayColumn<uChar> flagtraCol_ ; |
---|
| 182 | ROArrayColumn<Double> directionCol_ ; |
---|
| 183 | ROScalarColumn<uInt> flagRowCol_ ; |
---|
| 184 | ROArrayColumn<Float> tsysCol_ ; |
---|
| 185 | ROScalarColumn<Double> intervalCol_ ; |
---|
| 186 | Int nprocessed_ ; |
---|
| 187 | Vector<uInt> rows_ ; |
---|
| 188 | Int nchunk_ ; |
---|
[2381] | 189 | |
---|
| 190 | Array<Float> spectraF_ ; |
---|
| 191 | Array<uChar> flagtraUC_ ; |
---|
| 192 | Array<uInt> rflagUI_ ; |
---|
| 193 | |
---|
[2356] | 194 | }; |
---|
| 195 | } |
---|
| 196 | #endif |
---|