casa
$Rev:20696$
|
00001 //# GBTFeedDDFiller: This class fills the FEED and DATA_DESC tables 00002 //# Copyright (C) 2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id$ 00028 00029 #ifndef NRAO_GBTFEEDDDFILLER_H 00030 #define NRAO_GBTFEEDDDFILLER_H 00031 00032 #include <nrao/GBTFillers/GBTCorrelation.h> 00033 #include <nrao/GBTFillers/GBTFeed.h> 00034 #include <nrao/GBTFillers/GBTIF.h> 00035 00036 #include <casa/aips.h> 00037 #include <casa/Arrays/Vector.h> 00038 #include <casa/Containers/Block.h> 00039 #include <casa/Containers/SimOrdMap.h> 00040 00041 #include <nrao/GBTFillers/GBTMSDataDescFiller.h> 00042 #include <nrao/GBTFillers/GBTMSFeedFiller.h> 00043 #include <nrao/GBTFillers/GBTMSPolarizationFiller.h> 00044 #include <nrao/GBTFillers/GBTMSSpecWinFiller.h> 00045 00046 //# Forward Declarations 00047 namespace casa { //# NAMESPACE CASA - BEGIN 00048 class MeasurementSet; 00049 } //# NAMESPACE CASA - END 00050 00051 #include <casa/namespace.h> 00052 00053 class GBTBackendTable; 00054 class GBTIFFiller; 00055 class GBTAntennaFile; 00056 class GBTLO1File; 00057 00058 // <summary> 00059 // This class fills the FEED and DATA_DESCRIPTION tables for GBT data. 00060 // </summary> 00061 00062 // <use visibility=local> 00063 00064 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tGBTFeedDDFIller.cc" demos=""> 00065 // </reviewed> 00066 00067 // <prerequisite> 00068 // <li> MeasurementSet FEED table 00069 // <li> MeasurementSet DATA_DESCRIPTION, POLARIZATION, and SPECTRAL_WINDOW tables. 00070 // <li> GBT FITS files 00071 // </prerequisite> 00072 // 00073 // <etymology> 00074 // This class takes the GBT backend FITS file, IF manager file and Antenna manager 00075 // file for a scan, digests them so that each sampler is associated with a FEED 00076 // and IF. At that point, the FEED, POLARIZATION, SPECTRAL_WINDOW, and DATA_DESCRIPTION 00077 // tables can all be filled. 00078 // </etymology> 00079 // 00080 // <synopsis> 00081 // </synopsis> 00082 // 00083 // <example> 00084 // </example> 00085 // 00086 // <motivation> 00087 // </motivation> 00088 // 00089 00090 class GBTFeedDDFiller 00091 { 00092 public: 00093 // Default constructor, not associated with any parent MeasurementSet. 00094 // This is useful only when this object must exist before the MS does. 00095 // An MS can be attached later. If fill is called before the MS is 00096 // attached, it will return False. 00097 GBTFeedDDFiller(); 00098 00099 // Construct this attached to the associated MS. 00100 GBTFeedDDFiller(MeasurementSet &ms); 00101 00102 ~GBTFeedDDFiller(); 00103 00104 // attach this to a MS, breaks any existing attachments 00105 void attach(MeasurementSet &ms); 00106 00107 Bool isAttached() {return itsAttached;} 00108 00109 // digest the scan using these tables/files and fill to the 00110 // appropriate sub-tables. Returns False if there is no MS 00111 // attached. Selection on a specific backend has already 00112 // occured in the GBTIFFiller setup which should correspond 00113 // to the backend that sampler is from. If 00114 // continuum is True then the doppler info from the LO1 tables will 00115 // be ignored in the GBTIF constructor. Also, at this time 00116 // each correlation will contain just one receptor. 00117 // If bankCheck is true then checks occur which are only appropriate 00118 // to the multi-bank ACS case. 00119 Bool fill(const GBTBackendTable &backend, const GBTIFFiller &iffiller, 00120 const GBTAntennaFile &antFile, const GBTLO1File &lo1aFile, 00121 const GBTLO1File &lo1bFile, const String &swtchsig, 00122 Bool continuum = False, Bool bankCheck = False); 00123 00124 // The number of feeds just filled. 00125 uInt nfeeds() {return itsNfeeds;} 00126 00127 // Number of states for things just filled. 00128 uInt nstates() {return itsNstate;} 00129 00130 // Get a specific GBTFeed - 0 through nfeeds()-1 00131 const GBTFeed &feed(uInt whichFeed) const {return *(itsFeeds[whichFeed]);} 00132 00133 // Get a specific GBTFeed to possibley modify - 0 through nfeeds()-1 00134 GBTFeed &feed(uInt whichFeed) {return *(itsFeeds[whichFeed]);} 00135 00136 // Set the midpoint and interval for this scan - generally this 00137 // isn't known until after most of this information is filled 00138 // and need. This only affects the FEED subtable. 00139 void setTime(Double time, Double interval) {itsFeedFiller.setTime(time, interval);} 00140 00141 // flush all associated fillers 00142 void flush(); 00143 00144 // Does this most recently filled data contain any beam switched data? 00145 Bool hasBeamSwitched() {return itsFeedFiller.hasBeamSwitched();} 00146 00147 // These functions allow one to easily iterate through and get the IDs 00148 // and sampler row numbers for each of the correlations and states 00149 // involved in all feeds in the most recently filled data. 00150 // <group> 00151 // Reset the iterator to the top. 00152 void origin() const; 00153 // The total number of correlations, all feeds. 00154 uInt ncorr() const {return itsNcorr;} 00155 // Move to the next correlation. Can do this ncorr() times after origin(). 00156 void next() const; 00157 // The current feed 00158 const GBTFeed &currFeed() const {return *itsCurrFeedPtr;} 00159 // The current IF 00160 const GBTIF &currIF() const {return *itsCurrIFPtr;} 00161 // The current correlation 00162 const GBTCorrelation &currCorr() const {return *itsCurrCorrPtr;} 00163 // </group> 00164 private: 00165 Bool itsAttached; 00166 //# itsNfeeds is the true number of feeds in use in itsFeeds 00167 uInt itsNfeeds, itsNcorr, itsNstate; 00168 Block<GBTFeed *> itsFeeds; 00169 00170 //# this associates a feed index as seen in the IF manager file 00171 //# with a specific feed in itsFeeds. 00172 SimpleOrderedMap<Int, Int> itsFeedMap; 00173 00174 GBTMSFeedFiller itsFeedFiller; 00175 GBTMSPolarizationFiller itsPolFiller; 00176 GBTMSSpecWinFiller itsSWFiller; 00177 GBTMSDataDescFiller itsDDFiller; 00178 00179 mutable uInt itsCurrFeed, itsCurrIF, itsCurrCorr, 00180 itsCurrNif, itsCurrNcorr, itsCurrCount; 00181 mutable GBTFeed * itsCurrFeedPtr; 00182 mutable GBTIF *itsCurrIFPtr; 00183 mutable GBTCorrelation *itsCurrCorrPtr; 00184 00185 void clear(); 00186 00187 //# these do the actual work in fill 00188 void digestFeeds(const GBTAntennaFile &antFile, const GBTIFFiller &iffiller, 00189 const String &swtchsig); 00190 void digestSampler(const GBTBackendTable &backend, const GBTIFFiller &iffiller, 00191 const GBTLO1File &lo1aFile, const GBTLO1File &lo1bFile, 00192 Bool continuum, Bool bankCheck); 00193 void fillMSSW(); 00194 void findOtherBanks(const GBTIFFiller &iffiller); 00195 00196 //# Undefined and unavailable 00197 GBTFeedDDFiller(const GBTFeedDDFiller &); 00198 GBTFeedDDFiller &operator=(const GBTFeedDDFiller &); 00199 }; 00200 00201 00202 #endif 00203 00204