[1325] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# FITSreader.h: ATNF single-dish FITS reader. |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
| 4 | //# Copyright (C) 2000-2006 |
---|
| 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 | //# |
---|
| 29 | //# $Id: FITSreader.h,v 19.5 2006/05/19 02:18:02 mcalabre Exp $ |
---|
| 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 | |
---|
| 40 | #include <atnf/PKSIO/PKSMBrecord.h> |
---|
| 41 | |
---|
| 42 | // <summary> |
---|
| 43 | // ATNF single-dish FITS reader. |
---|
| 44 | // </summary> |
---|
| 45 | |
---|
| 46 | class FITSreader |
---|
| 47 | { |
---|
| 48 | public: |
---|
| 49 | // Destructor. |
---|
| 50 | virtual ~FITSreader() {}; |
---|
| 51 | |
---|
| 52 | // Open the FITS file for reading. Returns a pointer, beams, to an array |
---|
| 53 | // of length nBeam that indicates which beams are present in the data. |
---|
| 54 | // Beam selection is done by zeroing the unwanted elements of this array. |
---|
| 55 | // Likewise for IF selection (e.g. for frequency-switched data). |
---|
| 56 | virtual int open( |
---|
| 57 | char *FITSname, |
---|
| 58 | int &nBeam, |
---|
| 59 | int* &beams, |
---|
| 60 | int &nIF, |
---|
| 61 | int* &IFs, |
---|
| 62 | int* &nChan, |
---|
| 63 | int* &nPol, |
---|
| 64 | int* &haveXPol, |
---|
| 65 | int &haveBase, |
---|
| 66 | int &haveSpectra, |
---|
| 67 | int &extraSysCal) = 0; |
---|
| 68 | |
---|
| 69 | // Get metadata. |
---|
| 70 | virtual int getHeader( |
---|
| 71 | char observer[32], |
---|
| 72 | char project[32], |
---|
| 73 | char telescope[32], |
---|
| 74 | double antPos[3], |
---|
| 75 | char obsType[32], |
---|
| 76 | float &equinox, |
---|
| 77 | char radecsys[32], |
---|
| 78 | char dopplerFrame[32], |
---|
| 79 | char datobs[32], |
---|
| 80 | double &utc, |
---|
| 81 | double &refFreq, |
---|
| 82 | double &bandwidth) = 0; |
---|
| 83 | |
---|
| 84 | // Get frequency parameters for each IF. |
---|
| 85 | virtual int getFreqInfo( |
---|
| 86 | int &nIF, |
---|
| 87 | double* &startFreq, |
---|
| 88 | double* &endFreq) = 0; |
---|
| 89 | |
---|
| 90 | // Set data selection criteria. Channel numbering is 1-relative, zero or |
---|
| 91 | // negative channel numbers are taken to be offsets from the last channel. |
---|
| 92 | int select( |
---|
| 93 | const int startChan[], |
---|
| 94 | const int endChan[], |
---|
| 95 | const int refChan[], |
---|
| 96 | const int getSpectra = 1, |
---|
| 97 | const int getXPol = 0, |
---|
| 98 | const int getFeedPos = 0); |
---|
| 99 | |
---|
| 100 | // Find the range in time and position of the data selected. |
---|
| 101 | virtual int findRange( |
---|
| 102 | int &nRow, |
---|
| 103 | int &nSel, |
---|
| 104 | char dateSpan[2][32], |
---|
| 105 | double utcSpan[2], |
---|
| 106 | double* &positions) = 0; |
---|
| 107 | |
---|
| 108 | // Read the next data record. |
---|
| 109 | virtual int read( |
---|
| 110 | PKSMBrecord &record) = 0; |
---|
| 111 | |
---|
| 112 | // Close the RPFITS file. |
---|
| 113 | virtual void close(void) = 0; |
---|
| 114 | |
---|
| 115 | protected: |
---|
| 116 | int *cBeams, *cEndChan, cGetFeedPos, cGetSpectra, cGetXPol, cHaveBase, |
---|
| 117 | cHaveSpectra, *cHaveXPol, *cIFs, cNBeam, *cNChan, cNIF, *cNPol, |
---|
| 118 | *cRefChan, *cStartChan; |
---|
| 119 | }; |
---|
| 120 | |
---|
| 121 | #endif |
---|