casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PKSreader.h
Go to the documentation of this file.
00001 //#---------------------------------------------------------------------------
00002 //# PKSreader.h: Class to read Parkes multibeam data.
00003 //#---------------------------------------------------------------------------
00004 //# livedata - processing pipeline for single-dish, multibeam spectral data.
00005 //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
00006 //#
00007 //# This file is part of livedata.
00008 //#
00009 //# livedata is free software: you can redistribute it and/or modify it under
00010 //# the terms of the GNU General Public License as published by the Free
00011 //# Software Foundation, either version 3 of the License, or (at your option)
00012 //# any later version.
00013 //#
00014 //# livedata is distributed in the hope that it will be useful, but WITHOUT
00015 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00016 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00017 //# more details.
00018 //#
00019 //# You should have received a copy of the GNU General Public License along
00020 //# with livedata.  If not, see <http://www.gnu.org/licenses/>.
00021 //#
00022 //# Correspondence concerning livedata may be directed to:
00023 //#        Internet email: mcalabre@atnf.csiro.au
00024 //#        Postal address: Dr. Mark Calabretta
00025 //#                        Australia Telescope National Facility, CSIRO
00026 //#                        PO Box 76
00027 //#                        Epping NSW 1710
00028 //#                        AUSTRALIA
00029 //#
00030 //# http://www.atnf.csiro.au/computing/software/livedata.html
00031 //# $Id: PKSreader.h,v 19.24 2009-09-29 07:33:39 cal103 Exp $
00032 //#---------------------------------------------------------------------------
00033 //# Original: 2000/08/02, Mark Calabretta, ATNF
00034 //#---------------------------------------------------------------------------
00035 
00036 #ifndef ATNF_PKSREADER_H
00037 #define ATNF_PKSREADER_H
00038 
00039 #include <atnf/PKSIO/PKSrecord.h>
00040 #include <atnf/PKSIO/SrcType.h>
00041 
00042 #include <casa/aips.h>
00043 #include <casa/Arrays/Matrix.h>
00044 #include <casa/Arrays/Vector.h>
00045 #include <casa/BasicSL/Complex.h>
00046 #include <casa/BasicSL/String.h>
00047 
00048 #include <casa/namespace.h>
00049 
00050 // <summary>
00051 // Class to read Parkes multibeam data.
00052 // </summary>
00053 
00054 // Return an appropriate PKSreader for a Parkes Multibeam dataset.
00055 class PKSreader* getPKSreader(
00056         const String name,
00057         const Int retry,
00058         const Int interpolate,
00059         String &format);
00060 
00061 // As above, but search a list of directories for it.
00062 class PKSreader* getPKSreader(
00063         const String name,
00064         const Vector<String> directories,
00065         const Int retry,
00066         const Int interpolate,
00067         Int    &iDir,
00068         String &format);
00069 
00070 // Open an appropriate PKSreader for a Parkes Multibeam dataset.
00071 class PKSreader* getPKSreader(
00072         const String name,
00073         const String antenna,
00074         const Int retry,
00075         const Int interpolate,
00076         String &format,
00077         Vector<Bool> &beams,
00078         Vector<Bool> &IFs,
00079         Vector<uInt> &nChan,
00080         Vector<uInt> &nPol,
00081         Vector<Bool> &haveXPol,
00082         Bool   &haveBase,
00083         Bool   &haveSpectra);
00084 
00085 // As above, but search a list of directories for it.
00086 class PKSreader* getPKSreader(
00087         const String name,
00088         const String antenna,
00089         const Vector<String> directories,
00090         const Int retry,
00091         const Int interpolate,
00092         Int    &iDir,
00093         String &format,
00094         Vector<Bool> &beams,
00095         Vector<Bool> &IFs,
00096         Vector<uInt> &nChan,
00097         Vector<uInt> &nPol,
00098         Vector<Bool> &haveXPol,
00099         Bool   &haveBase,
00100         Bool   &haveSpectra);
00101 
00102 
00103 class PKSreader
00104 {
00105   public:
00106     // Destructor.
00107     virtual ~PKSreader() {};
00108 
00109     // Open the dataset.
00110     virtual Int open(
00111         const String inName,
00112         const String antenna,
00113         Vector<Bool> &beams,
00114         Vector<Bool> &IFs,
00115         Vector<uInt> &nChan,
00116         Vector<uInt> &nPol,
00117         Vector<Bool> &haveXPol,
00118         Bool   &haveBase,
00119         Bool   &haveSpectra) = 0;
00120 
00121     // Get parameters describing the data.
00122     virtual Int getHeader(
00123         String &observer,
00124         String &project,
00125         String &antName,
00126         Vector<Double> &antPosition,
00127         String &obsType,
00128         String &bunit,
00129         Float  &equinox,
00130         String &dopplerFrame,
00131         Double &mjd,
00132         Double &refFreq,
00133         Double &bandwidth) = 0;
00134 
00135     // Get frequency parameters for each IF.
00136     virtual Int getFreqInfo(
00137         Vector<Double> &startFreq,
00138         Vector<Double> &endFreq) = 0;
00139 
00140     // Set data selection criteria.  Channel numbering is 1-relative, zero or
00141     // negative channel numbers are taken to be offsets from the last channel.
00142     // Coordinate system selection (only supported for SDFITS input):
00143     //   0: equatorial (RA,Dec),
00144     //   1: horizontal (Az,El),
00145     //   2: feed-plane,
00146     //   3: zenithal position angle of feed and elevation, (ZPA,El).
00147     virtual uInt select(
00148         const Vector<Bool> beamSel,
00149         const Vector<Bool> IFsel,
00150         const Vector<Int>  startChan,
00151         const Vector<Int>  endChan,
00152         const Vector<Int>  refChan,
00153         const Bool getSpectra = True,
00154         const Bool getXPol    = False,
00155         const Bool getFeedPos = False,
00156         const Bool getPointing = False,
00157         const Int  coordSys   = 0) = 0;
00158 
00159 
00160     // Find the range of the data selected in time and position.
00161     virtual Int findRange(
00162         Int    &nRow,
00163         Int    &nSel,
00164         Vector<Double> &timeSpan,
00165         Matrix<Double> &positions) = 0;
00166 
00167     // Read the next data record. 
00223     virtual Int read(PKSrecord &pksrec) = 0;
00224 
00225     // Close the input file.
00226     virtual void close() = 0;
00227 
00228   protected:
00229     Bool   cGetFeedPos, cGetSpectra, cGetXPol, cGetPointing;
00230     Int   cCoordSys;
00231 
00232     Vector<uInt> cNChan, cNPol;
00233     Vector<Bool> cHaveXPol;
00234 };
00235 
00236 #endif