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.6 2007/11/12 03:37:56 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/PKSMBrecord.h>
|
---|
41 |
|
---|
42 | // <summary>
|
---|
43 | // ATNF single-dish FITS reader.
|
---|
44 | // </summary>
|
---|
45 |
|
---|
46 | class FITSreader
|
---|
47 | {
|
---|
48 | public:
|
---|
49 | // Destructor.
|
---|
50 | virtual ~FITSreader() {};
|
---|
51 |
|
---|
52 | // Open the FITS file for reading. Returns a pointer, beams, to an array
|
---|
53 | // of length nBeam that indicates which beams are present in the data.
|
---|
54 | // Beam selection is done by zeroing the unwanted elements of this array.
|
---|
55 | // Likewise for IF selection (e.g. for frequency-switched data).
|
---|
56 | virtual int open(
|
---|
57 | char *FITSname,
|
---|
58 | int &nBeam,
|
---|
59 | int* &beams,
|
---|
60 | int &nIF,
|
---|
61 | int* &IFs,
|
---|
62 | int* &nChan,
|
---|
63 | int* &nPol,
|
---|
64 | int* &haveXPol,
|
---|
65 | int &haveBase,
|
---|
66 | int &haveSpectra,
|
---|
67 | int &extraSysCal) = 0;
|
---|
68 |
|
---|
69 | // Get metadata.
|
---|
70 | virtual int getHeader(
|
---|
71 | char observer[32],
|
---|
72 | char project[32],
|
---|
73 | char telescope[32],
|
---|
74 | double antPos[3],
|
---|
75 | char obsType[32],
|
---|
76 | char bunit[32],
|
---|
77 | float &equinox,
|
---|
78 | char radecsys[32],
|
---|
79 | char dopplerFrame[32],
|
---|
80 | char datobs[32],
|
---|
81 | double &utc,
|
---|
82 | double &refFreq,
|
---|
83 | double &bandwidth) = 0;
|
---|
84 |
|
---|
85 | // Get frequency parameters for each IF.
|
---|
86 | virtual int getFreqInfo(
|
---|
87 | int &nIF,
|
---|
88 | double* &startFreq,
|
---|
89 | double* &endFreq) = 0;
|
---|
90 |
|
---|
91 | // Set data selection criteria. Channel numbering is 1-relative, zero or
|
---|
92 | // negative channel numbers are taken to be offsets from the last channel.
|
---|
93 | int select(
|
---|
94 | const int startChan[],
|
---|
95 | const int endChan[],
|
---|
96 | const int refChan[],
|
---|
97 | const int getSpectra = 1,
|
---|
98 | const int getXPol = 0,
|
---|
99 | const int getFeedPos = 0);
|
---|
100 |
|
---|
101 | // Find the range in time and position of the data selected.
|
---|
102 | virtual int findRange(
|
---|
103 | int &nRow,
|
---|
104 | int &nSel,
|
---|
105 | char dateSpan[2][32],
|
---|
106 | double utcSpan[2],
|
---|
107 | double* &positions) = 0;
|
---|
108 |
|
---|
109 | // Read the next data record.
|
---|
110 | virtual int read(
|
---|
111 | PKSMBrecord &record) = 0;
|
---|
112 |
|
---|
113 | // Close the RPFITS file.
|
---|
114 | virtual void close(void) = 0;
|
---|
115 |
|
---|
116 | protected:
|
---|
117 | int *cBeams, *cEndChan, cGetFeedPos, cGetSpectra, cGetXPol, cHaveBase,
|
---|
118 | cHaveSpectra, *cHaveXPol, *cIFs, cNBeam, *cNChan, cNIF, *cNPol,
|
---|
119 | *cRefChan, *cStartChan;
|
---|
120 | };
|
---|
121 |
|
---|
122 | #endif
|
---|