source: trunk/src/MSFiller.h@ 2237

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

Refactoring MSFiller::fill() to detect bottle neck of the process.
There are no changes effectively.


File size: 6.5 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, casa::Vector<casa::Double> &dir, casa::Vector<casa::Double> &srate, casa::String &ref, casa::MSPointing &tab, casa::Double t ) ;
93 casa::uInt getDirection( casa::uInt idx, casa::Vector<casa::Double> &dir, casa::Vector<casa::Double> &azel, casa::Vector<casa::Double> &srate, casa::MSPointing &tab, casa::MEpoch &t, casa::MPosition &antpos ) ;
94 void getSourceDirection( casa::Vector<casa::Double> &dir, casa::Vector<casa::Double> &azel, casa::Vector<casa::Double> &srate, casa::MEpoch &t, casa::MPosition &antpos, casa::Vector<casa::MDirection> &srcdir ) ;
95
96 // create key for TCAL table
97 casa::String keyTcal( casa::Int feedid, casa::Int spwid, casa::String stime ) ;
98
99 // binary search
100 casa::uInt binarySearch( casa::Vector<casa::MEpoch> &timeList, casa::Double target ) ;
101
102 // tool for HPC
103 double gettimeofday_sec() ;
104
105 // get frequency frame
106 std::string getFrame() ;
107
108 // reshape SPECTRA and FLAGTRA
109 void reshapeSpectraAndFlagtra( casa::Cube<casa::Float> &sp,
110 casa::Cube<casa::Bool> &fl,
111 casa::Table &tab,
112 casa::Int &npol,
113 casa::Int &nchan,
114 casa::Int &nrow,
115 casa::Vector<casa::Int> &corrtype ) ;
116
117 // initialize header
118 void initHeader( STHeader &header ) ;
119
120 // get value from table column using object pool
121 casa::String asString( casa::String name,
122 casa::uInt idx,
123 casa::Table tab,
124 boost::object_pool<casa::ROTableColumn> *pool ) ;
125 casa::Bool asBool( casa::String name,
126 casa::uInt idx,
127 casa::Table &tab,
128 boost::object_pool<casa::ROTableColumn> *pool ) ;
129 casa::Int asInt( casa::String name,
130 casa::uInt idx,
131 casa::Table &tab,
132 boost::object_pool<casa::ROTableColumn> *pool ) ;
133 casa::uInt asuInt( casa::String name,
134 casa::uInt idx,
135 casa::Table &tab,
136 boost::object_pool<casa::ROTableColumn> *pool ) ;
137 casa::Float asFloat( casa::String name,
138 casa::uInt idx,
139 casa::Table &tab,
140 boost::object_pool<casa::ROTableColumn> *pool ) ;
141 casa::Double asDouble( casa::String name,
142 casa::uInt idx,
143 casa::Table &tab,
144 boost::object_pool<casa::ROTableColumn> *pool ) ;
145
146 void sourceInfo( casa::Int sourceId,
147 casa::Int spwId,
148 casa::String &name,
149 casa::MDirection &direction,
150 casa::Vector<casa::Double> &properMotion,
151 casa::Vector<casa::Double> &restFreqs,
152 casa::Vector<casa::String> &transitions,
153 casa::Vector<casa::Double> &sysVels,
154 boost::object_pool<casa::ROTableColumn> *pool ) ;
155
156 void spectralSetup( casa::Int spwId,
157 casa::MEpoch &me,
158 casa::MPosition &mp,
159 casa::MDirection &md,
160 casa::Double &refpix,
161 casa::Double &refval,
162 casa::Double &increment,
163 casa::Int &nchan,
164 casa::String &freqref,
165 casa::Double &reffreq,
166 casa::Double &bandwidth,
167 boost::object_pool<casa::ROTableColumn> *pool ) ;
168
169 casa::CountedPtr<Scantable> table_ ;
170 casa::MeasurementSet mstable_ ;
171 casa::String tablename_ ;
172 casa::Int antenna_ ;
173 casa::String antennaStr_ ;
174 casa::Bool getPt_ ;
175
176 casa::Bool isFloatData_ ;
177 casa::Bool isData_ ;
178
179 casa::Bool isDoppler_ ;
180 casa::Bool isFlagCmd_ ;
181 casa::Bool isFreqOffset_ ;
182 casa::Bool isHistory_ ;
183 casa::Bool isProcessor_ ;
184 casa::Bool isSysCal_ ;
185 casa::Bool isWeather_ ;
186
187 casa::String colTsys_ ;
188 casa::String colTcal_ ;
189
190 casa::LogIO os_ ;
191
192 casa::Vector<casa::Double> mwTime_ ;
193 casa::Vector<casa::Double> mwInterval_ ;
194 casa::Vector<casa::uInt> mwIndex_ ;
195
196 // Record for TCAL_ID
197 // "FIELD0": "SPW0": Vector<uInt>
198 // "SPW1": Vector<uInt>
199 // ...
200 casa::Record tcalrec_ ;
201
202 //casa::ROTableColumn *scCol_ ;
203};
204
205
206};
207#endif
Note: See TracBrowser for help on using the repository browser.