casa
$Rev:20696$
|
00001 //#--------------------------------------------------------------------------- 00002 //# PKSFITSreader.h: Class to read Parkes Multibeam data from a FITS file. 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: PKSFITSreader.h,v 19.18 2009-09-29 07:33:38 cal103 Exp $ 00032 //#--------------------------------------------------------------------------- 00033 //# This class is basically a wrapper class for reading data from either an 00034 //# MBFITS (single dish variant of RPFITS) or SDFITS file using the relevant 00035 //# lower-level classes. It translates AIPS++isms to/from basic C++. 00036 //# 00037 //# Original: 2000/08/02, Mark Calabretta, ATNF 00038 //#--------------------------------------------------------------------------- 00039 00040 #ifndef ATNF_PKSFITSREADER_H 00041 #define ATNF_PKSFITSREADER_H 00042 00043 #include <atnf/PKSIO/FITSreader.h> 00044 #include <atnf/PKSIO/PKSrecord.h> 00045 #include <atnf/PKSIO/PKSreader.h> 00046 00047 #include <casa/aips.h> 00048 #include <casa/stdio.h> 00049 #include <casa/Arrays/Vector.h> 00050 #include <casa/Arrays/Matrix.h> 00051 #include <casa/BasicSL/Complex.h> 00052 #include <casa/BasicSL/String.h> 00053 00054 #include <casa/namespace.h> 00055 00056 // <summary> 00057 // Class to read Parkes Multibeam data from a FITS file. 00058 // </summary> 00059 00060 class PKSFITSreader : public PKSreader 00061 { 00062 public: 00063 // Default constructor. 00064 PKSFITSreader( 00065 const String fitsType, 00066 const Int retry = 0, 00067 const Bool interpolate = True); 00068 00069 // Destructor. 00070 virtual ~PKSFITSreader(); 00071 00072 // Open the FITS file for reading. 00073 virtual Int open( 00074 const String fitsName, 00075 const String antenna, 00076 Vector<Bool> &beams, 00077 Vector<Bool> &IFs, 00078 Vector<uInt> &nChan, 00079 Vector<uInt> &nPol, 00080 Vector<Bool> &haveXPol, 00081 Bool &haveBase, 00082 Bool &haveSpectra); 00083 00084 // Get parameters describing the data. 00085 virtual Int getHeader( 00086 String &observer, 00087 String &project, 00088 String &antName, 00089 Vector<Double> &antPosition, 00090 String &obsType, 00091 String &bunit, 00092 Float &equinox, 00093 String &dopplerFrame, 00094 Double &mjd, 00095 Double &refFreq, 00096 Double &bandwidth); 00097 00098 // Get frequency parameters for each IF. 00099 virtual Int getFreqInfo( 00100 Vector<Double> &startFreq, 00101 Vector<Double> &endFreq); 00102 00103 // Set data selection criteria. Channel numbering is 1-relative, zero or 00104 // negative channel numbers are taken to be offsets from the last channel. 00105 virtual uInt select( 00106 const Vector<Bool> beamSel, 00107 const Vector<Bool> IFsel, 00108 const Vector<Int> startChan, 00109 const Vector<Int> endChan, 00110 const Vector<Int> refChan, 00111 const Bool getSpectra = True, 00112 const Bool getXPol = False, 00113 const Bool getFeedPos = False, 00114 const Bool getPointing = False, 00115 const Int coordSys = 0); 00116 00117 // Find the range of the data selected in time and position. 00118 virtual Int findRange( 00119 Int &nRow, 00120 Int &nSel, 00121 Vector<Double> &timeSpan, 00122 Matrix<Double> &positions); 00123 00124 // Read the next data record. 00125 virtual Int read(PKSrecord &pksrec); 00126 00127 // Close the FITS file. 00128 virtual void close(); 00129 00130 private: 00131 Int *cBeams, *cIFs; 00132 uInt cNBeam, cNIF; 00133 MBrecord cMBrec; 00134 FITSreader *cReader; 00135 00136 Char* trim(char *string); 00137 }; 00138 00139 #endif