[1325] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# FITSreader.h: ATNF single-dish FITS reader. |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
[1399] | 4 | //# Copyright (C) 2000-2007 |
---|
[1325] | 5 | //# Mark Calabretta, ATNF |
---|
| 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: mcalabre@atnf.csiro.au. |
---|
| 23 | //# Postal address: Dr. Mark Calabretta, |
---|
| 24 | //# Australia Telescope National Facility, |
---|
| 25 | //# P.O. Box 76, |
---|
| 26 | //# Epping, NSW, 2121, |
---|
| 27 | //# AUSTRALIA |
---|
| 28 | //# |
---|
[1635] | 29 | //# $Id: FITSreader.h,v 19.10 2008-11-27 04:28:24 cal103 Exp $ |
---|
[1325] | 30 | //#--------------------------------------------------------------------------- |
---|
| 31 | //# The FITSreader class is an abstract base class for the Parkes Multibeam |
---|
| 32 | //# RPFITS and SDFITS readers. |
---|
| 33 | //# |
---|
| 34 | //# Original: 2000/08/14 Mark Calabretta |
---|
| 35 | //#--------------------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | #ifndef ATNF_FITSREADER_H |
---|
| 38 | #define ATNF_FITSREADER_H |
---|
| 39 | |
---|
[1452] | 40 | #include <atnf/PKSIO/MBrecord.h> |
---|
| 41 | #include <atnf/PKSIO/PKSmsg.h> |
---|
[1325] | 42 | |
---|
[1452] | 43 | using namespace std; |
---|
| 44 | |
---|
[1325] | 45 | // <summary> |
---|
| 46 | // ATNF single-dish FITS reader. |
---|
| 47 | // </summary> |
---|
| 48 | |
---|
[1452] | 49 | class FITSreader : public PKSmsg |
---|
[1325] | 50 | { |
---|
| 51 | public: |
---|
| 52 | // Destructor. |
---|
| 53 | virtual ~FITSreader() {}; |
---|
| 54 | |
---|
| 55 | // Open the FITS file for reading. Returns a pointer, beams, to an array |
---|
| 56 | // of length nBeam that indicates which beams are present in the data. |
---|
| 57 | // Beam selection is done by zeroing the unwanted elements of this array. |
---|
| 58 | // Likewise for IF selection (e.g. for frequency-switched data). |
---|
| 59 | virtual int open( |
---|
| 60 | char *FITSname, |
---|
| 61 | int &nBeam, |
---|
| 62 | int* &beams, |
---|
| 63 | int &nIF, |
---|
| 64 | int* &IFs, |
---|
| 65 | int* &nChan, |
---|
| 66 | int* &nPol, |
---|
| 67 | int* &haveXPol, |
---|
| 68 | int &haveBase, |
---|
| 69 | int &haveSpectra, |
---|
| 70 | int &extraSysCal) = 0; |
---|
| 71 | |
---|
| 72 | // Get metadata. |
---|
| 73 | virtual int getHeader( |
---|
| 74 | char observer[32], |
---|
| 75 | char project[32], |
---|
| 76 | char telescope[32], |
---|
| 77 | double antPos[3], |
---|
| 78 | char obsType[32], |
---|
[1399] | 79 | char bunit[32], |
---|
[1325] | 80 | float &equinox, |
---|
| 81 | char radecsys[32], |
---|
| 82 | char dopplerFrame[32], |
---|
| 83 | char datobs[32], |
---|
| 84 | double &utc, |
---|
| 85 | double &refFreq, |
---|
| 86 | double &bandwidth) = 0; |
---|
| 87 | |
---|
| 88 | // Get frequency parameters for each IF. |
---|
| 89 | virtual int getFreqInfo( |
---|
| 90 | int &nIF, |
---|
| 91 | double* &startFreq, |
---|
| 92 | double* &endFreq) = 0; |
---|
| 93 | |
---|
| 94 | // Set data selection criteria. Channel numbering is 1-relative, zero or |
---|
| 95 | // negative channel numbers are taken to be offsets from the last channel. |
---|
[1452] | 96 | // Coordinate systems are |
---|
| 97 | // 0: equatorial (RA,Dec), |
---|
[1635] | 98 | // 1: horizontal (Az,El), |
---|
| 99 | // 2: feed-plane, |
---|
| 100 | // 3: zenithal position angle of feed and elevation, (ZPA,El). |
---|
[1325] | 101 | int select( |
---|
| 102 | const int startChan[], |
---|
| 103 | const int endChan[], |
---|
| 104 | const int refChan[], |
---|
| 105 | const int getSpectra = 1, |
---|
[1452] | 106 | const int getXPol = 0, |
---|
| 107 | const int coordSys = 0); |
---|
[1325] | 108 | |
---|
| 109 | // Find the range in time and position of the data selected. |
---|
| 110 | virtual int findRange( |
---|
| 111 | int &nRow, |
---|
| 112 | int &nSel, |
---|
| 113 | char dateSpan[2][32], |
---|
| 114 | double utcSpan[2], |
---|
| 115 | double* &positions) = 0; |
---|
| 116 | |
---|
| 117 | // Read the next data record. |
---|
| 118 | virtual int read( |
---|
[1452] | 119 | MBrecord &record) = 0; |
---|
[1325] | 120 | |
---|
| 121 | // Close the RPFITS file. |
---|
| 122 | virtual void close(void) = 0; |
---|
| 123 | |
---|
| 124 | protected: |
---|
[1452] | 125 | int *cBeams, *cEndChan, cCoordSys, cGetSpectra, cGetXPol, cHaveBase, |
---|
| 126 | cHaveSpectra, *cHaveXPol, *cIFs, cNBeam, *cNChan, cNIF, *cNPol, |
---|
| 127 | *cRefChan, *cStartChan; |
---|
| 128 | |
---|
| 129 | // For use in constructing messages. |
---|
| 130 | char cMsg[256]; |
---|
[1325] | 131 | }; |
---|
| 132 | |
---|
| 133 | #endif |
---|