source: branches/hpc34/external-alma/atnf/PKSIO/NROReader.h @ 2588

Last change on this file since 2588 was 2588, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: sdsave unit test

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Tuning NROReader.
Direction conversion (getDirection and getSourceDirection) is
optimized.


File size: 7.3 KB
Line 
1//#---------------------------------------------------------------------------
2//# NROReader.h: Base class to read NRO 45m and ASTE data.
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2000-2006
5//# Associated Universities, Inc. Washington DC, USA.
6//#
7//# This library is free software; you can redistribute it and/or modify it
8//# under the terms of the GNU Library General Public License as published by
9//# the Free Software Foundation; either version 2 of the License, or (at your
10//# option) any later version.
11//#
12//# This library is distributed in the hope that it will be useful, but WITHOUT
13//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14//# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
15//# License for more details.
16//#
17//# You should have received a copy of the GNU Library General Public License
18//# along with this library; if not, write to the Free Software Foundation,
19//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning AIPS++ should be addressed as follows:
22//#        Internet email: aips2-request@nrao.edu.
23//#        Postal address: AIPS++ Project Office
24//#                        National Radio Astronomy Observatory
25//#                        520 Edgemont Road
26//#                        Charlottesville, VA 22903-2475 USA
27//#
28//# $Id$
29//#---------------------------------------------------------------------------
30//# Original: 2008/10/30, Takeshi Nakazato, NAOJ
31//#---------------------------------------------------------------------------
32
33#ifndef NRO_READER_H
34#define NRO_READER_H
35
36#include <string>
37#include <stdio.h>
38#include <vector>
39
40#include <casa/aips.h>
41#include <casa/Arrays/Vector.h>
42#include <casa/BasicSL/String.h>
43#include <measures/Measures/MPosition.h>
44#include <measures/Measures/MCPosition.h>
45#include <measures/Measures/MDirection.h>
46#include <measures/Measures/MCDirection.h>
47#include <measures/Measures/MeasConvert.h>
48#include <measures/Measures/MeasFrame.h>
49#include <casa/Logging/LogIO.h>
50#include <casa/Utilities/CountedPtr.h>
51
52//#include <fitsio.h>
53
54#include <casa/namespace.h>
55
56#include <atnf/PKSIO/NRODataset.h>
57#include <atnf/PKSIO/NRODataRecord.h>
58
59using namespace std ;
60
61// <summary>
62// Base class to read NRO 45m and ASTE data.
63// </summary>
64// <use visibility=global>
65//
66// <prerequisite>
67//   <li> <linkto class=NRODataset>NRODataset</linkto>
68// </prerequisite>
69//
70// <reviewed reviewer="" date="" tests="" demos="">
71// </reviewed>
72//
73// <etymology>
74// <linkto class=NROReader>NROReader</linkto> is a base class for all NRO reader classes.
75// Reader classes have <linkto class=NRODataset>NRODataset</linkto> object to access
76// actual data. These classes are a kind of interface for Scantable data filler.
77// </etymology>
78//
79// <synopsis>
80// Abstract class that is designed as a base class for NRO reader classes.
81// </synopsis>
82//
83
84// Open an appropriate NROreader for a NRO 45m and ASTE dataset.
85class NROReader *getNROReader( const String filename,
86                               String &datatype );
87
88// As above, but search a list of directories for it.
89class NROReader *getNROReader( const String filename,
90                               const Vector<String> directories,
91                               int &iDir,
92                               String &datatype ) ;
93
94//
95// NROReader
96//
97class NROReader
98{
99 public:
100  // Constructor
101  NROReader( string name ) ;
102
103  // Destructor.
104  virtual ~NROReader() ;
105
106  // Read data header
107  virtual Int read() = 0 ;
108
109  // Get header information
110  virtual int getHeaderInfo( Int &nchan,
111                             Int &npol,
112                             Int &nif,
113                             Int &nbeam,
114                             String &observer,
115                             String &project,
116                             String &obstype,
117                             String &antname,
118                             Vector<Double> &antpos,
119                             Float &equinox,
120                             String &freqref,
121                             Double &reffreq,
122                             Double &bw,
123                             Double &utc,
124                             String &fluxunit,
125                             String &epoch,
126                             String &poltype ) ;
127                         
128  // Get scan information
129  virtual int getScanInfo( int irow,
130                           uInt &scanno,
131                           uInt &cycleno,
132                           uInt &ifno,
133                           uInt &beamno,
134                           uInt &polno,
135                           vector<double> &freqs,   
136                           Vector<Double> &restfreq, 
137                           uInt &refbeamno,
138                           Double &scantime,
139                           Double &interval,
140                           String &srcname,
141                           String &fieldname,
142                           Vector<Float> &spectra,
143                           Vector<uChar> &flagtra,
144                           Vector<Float> &tsys,
145                           Vector<Double> &direction,
146                           Float &azimuth,
147                           Float &elevation,
148                           Float &parangle,
149                           Float &opacity,
150                           uInt &tcalid,
151                           Int &fitid,
152                           uInt &focusid,
153                           Float &temperature, 
154                           Float &pressure,     
155                           Float &humidity,     
156                           Float &windvel,     
157                           Float &winddir,     
158                           Double &srcvel,
159                           Vector<Double> &propermotion,
160                           Vector<Double> &srcdir,
161                           Vector<Double> &scanrate ) ;
162
163  // Get scan type
164  virtual string getScanType( int i ) ;
165
166  // Get dataset
167  virtual NRODataset *getDataset() { return dataset_ ; } ;
168
169  // Get number of rows
170  virtual Int getRowNum() ;
171
172  // Get IF settings
173  virtual vector<Bool> getIFs() ;
174
175  // Get Number of IFs
176  virtual Int getNumIF() = 0 ;
177
178  // Get Beam settings
179  virtual vector<Bool> getBeams() ;
180
181  // Get Number of Beams
182  virtual Int getNumBeam() = 0 ;
183
184 protected:
185  // convert time in character representation to MJD representation
186  virtual double getMJD( char *time ) ;
187  virtual double getMJD( string strStartTime ) ;
188
189  // Get spectrum
190  virtual vector< vector<double> > getSpectrum() ;
191
192  // Get number of polarization
193  virtual Int getPolarizationNum() ;
194
195  // Get MJD time
196  virtual double getStartTime() ;
197  virtual double getEndTime() ;
198  virtual vector<double> getStartIntTime() ;
199  //virtual double getStartIntTime( int i ) ;
200
201  // Get Antenna Position in ITRF coordinate
202  virtual vector<double> getAntennaPosition() = 0 ;
203
204  // Get SRCDIRECTION in RADEC(J2000)
205  virtual Vector<Double> getSourceDirection() ;
206
207  // Get DIRECTION in RADEC(J2000)
208  virtual Vector<Double> getDirection( int i ) ;
209  virtual void initConvert( int icoord, double t, char *epoch ) ;
210
211  // filename
212  string filename_ ;
213
214  // dataset
215  NRODataset *dataset_ ;
216
217  // source direction
218  Vector<Double> srcdir_ ;
219  Vector<Double> msrcdir_ ;
220
221  // for direction conversion
222  CountedPtr<MDirection::Convert> converter_ ;
223  CountedPtr<MeasFrame> mf_ ;
224  int coord_ ;
225
226  // Logger
227  //LogIO os ;
228};
229
230#endif /* NRO_READER_H */
Note: See TracBrowser for help on using the repository browser.