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