[1325] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# SDFITSreader.h: ATNF CFITSIO interface class for SDFITS input.
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
[1399] | 4 | //# Copyright (C) 2000-2007
|
---|
[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 | //#
|
---|
[1399] | 28 | //# $Id: SDFITSreader.h,v 19.13 2007/11/12 03:37:56 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>
|
---|
| 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],
|
---|
[1399] | 78 | char bunit[32],
|
---|
[1325] | 79 | float &equinox,
|
---|
| 80 | char radecsys[32],
|
---|
| 81 | char dopplerFrame[32],
|
---|
| 82 | char datobs[32],
|
---|
| 83 | double &utc,
|
---|
| 84 | double &refFreq,
|
---|
| 85 | double &bandwidth);
|
---|
| 86 |
|
---|
| 87 | // Get frequency parameters for each IF.
|
---|
| 88 | virtual int getFreqInfo(
|
---|
| 89 | int &nIF,
|
---|
| 90 | double* &startFreq,
|
---|
| 91 | double* &endFreq);
|
---|
| 92 |
|
---|
| 93 | // Find the range of the data selected in time and position.
|
---|
| 94 | virtual int findRange(
|
---|
| 95 | int &nRow,
|
---|
| 96 | int &nSel,
|
---|
| 97 | char dateSpan[2][32],
|
---|
| 98 | double utcSpan[2],
|
---|
| 99 | double* &positions);
|
---|
| 100 |
|
---|
| 101 | // Read the next data record.
|
---|
| 102 | virtual int read(PKSMBrecord &record);
|
---|
| 103 |
|
---|
| 104 | // Print out CFITSIO error messages.
|
---|
| 105 | void reportError(void);
|
---|
| 106 |
|
---|
| 107 | // Close the SDFITS file.
|
---|
| 108 | virtual void close(void);
|
---|
| 109 |
|
---|
| 110 | private:
|
---|
| 111 | int cCycleNo, cExtraSysCal, cNAxis, cStatus;
|
---|
| 112 | long cNAxes[5], cNRow, cReqax[4], cRow;
|
---|
| 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,
|
---|
| 121 | RESTFRQ, OBSMODE, BEAM, IF, FqRefPix, FqRefVal, FqDelt, RA, DEC,
|
---|
| 122 | SCANRATE, TSYS, CALFCTR, XCALFCTR, BASELIN, BASESUB, DATA, FLAGGED,
|
---|
| 123 | DATAXED, XPOLDATA, REFBEAM, TCAL, TCALTIME, AZIMUTH, ELEVATIO,
|
---|
| 124 | PARANGLE, FOCUSAXI, FOCUSTAN, FOCUSROT, TAMBIENT, PRESSURE,
|
---|
| 125 | HUMIDITY, WINDSPEE, WINDDIRE, NDATA};
|
---|
| 126 |
|
---|
| 127 | void findData(int iData, char *name, int type);
|
---|
| 128 | int readDim(int iData, long iRow, int *naxis, long naxes[]);
|
---|
| 129 | int readParm(char *name, int type, void *value);
|
---|
| 130 | int readData(char *name, int type, long iRow, void *value);
|
---|
| 131 | int readData(int iData, long iRow, void *value);
|
---|
| 132 | void findCol(char *name, int *colnum);
|
---|
| 133 |
|
---|
| 134 | // These are for ALFA data, "BDFITS" or "CIMAFITS".
|
---|
| 135 | int cALFA, cALFA_BD, cALFA_CIMA, cALFAscan, cScanNo;
|
---|
| 136 | float cALFAcal[8][2], cALFAcalOn[8][2], cALFAcalOff[8][2];
|
---|
| 137 | int alfaCal(short iBeam, short iIF);
|
---|
| 138 |
|
---|
| 139 | // These are for GBT data.
|
---|
| 140 | int cGBT, cFirstScanNo;
|
---|
| 141 | };
|
---|
| 142 |
|
---|
| 143 | #endif
|
---|