source: branches/alma/external/atnf/PKSIO/SDFITSreader.h @ 1757

Last change on this file since 1757 was 1757, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


File size: 5.6 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 <casa/Logging/LogIO.h>
46
47#include <fitsio.h>
48
49using namespace std;
50using namespace casa;
51
52// <summary>
53// ATNF class for SDFITS input using CFITSIO.
54// </summary>
55
56class 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],
86        char   bunit[32],
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.
110    virtual int read(MBrecord &record);
111
112    // Close the SDFITS file.
113    virtual void close(void);
114
115  private:
116    int      cCycleNo, cExtraSysCal, cNAxes, cStatus;
117    long     cBeamAxis, cDecAxis, cFreqAxis, cNAxis[5], cNAxisTime, cNRow,
118             cRaAxis, cRow, cStokesAxis, cTimeAxis, cTimeIdx;
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
126    // for GBT
127    int *cPols ;
128
129    enum {SCAN, CYCLE, DATE_OBS, TIME, EXPOSURE, OBJECT, OBJ_RA, OBJ_DEC,
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};
136
137    // Message handling.
138    void log(LogOrigin origin, LogIO::Command cmd, const char *msg = 0x0);
139
140    void findData(int iData, char *name, int type);
141    void  findCol(char *name, int *colnum);
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);
146    int  readCol(int iData, void *value);
147    int  readTime(long iRow, int iPix, char *datobs, double &utc);
148
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
155    int   cALFA, cALFA_BD, cALFA_CIMA, cALFAscan, cScanNo;
156    float cALFAacc;
157    int   alfaCal(short iBeam, short iIF, short iPol);
158    float alfaGain(float zd);
159
160    // These are for GBT data.
161    int   cGBT, cFirstScanNo;
162    double cGLastUTC[4] ;
163    int cGLastScan[4] ;
164    int cGCycleNo[4] ;
165};
166
167#endif
Note: See TracBrowser for help on using the repository browser.