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