1 | //#---------------------------------------------------------------------------
|
---|
2 | //# SDFITSreader.h: ATNF CFITSIO interface class for SDFITS input.
|
---|
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 this software 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 | //# The SDFITSreader class reads single dish FITS files such as those written
|
---|
31 | //# by SDFITSwriter containing Parkes Multibeam data.
|
---|
32 | //#
|
---|
33 | //# Original: 2000/08/09, Mark Calabretta, ATNF
|
---|
34 | //#---------------------------------------------------------------------------
|
---|
35 |
|
---|
36 | #ifndef ATNF_SDFITSREADER_H
|
---|
37 | #define ATNF_SDFITSREADER_H
|
---|
38 |
|
---|
39 | #include <atnf/PKSIO/FITSreader.h>
|
---|
40 | #include <atnf/PKSIO/PKSMBrecord.h>
|
---|
41 |
|
---|
42 | #include <fitsio.h>
|
---|
43 |
|
---|
44 | // <summary>
|
---|
45 | // ATNF class for SDFITS input using CFITSIO.
|
---|
46 | // </summary>
|
---|
47 |
|
---|
48 | class SDFITSreader : public FITSreader
|
---|
49 | {
|
---|
50 | public:
|
---|
51 | // Default constructor.
|
---|
52 | SDFITSreader();
|
---|
53 |
|
---|
54 | // Destructor.
|
---|
55 | virtual ~SDFITSreader();
|
---|
56 |
|
---|
57 | // Open an SDFITS file for reading.
|
---|
58 | virtual int open(
|
---|
59 | char* sdname,
|
---|
60 | int &nBeam,
|
---|
61 | int* &beams,
|
---|
62 | int &nIF,
|
---|
63 | int* &IFs,
|
---|
64 | int* &nChan,
|
---|
65 | int* &nPol,
|
---|
66 | int* &haveXPol,
|
---|
67 | int &haveBase,
|
---|
68 | int &haveSpectra,
|
---|
69 | int &extraSysCal);
|
---|
70 |
|
---|
71 | // Get parameters describing the data.
|
---|
72 | virtual int getHeader(
|
---|
73 | char observer[32],
|
---|
74 | char project[32],
|
---|
75 | char telescope[32],
|
---|
76 | double antPos[3],
|
---|
77 | char obsMode[32],
|
---|
78 | float &equinox,
|
---|
79 | char radecsys[32],
|
---|
80 | char dopplerFrame[32],
|
---|
81 | char datobs[32],
|
---|
82 | double &utc,
|
---|
83 | double &refFreq,
|
---|
84 | double &bandwidth);
|
---|
85 |
|
---|
86 | // Get frequency parameters for each IF.
|
---|
87 | virtual int getFreqInfo(
|
---|
88 | int &nIF,
|
---|
89 | double* &startFreq,
|
---|
90 | double* &endFreq);
|
---|
91 |
|
---|
92 | // Find the range of the data selected in time and position.
|
---|
93 | virtual int findRange(
|
---|
94 | int &nRow,
|
---|
95 | int &nSel,
|
---|
96 | char dateSpan[2][32],
|
---|
97 | double utcSpan[2],
|
---|
98 | double* &positions);
|
---|
99 |
|
---|
100 | // Read the next data record.
|
---|
101 | virtual int read(PKSMBrecord &record);
|
---|
102 |
|
---|
103 | // Print out CFITSIO error messages.
|
---|
104 | void reportError(void);
|
---|
105 |
|
---|
106 | // Close the SDFITS file.
|
---|
107 | virtual void close(void);
|
---|
108 |
|
---|
109 | private:
|
---|
110 | int cCycleNo, cExtraSysCal, cNAxis, cStatus;
|
---|
111 | long cNAxes[5], cNRow, cReqax[4], cRow;
|
---|
112 | double cLastUTC;
|
---|
113 | fitsfile *cSDptr;
|
---|
114 | class FITSparm *cData;
|
---|
115 |
|
---|
116 | // These are to differentiate 0-, and 1-relative beam and IF numbering.
|
---|
117 | int cBeam_1rel, cIF_1rel;
|
---|
118 |
|
---|
119 | enum {SCAN, CYCLE, DATE_OBS, TIME, EXPOSURE, OBJECT, OBJ_RA, OBJ_DEC,
|
---|
120 | RESTFRQ, OBSMODE, BEAM, IF, FqRefPix, FqRefVal, FqDelt, RA, DEC,
|
---|
121 | SCANRATE, TSYS, CALFCTR, XCALFCTR, BASELIN, BASESUB, DATA, FLAGGED,
|
---|
122 | DATAXED, XPOLDATA, REFBEAM, TCAL, TCALTIME, AZIMUTH, ELEVATIO,
|
---|
123 | PARANGLE, FOCUSAXI, FOCUSTAN, FOCUSROT, TAMBIENT, PRESSURE,
|
---|
124 | HUMIDITY, WINDSPEE, WINDDIRE, NDATA};
|
---|
125 |
|
---|
126 | void findData(int iData, char *name, int type);
|
---|
127 | int readDim(int iData, long iRow, int *naxis, long naxes[]);
|
---|
128 | int readParm(char *name, int type, void *value);
|
---|
129 | int readData(char *name, int type, long iRow, void *value);
|
---|
130 | int readData(int iData, long iRow, void *value);
|
---|
131 | void findCol(char *name, int *colnum);
|
---|
132 |
|
---|
133 | // These are for ALFA data, "BDFITS" or "CIMAFITS".
|
---|
134 | int cALFA, cALFA_BD, cALFA_CIMA, cALFAscan, cScanNo;
|
---|
135 | float cALFAcal[8][2], cALFAcalOn[8][2], cALFAcalOff[8][2];
|
---|
136 | int alfaCal(short iBeam, short iIF);
|
---|
137 |
|
---|
138 | // These are for GBT data.
|
---|
139 | int cGBT, cFirstScanNo;
|
---|
140 | };
|
---|
141 |
|
---|
142 | #endif
|
---|