source: trunk/external/atnf/PKSIO/SDFITSreader.h @ 1720

Last change on this file since 1720 was 1720, checked in by Malte Marquarding, 14 years ago

Update from livedata CVS repository

File size: 5.3 KB
Line 
1//#---------------------------------------------------------------------------
2//# SDFITSreader.h: ATNF CFITSIO interface class for SDFITS input.
3//#---------------------------------------------------------------------------
4//# livedata - processing pipeline for single-dish, multibeam spectral data.
5//# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
6//#
7//# This file is part of livedata.
8//#
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
15//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16//# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17//# more details.
18//#
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/>.
21//#
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
29//#
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 $
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>
43#include <atnf/PKSIO/MBrecord.h>
44
45#include <fitsio.h>
46
47using namespace std;
48
49// <summary>
50// ATNF class for SDFITS input using CFITSIO.
51// </summary>
52
53class SDFITSreader : public FITSreader
54{
55  public:
56    // Default constructor.
57    SDFITSreader();
58
59    // Destructor.
60    virtual ~SDFITSreader();
61
62    // Open an SDFITS file for reading.
63    virtual int open(
64        char*  sdname,
65        int    &nBeam,
66        int*   &beams,
67        int    &nIF,
68        int*   &IFs,
69        int*   &nChan,
70        int*   &nPol,
71        int*   &haveXPol,
72        int    &haveBase,
73        int    &haveSpectra,
74        int    &extraSysCal);
75
76    // Get parameters describing the data.
77    virtual int getHeader(
78        char   observer[32],
79        char   project[32],
80        char   telescope[32],
81        double antPos[3],
82        char   obsMode[32],
83        char   bunit[32],
84        float  &equinox,
85        char   radecsys[32],
86        char   dopplerFrame[32],
87        char   datobs[32],
88        double &utc,
89        double &refFreq,
90        double &bandwidth);
91
92    // Get frequency parameters for each IF.
93    virtual int getFreqInfo(
94        int     &nIF,
95        double* &startFreq,
96        double* &endFreq);
97
98    // Find the range of the data selected in time and position.
99    virtual int findRange(
100        int    &nRow,
101        int    &nSel,
102        char   dateSpan[2][32],
103        double utcSpan[2],
104        double* &positions);
105
106    // Read the next data record.
107    virtual int read(MBrecord &record);
108
109    // Close the SDFITS file.
110    virtual void close(void);
111
112  private:
113    int      cCycleNo, cExtraSysCal, cNAxes, cStatus;
114    long     cBeamAxis, cDecAxis, cFreqAxis, cNAxis[5], cNAxisTime, cNRow,
115             cRaAxis, cRow, cStokesAxis, cTimeAxis, cTimeIdx;
116    double   cLastUTC;
117    fitsfile *cSDptr;
118    class FITSparm *cData;
119
120    // These are to differentiate 0-, and 1-relative beam and IF numbering.
121    int  cBeam_1rel, cIF_1rel;
122
123    enum {SCAN, CYCLE, DATE_OBS, TIME, EXPOSURE, OBJECT, OBJ_RA, OBJ_DEC,
124          RESTFRQ, OBSMODE, BEAM, IF, FqRefVal, FqDelt, FqRefPix, RA, DEC,
125          TimeRefVal, TimeDelt, TimeRefPix, SCANRATE, TSYS, CALFCTR, XCALFCTR,
126          BASELIN, BASESUB, DATA, FLAGGED, DATAXED, XPOLDATA, REFBEAM, TCAL,
127          TCALTIME, AZIMUTH, ELEVATIO, PARANGLE, FOCUSAXI, FOCUSTAN, FOCUSROT,
128          TAMBIENT, PRESSURE, HUMIDITY, WINDSPEE, WINDDIRE, NDATA};
129
130    // Message handling.
131    virtual void logMsg(const char *msg = 0x0);
132
133    void findData(int iData, char *name, int type);
134    void  findCol(char *name, int *colnum);
135    int   readDim(int iData, long iRow, int *naxis, long naxes[]);
136    int  readParm(char *name, int type, void *value);
137    int  readData(char *name, int type, long iRow, void *value);
138    int  readData(int iData, long iRow, void *value);
139    int  readCol(int iData, void *value);
140    int  readTime(long iRow, int iPix, char *datobs, double &utc);
141
142    // These are for ALFA data: "BDFITS" or "CIMAFITS".  Statics are required
143    // for CIMAFITS v2.0 because CAL ON/OFF data is split into separate files.
144    static int  sInit, sReset;
145    static int  (*sALFAcalNon)[2], (*sALFAcalNoff)[2];
146    static float (*sALFAcal)[2], (*sALFAcalOn)[2], (*sALFAcalOff)[2];
147
148    int   cALFA, cALFA_BD, cALFA_CIMA, cALFAscan, cScanNo;
149    float cALFAacc;
150    int   alfaCal(short iBeam, short iIF, short iPol);
151    float alfaGain(float zd);
152
153    // These are for GBT data.
154    int   cGBT, cFirstScanNo;
155};
156
157#endif
Note: See TracBrowser for help on using the repository browser.