[1325] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# SDFITSreader.h: ATNF CFITSIO interface class for SDFITS input.
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
[1635] | 4 | //# Copyright (C) 2000-2009
|
---|
[1325] | 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 | //#
|
---|
[1635] | 28 | //# $Id: SDFITSreader.h,v 19.21 2009-03-18 07:11:51 cal103 Exp $
|
---|
[1325] | 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>
|
---|
[1452] | 40 | #include <atnf/PKSIO/MBrecord.h>
|
---|
[1325] | 41 |
|
---|
| 42 | #include <fitsio.h>
|
---|
| 43 |
|
---|
[1452] | 44 | using namespace std;
|
---|
| 45 |
|
---|
[1325] | 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],
|
---|
[1399] | 80 | char bunit[32],
|
---|
[1325] | 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.
|
---|
[1452] | 104 | virtual int read(MBrecord &record);
|
---|
[1325] | 105 |
|
---|
| 106 | // Close the SDFITS file.
|
---|
| 107 | virtual void close(void);
|
---|
| 108 |
|
---|
| 109 | private:
|
---|
[1635] | 110 | int cCycleNo, cExtraSysCal, cNAxes, cStatus;
|
---|
| 111 | long cBeamAxis, cDecAxis, cFreqAxis, cNAxis[5], cNAxisTime, cNRow,
|
---|
| 112 | cRaAxis, cRow, cStokesAxis, cTimeAxis, cTimeIdx;
|
---|
[1325] | 113 | double cLastUTC;
|
---|
| 114 | fitsfile *cSDptr;
|
---|
| 115 | class FITSparm *cData;
|
---|
| 116 |
|
---|
| 117 | // These are to differentiate 0-, and 1-relative beam and IF numbering.
|
---|
| 118 | int cBeam_1rel, cIF_1rel;
|
---|
| 119 |
|
---|
| 120 | enum {SCAN, CYCLE, DATE_OBS, TIME, EXPOSURE, OBJECT, OBJ_RA, OBJ_DEC,
|
---|
[1635] | 121 | RESTFRQ, OBSMODE, BEAM, IF, FqRefVal, FqDelt, FqRefPix, RA, DEC,
|
---|
| 122 | TimeRefVal, TimeDelt, TimeRefPix, SCANRATE, TSYS, CALFCTR, XCALFCTR,
|
---|
| 123 | BASELIN, BASESUB, DATA, FLAGGED, DATAXED, XPOLDATA, REFBEAM, TCAL,
|
---|
| 124 | TCALTIME, AZIMUTH, ELEVATIO, PARANGLE, FOCUSAXI, FOCUSTAN, FOCUSROT,
|
---|
| 125 | TAMBIENT, PRESSURE, HUMIDITY, WINDSPEE, WINDDIRE, NDATA};
|
---|
[1325] | 126 |
|
---|
[1452] | 127 | // Message handling.
|
---|
| 128 | virtual void logMsg(const char *msg = 0x0);
|
---|
| 129 |
|
---|
[1325] | 130 | void findData(int iData, char *name, int type);
|
---|
[1635] | 131 | void findCol(char *name, int *colnum);
|
---|
[1325] | 132 | int readDim(int iData, long iRow, int *naxis, long naxes[]);
|
---|
| 133 | int readParm(char *name, int type, void *value);
|
---|
| 134 | int readData(char *name, int type, long iRow, void *value);
|
---|
| 135 | int readData(int iData, long iRow, void *value);
|
---|
[1635] | 136 | int readCol(int iData, void *value);
|
---|
| 137 | int readTime(long iRow, int iPix, char *datobs, double &utc);
|
---|
[1325] | 138 |
|
---|
[1635] | 139 | // These are for ALFA data: "BDFITS" or "CIMAFITS". Statics are required
|
---|
| 140 | // for CIMAFITS v2.0 because CAL ON/OFF data is split into separate files.
|
---|
| 141 | static int sInit, sReset;
|
---|
| 142 | static int (*sALFAcalNon)[2], (*sALFAcalNoff)[2];
|
---|
| 143 | static float (*sALFAcal)[2], (*sALFAcalOn)[2], (*sALFAcalOff)[2];
|
---|
| 144 |
|
---|
[1325] | 145 | int cALFA, cALFA_BD, cALFA_CIMA, cALFAscan, cScanNo;
|
---|
[1635] | 146 | float cALFAacc;
|
---|
[1452] | 147 | int alfaCal(short iBeam, short iIF, short iPol);
|
---|
[1635] | 148 | float alfaGain(float zd);
|
---|
[1325] | 149 |
|
---|
| 150 | // These are for GBT data.
|
---|
| 151 | int cGBT, cFirstScanNo;
|
---|
| 152 | };
|
---|
| 153 |
|
---|
| 154 | #endif
|
---|