source: trunk/src/STGrid.h @ 2378

Last change on this file since 2378 was 2378, checked in by Takeshi Nakazato, 13 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...

Preparation for gridding per row.

Speed up setData() by sharing storage for data_ and gridding weight.


File size: 3.6 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/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
38using namespace std ;
39using namespace casa ;
40
41namespace asap {
42class STGrid
43{
44public:
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 gridPerRow() ;
69 
70  string saveData( string outfile="" ) ;
71
72private:
73  void init() ;
74
75  void setupGrid( Int &nx,
76                  Int &ny,
77                  String &cellx,
78                  String &celly,
79                  Double &xmin,
80                  Double &xmax,
81                  Double &ymin,
82                  Double &ymax,
83                  String &center ) ;
84
85  void setData( Array<Complex> &gdata,
86                Array<Float> &gwgt ) ;
87 
88  void getData( Array<Complex> &spectra,
89                Array<Double> &direction,
90                Array<Int> &flagtra,
91                Array<Int> &rflag,
92                Array<Float> &weight ) ;
93  void getData( Array<Complex> &spectra,
94                Array<Double> &direction,
95                Array<uChar> &flagtra,
96                Array<uInt> &rflag,
97                Array<Float> &weight ) ;
98  void getDataChunk( Array<Complex> &spectra,
99                     Array<Double> &direction,
100                     Array<Int> &flagtra,
101                     Array<Int> &rflag,
102                     Array<Float> &weight ) ;
103
104  void getWeight( Array<Float> &w,
105                  Array<Float> &tsys,
106                  Array<Double> &tint ) ;
107
108  void toInt( Array<uChar> &u, Array<Int> &v ) ;
109  void toInt( Array<uInt> &u, Array<Int> &v ) ;
110
111  void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
112 
113  void boxFunc( Vector<Float> &convFunc, Int &convSize ) ;
114  void spheroidalFunc( Vector<Float> &convFunc ) ;
115  void gaussFunc( Vector<Float> &convFunc ) ;
116  void pbFunc( Vector<Float> &convFunc ) ;
117  void setConvFunc( Vector<Float> &convFunc ) ;
118  void selectData( Table &tab ) ;
119
120  Float polMean( const Float *p ) ;
121  Double polMean( const Double *p ) ;
122
123  void setupArray( Table &tab ) ;
124
125  void prepareTable( Table &tab, String &name ) ;
126
127  Bool pastEnd() ;
128
129
130  String infile_ ;
131  Int ifno_ ;
132  Int nx_ ;
133  Int ny_ ;
134  Int npol_ ;
135  Int nchan_ ;
136  Int nrow_ ;
137  Double cellx_ ;
138  Double celly_ ;
139  Vector<Double> center_ ;
140  String convType_ ;
141  Int convSupport_ ;
142  Int userSupport_ ;
143  Int convSampling_ ;
144  Array<Float> data_ ;
145  Vector<uInt> pollist_ ;
146  Vector<uInt> scanlist_ ;
147  String wtype_ ;
148
149  Table tab_ ;
150  Int irow_ ;
151};
152}
153#endif
Note: See TracBrowser for help on using the repository browser.