1 | //#---------------------------------------------------------------------------
|
---|
2 | //# SDReader.h: A class to read single dish spectra from SDFITS, RPFITS
|
---|
3 | //#---------------------------------------------------------------------------
|
---|
4 | //# Copyright (C) 2004
|
---|
5 | //# Malte Marquarding, ATNF
|
---|
6 | //#
|
---|
7 | //# This program is free software; you can redistribute it and/or modify it
|
---|
8 | //# under the terms of the GNU General Public License as published by the Free
|
---|
9 | //# Software Foundation; either version 2 of the License, or (at your option)
|
---|
10 | //# any later version.
|
---|
11 | //#
|
---|
12 | //# This program is distributed in the hope that it will be useful, but
|
---|
13 | //# WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
---|
15 | //# Public License for more details.
|
---|
16 | //#
|
---|
17 | //# You should have received a copy of the GNU General Public License along
|
---|
18 | //# with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
19 | //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
|
---|
20 | //#
|
---|
21 | //# Correspondence concerning this software should be addressed as follows:
|
---|
22 | //# Internet email: Malte.Marquarding@csiro.au
|
---|
23 | //# Postal address: Malte Marquarding,
|
---|
24 | //# Australia Telescope National Facility,
|
---|
25 | //# P.O. Box 76,
|
---|
26 | //# Epping, NSW, 2121,
|
---|
27 | //# AUSTRALIA
|
---|
28 | //#
|
---|
29 | //# $Id:
|
---|
30 | //#---------------------------------------------------------------------------
|
---|
31 | #ifndef _SDREADER_H_
|
---|
32 | #define _SDREADER_H_
|
---|
33 |
|
---|
34 | #include <vector>
|
---|
35 | #include <string>
|
---|
36 |
|
---|
37 | #include <aips/aips.h>
|
---|
38 | #include <aips/iostream.h>
|
---|
39 | #include <aips/iomanip.h>
|
---|
40 | #include <aips/Utilities/CountedPtr.h>
|
---|
41 | #include <aips/Utilities/String.h>
|
---|
42 | #include <aips/Arrays/Vector.h>
|
---|
43 |
|
---|
44 | #include "SDMemTable.h"
|
---|
45 |
|
---|
46 | class PKSreader;
|
---|
47 |
|
---|
48 | namespace atnf_sd {
|
---|
49 |
|
---|
50 | struct SDHeader {
|
---|
51 | Int nchan;
|
---|
52 | Int npol;
|
---|
53 | Int nif;
|
---|
54 | Int nbeam;
|
---|
55 | String observer;
|
---|
56 | String project;
|
---|
57 | String obstype;
|
---|
58 | String antennaname;
|
---|
59 | Vector<Double> antennaposition;
|
---|
60 | Float equinox;
|
---|
61 | String freqref;
|
---|
62 | Double reffreq;
|
---|
63 | Double bandwidth;
|
---|
64 | Double utc;
|
---|
65 | void print() const ;
|
---|
66 | };
|
---|
67 |
|
---|
68 | class SDReader {
|
---|
69 | public:
|
---|
70 | SDReader();
|
---|
71 | SDReader(CountedPtr<SDMemTable> tbl);
|
---|
72 | virtual ~SDReader();
|
---|
73 |
|
---|
74 | void open(const std::string& filename);
|
---|
75 | int read(const std::vector<int>& seq);
|
---|
76 |
|
---|
77 | CountedPtr<SDMemTable> getTable() const { return table_;}
|
---|
78 |
|
---|
79 | void reset();
|
---|
80 |
|
---|
81 | std::vector<int> pseudoHeader() const {
|
---|
82 | std::vector<int> v;
|
---|
83 | v.push_back(nBeam_);v.push_back(nIF_);
|
---|
84 | v.push_back(nChan_);v.push_back(nPol_);
|
---|
85 | return v;
|
---|
86 | }
|
---|
87 |
|
---|
88 | protected:
|
---|
89 |
|
---|
90 | private:
|
---|
91 | Int nBeam_,nIF_,nPol_,nChan_;
|
---|
92 | Bool getHeader();
|
---|
93 | PKSreader* reader_;
|
---|
94 | SDHeader header_;
|
---|
95 | CountedPtr<SDMemTable> table_;
|
---|
96 | String filename_;
|
---|
97 | uInt cursor_;
|
---|
98 | Double timestamp_;
|
---|
99 | };
|
---|
100 |
|
---|
101 | }// namespace
|
---|
102 | #endif
|
---|
103 |
|
---|