source: branches/atnf/src/SDReader.h@ 86

Last change on this file since 86 was 2, checked in by mmarquar, 20 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
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
46class PKSreader;
47
48namespace atnf_sd {
49
50struct 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() {
66 cout << "Observer: " << this->observer << endl
67 << "Project: " << this->project << endl
68 << "Obstype: " << this->obstype << endl
69 << "Antenna: " << this->antennaname << endl
70 << "Ant. Position: " << this->antennaposition << endl
71 << "Equinox: " << this->equinox << endl
72 << "Freq. ref.: " << this->freqref << endl
73 << "Ref. frequency: " << this->reffreq << endl
74 << "Bandwidth: " << this->bandwidth << endl
75 << "Time (utc): " << setprecision(10) << this->utc << endl;
76 };
77};
78
79class SDReader {
80public:
81 SDReader();
82 SDReader(CountedPtr<SDMemTable> tbl);
83 virtual ~SDReader();
84
85 void open(const std::string& filename);
86 int read(const std::vector<int>& seq);
87
88 CountedPtr<SDMemTable> getTable() const { return table_;}
89
90 void reset();
91
92 std::vector<int> pseudoHeader() const {
93 std::vector<int> v;
94 v.push_back(nBeam_);v.push_back(nIF_);
95 v.push_back(nChan_);v.push_back(nPol_);
96 return v;
97 }
98
99protected:
100
101private:
102 Int nBeam_,nIF_,nChan_,nPol_;
103 Bool getHeader();
104 PKSreader* reader_;
105 SDHeader header_;
106 CountedPtr<SDMemTable> table_;
107 String filename_;
108 uInt cursor_;
109 Double timestamp_;
110};
111
112}// namespace
113#endif
114
Note: See TracBrowser for help on using the repository browser.