1 | //#---------------------------------------------------------------------------
|
---|
2 | //# FITSreader.h: ATNF single-dish FITS reader.
|
---|
3 | //#---------------------------------------------------------------------------
|
---|
4 | //# Copyright (C) 2000-2007
|
---|
5 | //# Mark Calabretta, ATNF
|
---|
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 this software should be addressed as follows:
|
---|
22 | //# Internet email: mcalabre@atnf.csiro.au.
|
---|
23 | //# Postal address: Dr. Mark Calabretta,
|
---|
24 | //# Australia Telescope National Facility,
|
---|
25 | //# P.O. Box 76,
|
---|
26 | //# Epping, NSW, 2121,
|
---|
27 | //# AUSTRALIA
|
---|
28 | //#
|
---|
29 | //# $Id: FITSreader.h,v 19.9 2008-11-17 06:28:04 cal103 Exp $
|
---|
30 | //#---------------------------------------------------------------------------
|
---|
31 | //# The FITSreader class is an abstract base class for the Parkes Multibeam
|
---|
32 | //# RPFITS and SDFITS readers.
|
---|
33 | //#
|
---|
34 | //# Original: 2000/08/14 Mark Calabretta
|
---|
35 | //#---------------------------------------------------------------------------
|
---|
36 |
|
---|
37 | #ifndef ATNF_FITSREADER_H
|
---|
38 | #define ATNF_FITSREADER_H
|
---|
39 |
|
---|
40 | #include <atnf/PKSIO/MBrecord.h>
|
---|
41 | #include <atnf/PKSIO/PKSmsg.h>
|
---|
42 |
|
---|
43 | using namespace std;
|
---|
44 |
|
---|
45 | // <summary>
|
---|
46 | // ATNF single-dish FITS reader.
|
---|
47 | // </summary>
|
---|
48 |
|
---|
49 | class FITSreader : public PKSmsg
|
---|
50 | {
|
---|
51 | public:
|
---|
52 | // Destructor.
|
---|
53 | virtual ~FITSreader() {};
|
---|
54 |
|
---|
55 | // Open the FITS file for reading. Returns a pointer, beams, to an array
|
---|
56 | // of length nBeam that indicates which beams are present in the data.
|
---|
57 | // Beam selection is done by zeroing the unwanted elements of this array.
|
---|
58 | // Likewise for IF selection (e.g. for frequency-switched data).
|
---|
59 | virtual int open(
|
---|
60 | char *FITSname,
|
---|
61 | int &nBeam,
|
---|
62 | int* &beams,
|
---|
63 | int &nIF,
|
---|
64 | int* &IFs,
|
---|
65 | int* &nChan,
|
---|
66 | int* &nPol,
|
---|
67 | int* &haveXPol,
|
---|
68 | int &haveBase,
|
---|
69 | int &haveSpectra,
|
---|
70 | int &extraSysCal) = 0;
|
---|
71 |
|
---|
72 | // Get metadata.
|
---|
73 | virtual int getHeader(
|
---|
74 | char observer[32],
|
---|
75 | char project[32],
|
---|
76 | char telescope[32],
|
---|
77 | double antPos[3],
|
---|
78 | char obsType[32],
|
---|
79 | char bunit[32],
|
---|
80 | float &equinox,
|
---|
81 | char radecsys[32],
|
---|
82 | char dopplerFrame[32],
|
---|
83 | char datobs[32],
|
---|
84 | double &utc,
|
---|
85 | double &refFreq,
|
---|
86 | double &bandwidth) = 0;
|
---|
87 |
|
---|
88 | // Get frequency parameters for each IF.
|
---|
89 | virtual int getFreqInfo(
|
---|
90 | int &nIF,
|
---|
91 | double* &startFreq,
|
---|
92 | double* &endFreq) = 0;
|
---|
93 |
|
---|
94 | // Set data selection criteria. Channel numbering is 1-relative, zero or
|
---|
95 | // negative channel numbers are taken to be offsets from the last channel.
|
---|
96 | // Coordinate systems are
|
---|
97 | // 0: equatorial (RA,Dec),
|
---|
98 | // 1: vertical (Az,El),
|
---|
99 | // 2: feed-plane.
|
---|
100 | int select(
|
---|
101 | const int startChan[],
|
---|
102 | const int endChan[],
|
---|
103 | const int refChan[],
|
---|
104 | const int getSpectra = 1,
|
---|
105 | const int getXPol = 0,
|
---|
106 | const int coordSys = 0);
|
---|
107 |
|
---|
108 | // Find the range in time and position of the data selected.
|
---|
109 | virtual int findRange(
|
---|
110 | int &nRow,
|
---|
111 | int &nSel,
|
---|
112 | char dateSpan[2][32],
|
---|
113 | double utcSpan[2],
|
---|
114 | double* &positions) = 0;
|
---|
115 |
|
---|
116 | // Read the next data record.
|
---|
117 | virtual int read(
|
---|
118 | MBrecord &record) = 0;
|
---|
119 |
|
---|
120 | // Close the RPFITS file.
|
---|
121 | virtual void close(void) = 0;
|
---|
122 |
|
---|
123 | protected:
|
---|
124 | int *cBeams, *cEndChan, cCoordSys, cGetSpectra, cGetXPol, cHaveBase,
|
---|
125 | cHaveSpectra, *cHaveXPol, *cIFs, cNBeam, *cNChan, cNIF, *cNPol,
|
---|
126 | *cRefChan, *cStartChan;
|
---|
127 |
|
---|
128 | // For use in constructing messages.
|
---|
129 | char cMsg[256];
|
---|
130 | };
|
---|
131 |
|
---|
132 | #endif
|
---|