source: trunk/external-alma/atnf/PKSIO/MBFITSreader.h@ 2656

Last change on this file since 2656 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.2 KB
Line 
1//#---------------------------------------------------------------------------
2//# MBFITSreader.h: ATNF single-dish RPFITS reader.
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: MBFITSreader.h,v 19.23 2009-09-29 07:33:38 cal103 Exp $
32//#---------------------------------------------------------------------------
33//# The MBFITSreader class reads single dish RPFITS files (such as Parkes
34//# Multibeam MBFITS files).
35//#
36//# Original: 2000/07/28 Mark Calabretta
37//#---------------------------------------------------------------------------
38
39#ifndef ATNF_MBFITSREADER_H
40#define ATNF_MBFITSREADER_H
41
42#include <atnf/PKSIO/FITSreader.h>
43#include <atnf/PKSIO/MBrecord.h>
44
45using namespace std;
46
47// <summary>
48// ATNF single-dish RPFITS reader.
49// </summary>
50
51class MBFITSreader : public FITSreader
52{
53 public:
54 // Default constructor; position interpolation codes are:
55 // 0: no interpolation,
56 // 1: correct interpolation,
57 // 2: pksmbfits interpolation.
58 MBFITSreader(const int retry = 0, const int interpolate = 1);
59
60 // Destructor.
61 virtual ~MBFITSreader();
62
63 // Open the RPFITS file for reading.
64 virtual int open(
65 char *rpname,
66 int &nBeam,
67 int* &beams,
68 int &nIF,
69 int* &IFs,
70 int* &nChan,
71 int* &nPol,
72 int* &haveXPol,
73 int &haveBase,
74 int &haveSpectra,
75 int &extraSysCal);
76
77 // Get parameters describing the data.
78 virtual int getHeader(
79 char observer[32],
80 char project[32],
81 char telescope[32],
82 double antPos[3],
83 char obsType[32],
84 char bunit[32],
85 float &equinox,
86 char radecsys[32],
87 char dopplerFrame[32],
88 char datobs[32],
89 double &utc,
90 double &refFreq,
91 double &bandwidth);
92
93 // Get frequency parameters for each IF.
94 virtual int getFreqInfo(
95 int &nIF,
96 double* &startFreq,
97 double* &endFreq);
98
99 // Find the range of the data selected in time and position.
100 virtual int findRange(
101 int &nRow,
102 int &nSel,
103 char dateSpan[2][32],
104 double utcSpan[2],
105 double* &positions);
106
107 // Read the next data record.
108 virtual int read(MBrecord &record);
109
110 // Close the RPFITS file.
111 virtual void close(void);
112
113 private:
114 // RPFITSIN subroutine arguments.
115 int cBaseline, cFlag, cBin, cIFno, cSrcNo;
116 float cUTC, cU, cV, cW, *cVis, *cWgt;
117
118 char cDateObs[12];
119 int *cBeamSel, *cChanOff, cFirst, *cIFSel, cInterp, cIntTime, cMBopen,
120 cMopra, cNBeamSel, cNBin, cRetry, cSimulIF, cSUpos, *cXpolOff;
121
122 // The data has to be bufferred to allow positions to be interpolated.
123 int cEOF, cEOS, cFlushBin, cFlushIF, cFlushing;
124 double *cPosUTC;
125 MBrecord *cBuffer;
126
127 // Scan and cycle number bookkeeping.
128 int cCycleNo, cScanNo;
129 double cPrevUTC;
130
131 // Read the next data record from the RPFITS file.
132 int rpget(int syscalonly, int &EOS);
133 int rpfitsin(int &jstat);
134
135 // Check and, if necessary, repair a position timestamp.
136 int cCode5, cNRate;
137 double cAvRate[2];
138 int fixw(const char *datobs, int cycleNo, int beamNo, double avRate[2],
139 double thisRA, double thisDec, double thisUTC,
140 double nextRA, double nextDec, float &nextUTC);
141
142 // Subtract two UTCs (s).
143 double utcDiff(double utc1, double utc2);
144
145 // Compute and apply the scan rate corrected for grid convergence.
146 double cRA0, cDec0;
147 void scanRate(double ra0, double dec0,
148 double ra1, double dec1,
149 double ra2, double dec2, double dt,
150 double &raRate, double &decRate);
151 void applyRate(double ra0, double dec0,
152 double ra1, double dec1,
153 double raRate, double decRate, double dt,
154 double &ra2, double &dec2);
155 void eulerx(double lng0, double lat0, double phi0, double theta,
156 double phi, double &lng1, double &lat1);
157};
158
159#endif
Note: See TracBrowser for help on using the repository browser.