[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>
|
---|
| 21 | #include <casa/Arrays/Vector.h>
|
---|
[2360] | 22 | #include <casa/Arrays/Matrix.h>
|
---|
| 23 | #include <casa/Arrays/Cube.h>
|
---|
[2356] | 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>
|
---|
[2379] | 31 | #include <tables/Tables/ScalarColumn.h>
|
---|
| 32 | #include <tables/Tables/ArrayColumn.h>
|
---|
[2356] | 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 |
|
---|
[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 |
|
---|
[2356] | 67 | void grid() ;
|
---|
[2379] | 68 | void gridAll() ;
|
---|
[2378] | 69 | void gridPerRow() ;
|
---|
[2356] | 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 ) ;
|
---|
[2368] | 85 |
|
---|
[2378] | 86 | void setData( Array<Complex> &gdata,
|
---|
[2368] | 87 | Array<Float> &gwgt ) ;
|
---|
[2356] | 88 |
|
---|
[2375] | 89 | void getData( Array<Complex> &spectra,
|
---|
| 90 | Array<Double> &direction,
|
---|
[2378] | 91 | Array<Int> &flagtra,
|
---|
| 92 | Array<Int> &rflag,
|
---|
[2375] | 93 | Array<Float> &weight ) ;
|
---|
| 94 | void getData( Array<Complex> &spectra,
|
---|
| 95 | Array<Double> &direction,
|
---|
[2378] | 96 | Array<uChar> &flagtra,
|
---|
| 97 | Array<uInt> &rflag,
|
---|
[2375] | 98 | Array<Float> &weight ) ;
|
---|
[2379] | 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 ) ;
|
---|
[2356] | 109 |
|
---|
[2375] | 110 | void getWeight( Array<Float> &w,
|
---|
| 111 | Array<Float> &tsys,
|
---|
| 112 | Array<Double> &tint ) ;
|
---|
[2361] | 113 |
|
---|
[2375] | 114 | void toInt( Array<uChar> &u, Array<Int> &v ) ;
|
---|
| 115 | void toInt( Array<uInt> &u, Array<Int> &v ) ;
|
---|
[2356] | 116 |
|
---|
[2375] | 117 | void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
|
---|
[2356] | 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 |
|
---|
[2369] | 125 | Float polMean( const Float *p ) ;
|
---|
| 126 | Double polMean( const Double *p ) ;
|
---|
| 127 |
|
---|
[2371] | 128 | void prepareTable( Table &tab, String &name ) ;
|
---|
| 129 |
|
---|
[2378] | 130 | Bool pastEnd() ;
|
---|
| 131 |
|
---|
[2379] | 132 | void selectData() ;
|
---|
| 133 | void setupArray() ;
|
---|
| 134 | void sortData() ;
|
---|
[2378] | 135 |
|
---|
[2379] | 136 | Bool examine() ;
|
---|
| 137 | void attach() ;
|
---|
| 138 |
|
---|
| 139 |
|
---|
[2356] | 140 | String infile_ ;
|
---|
[2362] | 141 | Int ifno_ ;
|
---|
[2356] | 142 | Int nx_ ;
|
---|
| 143 | Int ny_ ;
|
---|
[2361] | 144 | Int npol_ ;
|
---|
| 145 | Int nchan_ ;
|
---|
| 146 | Int nrow_ ;
|
---|
[2356] | 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_ ;
|
---|
[2360] | 155 | Vector<uInt> pollist_ ;
|
---|
[2364] | 156 | Vector<uInt> scanlist_ ;
|
---|
[2361] | 157 | String wtype_ ;
|
---|
[2356] | 158 |
|
---|
| 159 | Table tab_ ;
|
---|
[2379] | 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_ ;
|
---|
[2356] | 169 | };
|
---|
| 170 | }
|
---|
| 171 | #endif
|
---|