| 1 | //#---------------------------------------------------------------------------
 | 
|---|
| 2 | //# PKSreader.h: Class to read Parkes multibeam data.
 | 
|---|
| 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: PKSreader.h,v 19.24 2009-09-29 07:33:39 cal103 Exp $
 | 
|---|
| 32 | //#---------------------------------------------------------------------------
 | 
|---|
| 33 | //# Original: 2000/08/02, Mark Calabretta, ATNF
 | 
|---|
| 34 | //#---------------------------------------------------------------------------
 | 
|---|
| 35 | 
 | 
|---|
| 36 | #ifndef ATNF_PKSREADER_H
 | 
|---|
| 37 | #define ATNF_PKSREADER_H
 | 
|---|
| 38 | 
 | 
|---|
| 39 | #include <atnf/PKSIO/PKSmsg.h>
 | 
|---|
| 40 | #include <atnf/PKSIO/PKSrecord.h>
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #include <casa/aips.h>
 | 
|---|
| 43 | #include <casa/Arrays/Matrix.h>
 | 
|---|
| 44 | #include <casa/Arrays/Vector.h>
 | 
|---|
| 45 | #include <casa/BasicSL/String.h>
 | 
|---|
| 46 | 
 | 
|---|
| 47 | #include <casa/namespace.h>
 | 
|---|
| 48 | 
 | 
|---|
| 49 | // <summary>
 | 
|---|
| 50 | // Class to read Parkes multibeam data.
 | 
|---|
| 51 | // </summary>
 | 
|---|
| 52 | 
 | 
|---|
| 53 | // Return an appropriate PKSreader for a Parkes Multibeam dataset.
 | 
|---|
| 54 | class PKSreader* getPKSreader(
 | 
|---|
| 55 |         const String name,
 | 
|---|
| 56 |         const Int retry,
 | 
|---|
| 57 |         const Int interpolate,
 | 
|---|
| 58 |         String &format);
 | 
|---|
| 59 | 
 | 
|---|
| 60 | // As above, but search a list of directories for it.
 | 
|---|
| 61 | class PKSreader* getPKSreader(
 | 
|---|
| 62 |         const String name,
 | 
|---|
| 63 |         const Vector<String> directories,
 | 
|---|
| 64 |         const Int retry,
 | 
|---|
| 65 |         const Int interpolate,
 | 
|---|
| 66 |         Int    &iDir,
 | 
|---|
| 67 |         String &format);
 | 
|---|
| 68 | 
 | 
|---|
| 69 | // Open an appropriate PKSreader for a Parkes Multibeam dataset.
 | 
|---|
| 70 | class PKSreader* getPKSreader(
 | 
|---|
| 71 |         const String name,
 | 
|---|
| 72 |         const Int retry,
 | 
|---|
| 73 |         const Int interpolate,
 | 
|---|
| 74 |         String &format,
 | 
|---|
| 75 |         Vector<Bool> &beams,
 | 
|---|
| 76 |         Vector<Bool> &IFs,
 | 
|---|
| 77 |         Vector<uInt> &nChan,
 | 
|---|
| 78 |         Vector<uInt> &nPol,
 | 
|---|
| 79 |         Vector<Bool> &haveXPol,
 | 
|---|
| 80 |         Bool   &haveBase,
 | 
|---|
| 81 |         Bool   &haveSpectra);
 | 
|---|
| 82 | 
 | 
|---|
| 83 | // As above, but search a list of directories for it.
 | 
|---|
| 84 | class PKSreader* getPKSreader(
 | 
|---|
| 85 |         const String name,
 | 
|---|
| 86 |         const Vector<String> directories,
 | 
|---|
| 87 |         const Int retry,
 | 
|---|
| 88 |         const Int interpolate,
 | 
|---|
| 89 |         Int    &iDir,
 | 
|---|
| 90 |         String &format,
 | 
|---|
| 91 |         Vector<Bool> &beams,
 | 
|---|
| 92 |         Vector<Bool> &IFs,
 | 
|---|
| 93 |         Vector<uInt> &nChan,
 | 
|---|
| 94 |         Vector<uInt> &nPol,
 | 
|---|
| 95 |         Vector<Bool> &haveXPol,
 | 
|---|
| 96 |         Bool   &haveBase,
 | 
|---|
| 97 |         Bool   &haveSpectra);
 | 
|---|
| 98 | 
 | 
|---|
| 99 | class PKSreader : public PKSmsg
 | 
|---|
| 100 | {
 | 
|---|
| 101 |   public:
 | 
|---|
| 102 |     // Destructor.
 | 
|---|
| 103 |     virtual ~PKSreader() {};
 | 
|---|
| 104 | 
 | 
|---|
| 105 |     // Open the dataset.
 | 
|---|
| 106 |     virtual Int open(
 | 
|---|
| 107 |         const String inName,
 | 
|---|
| 108 |         Vector<Bool> &beams,
 | 
|---|
| 109 |         Vector<Bool> &IFs,
 | 
|---|
| 110 |         Vector<uInt> &nChan,
 | 
|---|
| 111 |         Vector<uInt> &nPol,
 | 
|---|
| 112 |         Vector<Bool> &haveXPol,
 | 
|---|
| 113 |         Bool   &haveBase,
 | 
|---|
| 114 |         Bool   &haveSpectra) = 0;
 | 
|---|
| 115 | 
 | 
|---|
| 116 |     // Get parameters describing the data.
 | 
|---|
| 117 |     virtual Int getHeader(
 | 
|---|
| 118 |         String &observer,
 | 
|---|
| 119 |         String &project,
 | 
|---|
| 120 |         String &antName,
 | 
|---|
| 121 |         Vector<Double> &antPosition,
 | 
|---|
| 122 |         String &obsType,
 | 
|---|
| 123 |         String &bunit,
 | 
|---|
| 124 |         Float  &equinox,
 | 
|---|
| 125 |         String &dopplerFrame,
 | 
|---|
| 126 |         Double &mjd,
 | 
|---|
| 127 |         Double &refFreq,
 | 
|---|
| 128 |         Double &bandwidth) = 0;
 | 
|---|
| 129 | 
 | 
|---|
| 130 |     // Get frequency parameters for each IF.
 | 
|---|
| 131 |     virtual Int getFreqInfo(
 | 
|---|
| 132 |         Vector<Double> &startFreq,
 | 
|---|
| 133 |         Vector<Double> &endFreq) = 0;
 | 
|---|
| 134 | 
 | 
|---|
| 135 |     // Set data selection criteria.  Channel numbering is 1-relative, zero or
 | 
|---|
| 136 |     // negative channel numbers are taken to be offsets from the last channel.
 | 
|---|
| 137 |     // Coordinate system selection (only supported for SDFITS input):
 | 
|---|
| 138 |     //   0: equatorial (RA,Dec),
 | 
|---|
| 139 |     //   1: horizontal (Az,El),
 | 
|---|
| 140 |     //   2: feed-plane,
 | 
|---|
| 141 |     //   3: zenithal position angle of feed and elevation, (ZPA,El).
 | 
|---|
| 142 |     virtual uInt select(
 | 
|---|
| 143 |         const Vector<Bool> beamSel,
 | 
|---|
| 144 |         const Vector<Bool> IFsel,
 | 
|---|
| 145 |         const Vector<Int>  startChan,
 | 
|---|
| 146 |         const Vector<Int>  endChan,
 | 
|---|
| 147 |         const Vector<Int>  refChan,
 | 
|---|
| 148 |         const Bool getSpectra = True,
 | 
|---|
| 149 |         const Bool getXPol    = False,
 | 
|---|
| 150 |         const Int  coordSys   = 0) = 0;
 | 
|---|
| 151 | 
 | 
|---|
| 152 |     // Find the range of the data selected in time and position.
 | 
|---|
| 153 |     virtual Int findRange(
 | 
|---|
| 154 |         Int    &nRow,
 | 
|---|
| 155 |         Int    &nSel,
 | 
|---|
| 156 |         Vector<Double> &timeSpan,
 | 
|---|
| 157 |         Matrix<Double> &positions) = 0;
 | 
|---|
| 158 | 
 | 
|---|
| 159 |     // Read the next data record.
 | 
|---|
| 160 |     virtual Int read(PKSrecord &pksrec) = 0;
 | 
|---|
| 161 | 
 | 
|---|
| 162 |     // Close the input file.
 | 
|---|
| 163 |     virtual void close() = 0;
 | 
|---|
| 164 | 
 | 
|---|
| 165 |   protected:
 | 
|---|
| 166 |     Bool  cGetSpectra, cGetXPol;
 | 
|---|
| 167 |     Int   cCoordSys;
 | 
|---|
| 168 | 
 | 
|---|
| 169 |     Vector<uInt> cNChan, cNPol;
 | 
|---|
| 170 |     Vector<Bool> cHaveXPol;
 | 
|---|
| 171 | };
 | 
|---|
| 172 | 
 | 
|---|
| 173 | #endif
 | 
|---|