1 | //#--------------------------------------------------------------------------- |
---|
2 | //# SDFITSreader.h: ATNF CFITSIO interface class for SDFITS input. |
---|
3 | //#--------------------------------------------------------------------------- |
---|
4 | //# Copyright (C) 2000-2008 |
---|
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: SDFITSreader.h,v 19.16 2008-11-17 06:47:05 cal103 Exp $ |
---|
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/MBrecord.h> |
---|
41 | |
---|
42 | #include <fitsio.h> |
---|
43 | |
---|
44 | using namespace std; |
---|
45 | |
---|
46 | // <summary> |
---|
47 | // ATNF class for SDFITS input using CFITSIO. |
---|
48 | // </summary> |
---|
49 | |
---|
50 | class SDFITSreader : public FITSreader |
---|
51 | { |
---|
52 | public: |
---|
53 | // Default constructor. |
---|
54 | SDFITSreader(); |
---|
55 | |
---|
56 | // Destructor. |
---|
57 | virtual ~SDFITSreader(); |
---|
58 | |
---|
59 | // Open an SDFITS file for reading. |
---|
60 | virtual int open( |
---|
61 | char* sdname, |
---|
62 | int &nBeam, |
---|
63 | int* &beams, |
---|
64 | int &nIF, |
---|
65 | int* &IFs, |
---|
66 | int* &nChan, |
---|
67 | int* &nPol, |
---|
68 | int* &haveXPol, |
---|
69 | int &haveBase, |
---|
70 | int &haveSpectra, |
---|
71 | int &extraSysCal); |
---|
72 | |
---|
73 | // Get parameters describing the data. |
---|
74 | virtual int getHeader( |
---|
75 | char observer[32], |
---|
76 | char project[32], |
---|
77 | char telescope[32], |
---|
78 | double antPos[3], |
---|
79 | char obsMode[32], |
---|
80 | char bunit[32], |
---|
81 | float &equinox, |
---|
82 | char radecsys[32], |
---|
83 | char dopplerFrame[32], |
---|
84 | char datobs[32], |
---|
85 | double &utc, |
---|
86 | double &refFreq, |
---|
87 | double &bandwidth); |
---|
88 | |
---|
89 | // Get frequency parameters for each IF. |
---|
90 | virtual int getFreqInfo( |
---|
91 | int &nIF, |
---|
92 | double* &startFreq, |
---|
93 | double* &endFreq); |
---|
94 | |
---|
95 | // Find the range of the data selected in time and position. |
---|
96 | virtual int findRange( |
---|
97 | int &nRow, |
---|
98 | int &nSel, |
---|
99 | char dateSpan[2][32], |
---|
100 | double utcSpan[2], |
---|
101 | double* &positions); |
---|
102 | |
---|
103 | // Read the next data record. |
---|
104 | virtual int read(MBrecord &record); |
---|
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 | // Message handling. |
---|
127 | virtual void logMsg(const char *msg = 0x0); |
---|
128 | |
---|
129 | void findData(int iData, char *name, int type); |
---|
130 | int readDim(int iData, long iRow, int *naxis, long naxes[]); |
---|
131 | int readParm(char *name, int type, void *value); |
---|
132 | int readData(char *name, int type, long iRow, void *value); |
---|
133 | int readData(int iData, long iRow, void *value); |
---|
134 | void findCol(char *name, int *colnum); |
---|
135 | |
---|
136 | // These are for ALFA data: "BDFITS" or "CIMAFITS". |
---|
137 | int cALFA, cALFA_BD, cALFA_CIMA, cALFAscan, cScanNo; |
---|
138 | float cALFAcal[8][2], cALFAcalOn[8][2], cALFAcalOff[8][2]; |
---|
139 | int alfaCal(short iBeam, short iIF, short iPol); |
---|
140 | |
---|
141 | // These are for GBT data. |
---|
142 | int cGBT, cFirstScanNo; |
---|
143 | }; |
---|
144 | |
---|
145 | #endif |
---|