[1325] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# PKSFITSreader.h: Class to read Parkes Multibeam data from a FITS file. |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
[1427] | 4 | //# Copyright (C) 2000-2008 |
---|
[1325] | 5 | //# Associated Universities, Inc. Washington DC, USA. |
---|
| 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 AIPS++ should be addressed as follows: |
---|
| 22 | //# Internet email: aips2-request@nrao.edu. |
---|
| 23 | //# Postal address: AIPS++ Project Office |
---|
| 24 | //# National Radio Astronomy Observatory |
---|
| 25 | //# 520 Edgemont Road |
---|
| 26 | //# Charlottesville, VA 22903-2475 USA |
---|
| 27 | //# |
---|
[1452] | 28 | //# $Id: PKSFITSreader.h,v 19.17 2008-11-17 06:38:05 cal103 Exp $ |
---|
[1325] | 29 | //#--------------------------------------------------------------------------- |
---|
| 30 | //# This class is basically a wrapper class for reading data from either an |
---|
| 31 | //# MBFITS (single dish variant of RPFITS) or SDFITS file using the relevant |
---|
| 32 | //# lower-level classes. It translates AIPS++isms to/from basic C++. |
---|
| 33 | //# |
---|
| 34 | //# Original: 2000/08/02, Mark Calabretta, ATNF |
---|
| 35 | //#--------------------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | #ifndef ATNF_PKSFITSREADER_H |
---|
| 38 | #define ATNF_PKSFITSREADER_H |
---|
| 39 | |
---|
| 40 | #include <atnf/PKSIO/FITSreader.h> |
---|
[1452] | 41 | #include <atnf/PKSIO/PKSrecord.h> |
---|
[1325] | 42 | #include <atnf/PKSIO/PKSreader.h> |
---|
| 43 | |
---|
| 44 | #include <casa/aips.h> |
---|
[1452] | 45 | #include <casa/stdio.h> |
---|
[1325] | 46 | #include <casa/Arrays/Vector.h> |
---|
| 47 | #include <casa/Arrays/Matrix.h> |
---|
| 48 | #include <casa/BasicSL/Complex.h> |
---|
| 49 | #include <casa/BasicSL/String.h> |
---|
| 50 | |
---|
[1452] | 51 | #include <casa/namespace.h> |
---|
| 52 | |
---|
[1325] | 53 | // <summary> |
---|
| 54 | // Class to read Parkes Multibeam data from a FITS file. |
---|
| 55 | // </summary> |
---|
| 56 | |
---|
| 57 | class PKSFITSreader : public PKSreader |
---|
| 58 | { |
---|
| 59 | public: |
---|
| 60 | // Default constructor. |
---|
| 61 | PKSFITSreader( |
---|
| 62 | const String fitsType, |
---|
| 63 | const Int retry = 0, |
---|
| 64 | const Bool interpolate = True); |
---|
| 65 | |
---|
| 66 | // Destructor. |
---|
| 67 | virtual ~PKSFITSreader(); |
---|
| 68 | |
---|
[1452] | 69 | // Set message disposition. |
---|
| 70 | virtual Int setMsg( |
---|
| 71 | FILE *fd = 0x0); |
---|
| 72 | |
---|
[1325] | 73 | // Open the FITS file for reading. |
---|
| 74 | virtual Int open( |
---|
| 75 | const String fitsName, |
---|
| 76 | Vector<Bool> &beams, |
---|
| 77 | Vector<Bool> &IFs, |
---|
| 78 | Vector<uInt> &nChan, |
---|
| 79 | Vector<uInt> &nPol, |
---|
| 80 | Vector<Bool> &haveXPol, |
---|
| 81 | Bool &haveBase, |
---|
| 82 | Bool &haveSpectra); |
---|
| 83 | |
---|
| 84 | // Get parameters describing the data. |
---|
| 85 | virtual Int getHeader( |
---|
| 86 | String &observer, |
---|
| 87 | String &project, |
---|
| 88 | String &antName, |
---|
| 89 | Vector<Double> &antPosition, |
---|
| 90 | String &obsType, |
---|
[1399] | 91 | String &bunit, |
---|
[1325] | 92 | Float &equinox, |
---|
| 93 | String &dopplerFrame, |
---|
| 94 | Double &mjd, |
---|
| 95 | Double &refFreq, |
---|
| 96 | Double &bandwidth); |
---|
| 97 | |
---|
| 98 | // Get frequency parameters for each IF. |
---|
| 99 | virtual Int getFreqInfo( |
---|
| 100 | Vector<Double> &startFreq, |
---|
| 101 | Vector<Double> &endFreq); |
---|
| 102 | |
---|
| 103 | // Set data selection criteria. Channel numbering is 1-relative, zero or |
---|
| 104 | // negative channel numbers are taken to be offsets from the last channel. |
---|
| 105 | virtual uInt select( |
---|
| 106 | const Vector<Bool> beamSel, |
---|
| 107 | const Vector<Bool> IFsel, |
---|
| 108 | const Vector<Int> startChan, |
---|
| 109 | const Vector<Int> endChan, |
---|
| 110 | const Vector<Int> refChan, |
---|
| 111 | const Bool getSpectra = True, |
---|
| 112 | const Bool getXPol = False, |
---|
[1452] | 113 | const Int coordSys = 0); |
---|
[1325] | 114 | |
---|
| 115 | // Find the range of the data selected in time and position. |
---|
| 116 | virtual Int findRange( |
---|
| 117 | Int &nRow, |
---|
| 118 | Int &nSel, |
---|
| 119 | Vector<Double> &timeSpan, |
---|
| 120 | Matrix<Double> &positions); |
---|
| 121 | |
---|
| 122 | // Read the next data record. |
---|
[1452] | 123 | virtual Int read(PKSrecord &pksrec); |
---|
[1325] | 124 | |
---|
| 125 | // Close the FITS file. |
---|
| 126 | virtual void close(); |
---|
| 127 | |
---|
| 128 | private: |
---|
| 129 | Int *cBeams, *cIFs; |
---|
| 130 | uInt cNBeam, cNIF; |
---|
[1452] | 131 | MBrecord cMBrec; |
---|
[1325] | 132 | FITSreader *cReader; |
---|
| 133 | |
---|
| 134 | Char* trim(char *string); |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | #endif |
---|