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