[1325] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# SDFITSreader.h: ATNF CFITSIO interface class for SDFITS input.
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
[1757] | 4 | //# livedata - processing pipeline for single-dish, multibeam spectral data.
|
---|
| 5 | //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
|
---|
[1325] | 6 | //#
|
---|
[1757] | 7 | //# This file is part of livedata.
|
---|
[1325] | 8 | //#
|
---|
[1757] | 9 | //# livedata is free software: you can redistribute it and/or modify it under
|
---|
| 10 | //# the terms of the GNU General Public License as published by the Free
|
---|
| 11 | //# Software Foundation, either version 3 of the License, or (at your option)
|
---|
| 12 | //# any later version.
|
---|
| 13 | //#
|
---|
| 14 | //# livedata is distributed in the hope that it will be useful, but WITHOUT
|
---|
[1325] | 15 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
---|
[1757] | 16 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
---|
| 17 | //# more details.
|
---|
[1325] | 18 | //#
|
---|
[1757] | 19 | //# You should have received a copy of the GNU General Public License along
|
---|
| 20 | //# with livedata. If not, see <http://www.gnu.org/licenses/>.
|
---|
[1325] | 21 | //#
|
---|
[1757] | 22 | //# Correspondence concerning livedata may be directed to:
|
---|
| 23 | //# Internet email: mcalabre@atnf.csiro.au
|
---|
| 24 | //# Postal address: Dr. Mark Calabretta
|
---|
| 25 | //# Australia Telescope National Facility, CSIRO
|
---|
| 26 | //# PO Box 76
|
---|
| 27 | //# Epping NSW 1710
|
---|
| 28 | //# AUSTRALIA
|
---|
[1325] | 29 | //#
|
---|
[1757] | 30 | //# http://www.atnf.csiro.au/computing/software/livedata.html
|
---|
| 31 | //# $Id: SDFITSreader.h,v 19.22 2009-09-29 07:33:39 cal103 Exp $
|
---|
[1325] | 32 | //#---------------------------------------------------------------------------
|
---|
| 33 | //# The SDFITSreader class reads single dish FITS files such as those written
|
---|
| 34 | //# by SDFITSwriter containing Parkes Multibeam data.
|
---|
| 35 | //#
|
---|
| 36 | //# Original: 2000/08/09, Mark Calabretta, ATNF
|
---|
| 37 | //#---------------------------------------------------------------------------
|
---|
| 38 |
|
---|
| 39 | #ifndef ATNF_SDFITSREADER_H
|
---|
| 40 | #define ATNF_SDFITSREADER_H
|
---|
| 41 |
|
---|
| 42 | #include <atnf/PKSIO/FITSreader.h>
|
---|
[1757] | 43 | #include <atnf/PKSIO/MBrecord.h>
|
---|
[1325] | 44 |
|
---|
[1757] | 45 | #include <casa/Logging/LogIO.h>
|
---|
| 46 |
|
---|
[1325] | 47 | #include <fitsio.h>
|
---|
| 48 |
|
---|
[1757] | 49 | using namespace std;
|
---|
| 50 | using namespace casa;
|
---|
| 51 |
|
---|
[1325] | 52 | // <summary>
|
---|
| 53 | // ATNF class for SDFITS input using CFITSIO.
|
---|
| 54 | // </summary>
|
---|
| 55 |
|
---|
| 56 | class SDFITSreader : public FITSreader
|
---|
| 57 | {
|
---|
| 58 | public:
|
---|
| 59 | // Default constructor.
|
---|
| 60 | SDFITSreader();
|
---|
| 61 |
|
---|
| 62 | // Destructor.
|
---|
| 63 | virtual ~SDFITSreader();
|
---|
| 64 |
|
---|
| 65 | // Open an SDFITS file for reading.
|
---|
| 66 | virtual int open(
|
---|
| 67 | char* sdname,
|
---|
| 68 | int &nBeam,
|
---|
| 69 | int* &beams,
|
---|
| 70 | int &nIF,
|
---|
| 71 | int* &IFs,
|
---|
| 72 | int* &nChan,
|
---|
| 73 | int* &nPol,
|
---|
| 74 | int* &haveXPol,
|
---|
| 75 | int &haveBase,
|
---|
| 76 | int &haveSpectra,
|
---|
| 77 | int &extraSysCal);
|
---|
| 78 |
|
---|
| 79 | // Get parameters describing the data.
|
---|
| 80 | virtual int getHeader(
|
---|
| 81 | char observer[32],
|
---|
| 82 | char project[32],
|
---|
| 83 | char telescope[32],
|
---|
| 84 | double antPos[3],
|
---|
| 85 | char obsMode[32],
|
---|
[1757] | 86 | char bunit[32],
|
---|
[1325] | 87 | float &equinox,
|
---|
| 88 | char radecsys[32],
|
---|
| 89 | char dopplerFrame[32],
|
---|
| 90 | char datobs[32],
|
---|
| 91 | double &utc,
|
---|
| 92 | double &refFreq,
|
---|
| 93 | double &bandwidth);
|
---|
| 94 |
|
---|
| 95 | // Get frequency parameters for each IF.
|
---|
| 96 | virtual int getFreqInfo(
|
---|
| 97 | int &nIF,
|
---|
| 98 | double* &startFreq,
|
---|
| 99 | double* &endFreq);
|
---|
| 100 |
|
---|
| 101 | // Find the range of the data selected in time and position.
|
---|
| 102 | virtual int findRange(
|
---|
| 103 | int &nRow,
|
---|
| 104 | int &nSel,
|
---|
| 105 | char dateSpan[2][32],
|
---|
| 106 | double utcSpan[2],
|
---|
| 107 | double* &positions);
|
---|
| 108 |
|
---|
| 109 | // Read the next data record.
|
---|
[1757] | 110 | virtual int read(MBrecord &record);
|
---|
[1325] | 111 |
|
---|
| 112 | // Close the SDFITS file.
|
---|
| 113 | virtual void close(void);
|
---|
| 114 |
|
---|
| 115 | private:
|
---|
[1757] | 116 | int cCycleNo, cExtraSysCal, cNAxes, cStatus;
|
---|
| 117 | long cBeamAxis, cDecAxis, cFreqAxis, cNAxis[5], cNAxisTime, cNRow,
|
---|
| 118 | cRaAxis, cRow, cStokesAxis, cTimeAxis, cTimeIdx;
|
---|
[1325] | 119 | double cLastUTC;
|
---|
| 120 | fitsfile *cSDptr;
|
---|
| 121 | class FITSparm *cData;
|
---|
| 122 |
|
---|
| 123 | // These are to differentiate 0-, and 1-relative beam and IF numbering.
|
---|
| 124 | int cBeam_1rel, cIF_1rel;
|
---|
| 125 |
|
---|
[1757] | 126 | // for GBT
|
---|
| 127 | int *cPols ;
|
---|
| 128 |
|
---|
[1325] | 129 | enum {SCAN, CYCLE, DATE_OBS, TIME, EXPOSURE, OBJECT, OBJ_RA, OBJ_DEC,
|
---|
[1757] | 130 | RESTFRQ, OBSMODE, BEAM, IF, FqRefVal, FqDelt, FqRefPix, RA, DEC,
|
---|
| 131 | TimeRefVal, TimeDelt, TimeRefPix, SCANRATE, TSYS, CALFCTR, XCALFCTR,
|
---|
| 132 | BASELIN, BASESUB, DATA, FLAGGED, DATAXED, XPOLDATA, REFBEAM, TCAL,
|
---|
| 133 | TCALTIME, AZIMUTH, ELEVATIO, PARANGLE, FOCUSAXI, FOCUSTAN, FOCUSROT,
|
---|
| 134 | TAMBIENT, PRESSURE, HUMIDITY, WINDSPEE, WINDDIRE, STOKES, SIG, CAL,
|
---|
| 135 | VFRAME, RVSYS, VELDEF, NDATA};
|
---|
[1325] | 136 |
|
---|
[1757] | 137 | // Message handling.
|
---|
| 138 | void log(LogOrigin origin, LogIO::Command cmd, const char *msg = 0x0);
|
---|
| 139 |
|
---|
[1325] | 140 | void findData(int iData, char *name, int type);
|
---|
[1757] | 141 | void findCol(char *name, int *colnum);
|
---|
[1325] | 142 | int readDim(int iData, long iRow, int *naxis, long naxes[]);
|
---|
| 143 | int readParm(char *name, int type, void *value);
|
---|
| 144 | int readData(char *name, int type, long iRow, void *value);
|
---|
| 145 | int readData(int iData, long iRow, void *value);
|
---|
[1757] | 146 | int readCol(int iData, void *value);
|
---|
| 147 | int readTime(long iRow, int iPix, char *datobs, double &utc);
|
---|
[1325] | 148 |
|
---|
[1757] | 149 | // These are for ALFA data: "BDFITS" or "CIMAFITS". Statics are required
|
---|
| 150 | // for CIMAFITS v2.0 because CAL ON/OFF data is split into separate files.
|
---|
| 151 | static int sInit, sReset;
|
---|
| 152 | static int (*sALFAcalNon)[2], (*sALFAcalNoff)[2];
|
---|
| 153 | static float (*sALFAcal)[2], (*sALFAcalOn)[2], (*sALFAcalOff)[2];
|
---|
| 154 |
|
---|
[1325] | 155 | int cALFA, cALFA_BD, cALFA_CIMA, cALFAscan, cScanNo;
|
---|
[1757] | 156 | float cALFAacc;
|
---|
| 157 | int alfaCal(short iBeam, short iIF, short iPol);
|
---|
| 158 | float alfaGain(float zd);
|
---|
[1325] | 159 |
|
---|
| 160 | // These are for GBT data.
|
---|
| 161 | int cGBT, cFirstScanNo;
|
---|
[1757] | 162 | double cGLastUTC[4] ;
|
---|
| 163 | int cGLastScan[4] ;
|
---|
| 164 | int cGCycleNo[4] ;
|
---|
[1325] | 165 | };
|
---|
| 166 |
|
---|
| 167 | #endif
|
---|