source: branches/parallel/src/MSFiller.h@ 2317

Last change on this file since 2317 was 2240, checked in by Takeshi Nakazato, 13 years ago

New Development: No

JIRA Issue: No

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...

Merge changes for speed up of MSFiller.
Revisions to be merged are r2217, r2219, r2221-2224, r2226, r2228,
r2231-2232, r2234, and r2237-2239.


File size: 7.2 KB
Line 
1//
2// C++ Interface: MSFiller
3//
4// Description:
5//
6// This class is specific filler for MS format
7//
8// Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2010
9//
10// Copyright: See COPYING file that comes with this distribution
11//
12//
13#ifndef ASAPMSFILLER_H
14#define ASAPMSFILLER_H
15
16// STL
17#include <string>
18
19// Boost
20#include <boost/pool/object_pool.hpp>
21
22// AIPS++
23#include <casa/aips.h>
24#include <casa/Utilities/CountedPtr.h>
25#include <casa/Arrays/Vector.h>
26#include <casa/Arrays/Matrix.h>
27#include <casa/Arrays/Cube.h>
28#include <casa/Logging/LogIO.h>
29
30#include <casa/Containers/Record.h>
31#include <casa/Containers/Block.h>
32
33//#include <tables/Tables/TableColumn.h>
34
35#include <ms/MeasurementSets/MeasurementSet.h>
36#include <ms/MeasurementSets/MSPointing.h>
37
38#include "Scantable.h"
39
40namespace asap
41{
42
43class MSFiller
44{
45public:
46 explicit MSFiller(casa::CountedPtr<Scantable> stable) ;
47 virtual ~MSFiller() ;
48
49 virtual bool open(const std::string& filename, const casa::Record& rec) ;
50 virtual void fill() ;
51 virtual void close() ;
52
53protected:
54
55
56private:
57
58 MSFiller();
59 MSFiller(const MSFiller&);
60 MSFiller& operator=(const MSFiller&);
61
62 // fill subtables
63 //void fillFrequencies() ;
64 //void fillMolecules() ;
65 void fillWeather() ;
66 void fillFocus() ;
67 //void fillHistory() ;
68 //void fillFit() ;
69 void fillTcal( boost::object_pool<casa::ROTableColumn> *poolr ) ;
70
71 // get SRCTYPE from STATE_ID
72 casa::Int getSrcType( casa::Int stateId, boost::object_pool<casa::ROTableColumn> *pool ) ;
73
74 // get POLNO from CORR_TYPE
75 casa::Block<casa::uInt> getPolNo( casa::Int corrType ) ;
76
77 // get poltype from CORR_TYPE
78 casa::String getPolType( casa::Int corrType ) ;
79
80 // get WEATHER_ID
81 casa::uInt getWeatherId( casa::uInt idx, casa::Double wtime ) ;
82
83 // get time stamp in SYSCAL table
84 // assume that tab is selected by ANTENNA_ID, FEED_ID, SPECTRAL_WINDOW_ID
85 // and sorted by TIME
86 void getSysCalTime( casa::Vector<casa::MEpoch> &scTimeIn, casa::Vector<casa::Double> &scInterval, casa::Block<casa::MEpoch> &tcol, casa::Block<casa::Int> &tidx ) ;
87
88 // get TCAL_ID
89 casa::Block<casa::uInt> getTcalId( casa::Int feedId, casa::Int spwId, casa::MEpoch &t ) ;
90
91 // get direction for DIRECTION, AZIMUTH, and ELEVATION columns
92 casa::uInt getDirection( casa::uInt idx,
93 casa::Vector<casa::Double> &dir,
94 casa::Vector<casa::Double> &srate,
95 casa::String &ref,
96 casa::ROScalarColumn<casa::Double> &ptcol,
97 casa::ROArrayColumn<casa::Double> &pdcol,
98 casa::Double t ) ;
99 casa::uInt getDirection( casa::uInt idx,
100 casa::Vector<casa::Double> &dir,
101 casa::Vector<casa::Double> &azel,
102 casa::Vector<casa::Double> &srate,
103 casa::ROScalarColumn<casa::Double> &ptcol,
104 casa::ROArrayColumn<casa::Double> &pdcol,
105 casa::MEpoch &t, casa::MPosition &antpos ) ;
106 void getSourceDirection( casa::Vector<casa::Double> &dir,
107 casa::Vector<casa::Double> &azel,
108 casa::Vector<casa::Double> &srate,
109 casa::MEpoch &t,
110 casa::MPosition &antpos,
111 casa::Vector<casa::MDirection> &srcdir ) ;
112
113 // create key for TCAL table
114 casa::String keyTcal( casa::Int feedid, casa::Int spwid, casa::String stime ) ;
115
116 // binary search
117 casa::uInt binarySearch( casa::Vector<casa::MEpoch> &timeList, casa::Double target ) ;
118 casa::uInt binarySearch( casa::Vector<casa::Double> &timeList, casa::Double target ) ;
119
120 // tool for HPC
121 double gettimeofday_sec() ;
122
123 // get frequency frame
124 std::string getFrame() ;
125
126 // reshape SPECTRA and FLAGTRA
127 void reshapeSpectraAndFlagtra( casa::Cube<casa::Float> &sp,
128 casa::Cube<casa::Bool> &fl,
129 casa::Table &tab,
130 casa::Int &npol,
131 casa::Int &nchan,
132 casa::Int &nrow,
133 casa::Vector<casa::Int> &corrtype ) ;
134
135 // initialize header
136 void initHeader( STHeader &header ) ;
137
138 // get value from table column using object pool
139 casa::String asString( casa::String name,
140 casa::uInt idx,
141 casa::Table tab,
142 boost::object_pool<casa::ROTableColumn> *pool ) ;
143 casa::Bool asBool( casa::String name,
144 casa::uInt idx,
145 casa::Table &tab,
146 boost::object_pool<casa::ROTableColumn> *pool ) ;
147 casa::Int asInt( casa::String name,
148 casa::uInt idx,
149 casa::Table &tab,
150 boost::object_pool<casa::ROTableColumn> *pool ) ;
151 casa::uInt asuInt( casa::String name,
152 casa::uInt idx,
153 casa::Table &tab,
154 boost::object_pool<casa::ROTableColumn> *pool ) ;
155 casa::Float asFloat( casa::String name,
156 casa::uInt idx,
157 casa::Table &tab,
158 boost::object_pool<casa::ROTableColumn> *pool ) ;
159 casa::Double asDouble( casa::String name,
160 casa::uInt idx,
161 casa::Table &tab,
162 boost::object_pool<casa::ROTableColumn> *pool ) ;
163
164 void sourceInfo( casa::Int sourceId,
165 casa::Int spwId,
166 casa::String &name,
167 casa::MDirection &direction,
168 casa::Vector<casa::Double> &properMotion,
169 casa::Vector<casa::Double> &restFreqs,
170 casa::Vector<casa::String> &transitions,
171 casa::Vector<casa::Double> &sysVels,
172 boost::object_pool<casa::ROTableColumn> *pool ) ;
173
174 void spectralSetup( casa::Int spwId,
175 casa::MEpoch &me,
176 casa::MPosition &mp,
177 casa::MDirection &md,
178 casa::Double &refpix,
179 casa::Double &refval,
180 casa::Double &increment,
181 casa::Int &nchan,
182 casa::String &freqref,
183 casa::Double &reffreq,
184 casa::Double &bandwidth,
185 boost::object_pool<casa::ROTableColumn> *pool ) ;
186
187 casa::CountedPtr<Scantable> table_ ;
188 casa::MeasurementSet mstable_ ;
189 casa::String tablename_ ;
190 casa::Int antenna_ ;
191 casa::String antennaStr_ ;
192 casa::Bool getPt_ ;
193
194 casa::Bool isFloatData_ ;
195 casa::Bool isData_ ;
196
197 casa::Bool isDoppler_ ;
198 casa::Bool isFlagCmd_ ;
199 casa::Bool isFreqOffset_ ;
200 casa::Bool isHistory_ ;
201 casa::Bool isProcessor_ ;
202 casa::Bool isSysCal_ ;
203 casa::Bool isWeather_ ;
204
205 casa::String colTsys_ ;
206 casa::String colTcal_ ;
207
208 casa::LogIO os_ ;
209
210 casa::Vector<casa::Double> mwTime_ ;
211 casa::Vector<casa::Double> mwInterval_ ;
212 casa::Vector<casa::uInt> mwIndex_ ;
213
214 // Record for TCAL_ID
215 // "FIELD0": "SPW0": Vector<uInt>
216 // "SPW1": Vector<uInt>
217 // ...
218 casa::Record tcalrec_ ;
219
220 //casa::ROTableColumn *scCol_ ;
221};
222
223
224};
225#endif
Note: See TracBrowser for help on using the repository browser.