casa
$Rev:20696$
|
00001 //# GBTMultiACSTable.h: GBT multi-bank backend table for the ACS. 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_GBTMULTIACSTABLE_H 00030 #define NRAO_GBTMULTIACSTABLE_H 00031 00032 #include <nrao/FITS/GBTBackendTable.h> 00033 #include <nrao/FITS/GBTScanLogReader.h> 00034 #include <nrao/FITS/GBTACSTable.h> 00035 00036 #include <casa/Arrays/Vector.h> 00037 #include <casa/Containers/Block.h> 00038 #include <casa/Containers/SimOrdMap.h> 00039 #include <tables/Tables/Table.h> 00040 #include <tables/Tables/TableRow.h> 00041 #include <casa/BasicSL/String.h> 00042 00043 #include <casa/namespace.h> 00044 //# forward includes 00045 namespace casa { //# NAMESPACE CASA - BEGIN 00046 class Record; 00047 class RecordDesc; 00048 class TableRecord; 00049 template <class T> class Array; 00050 } //# NAMESPACE CASA - END 00051 00052 class GBTStateTable; 00053 00054 00055 // <summary> 00056 // A GBTMultiBackendTable for the ACS 00057 // </summary> 00058 // 00059 // <use visibility=export> 00060 // 00061 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00062 // </reviewed> 00063 // 00064 // <prerequisite> 00065 // </prerequisite> 00066 // 00067 // <etymology> 00068 // </etymology> 00069 // 00070 // <synopsis> 00071 // GBTMultiACStTable is a GBTACSTable holding 00072 // data from multiple banks. It makes it look as if it all 00073 // came from the same data source. In order for this 00074 // to work. The ACT_STATE and STATE tables must be the 00075 // same in all banks and the integration time in each 00076 // bank must be the same. 00077 // </synopsis> 00078 // 00079 // <example> 00080 // </example> 00081 // 00082 // <motivation> 00083 // </motivation> 00084 00085 class GBTMultiACSTable : public GBTBackendTable 00086 { 00087 public: 00088 // Construct it from a vector of file names 00089 GBTMultiACSTable(const Vector<String> &fileNames, 00090 GBTACSTable::VanVleckCorr vanVleckCorr=GBTACSTable::DefaultVanVleck, 00091 GBTACSTable::Smoothing smoothing = GBTACSTable::DefaultSmoothing, 00092 Int vvsize=65, Bool useDCBias = False, Double dcbias=0.0, 00093 Int minbiasfactor=-1, Bool fixlags = False, String fixlagslog="", 00094 Double sigmaFactor=6.0, Int spikeStart=200); 00095 00096 ~GBTMultiACSTable(); 00097 00098 // Attach this GBTMultiACSTable to a new set of file names. 00099 // If fileNames are the same as the 00100 // currently opened filse, if there are any, then this just 00101 // closes and reopens the FITS files, setting things right 00102 // back to the next row in each table, if there are any. 00103 virtual Bool reopen(const Vector<String> &fileNames, Bool resync=True); 00104 00105 // reopen if there's just one file 00106 virtual Bool reopen(const String &fileName, Bool resync) 00107 {return reopen(Vector<String>(1,fileName), resync);} 00108 00109 // This is necessary to avoid hiding the FITSTabular version 00110 virtual Bool reopen(const String &fileName) {return reopen(fileName,True);} 00111 00112 // Return the type of this backend 00113 GBTScanLogReader::BACKENDS type() const {return GBTScanLogReader::ACS;} 00114 00115 // Returns the name of the file serving up the default bank 00116 virtual const String &name() const {return defBank().name();} 00117 00118 virtual const Vector<String> &names() const {return itsFiles;} 00119 00120 // Is everything okay. 00121 virtual Bool isValid() const {return itsValid;} 00122 00123 // The number of elements along the STATE axis 00124 virtual uInt nstate() const {return defBank().nstate();} 00125 00126 // The number of elements along the frequency axis (default to 1 00127 // for non-spectral line data) for a specific sampler. 00128 virtual uInt nchan(uInt whichSampler) const; 00129 00130 // The bandwidth of the indicated sampler. If this is < 0 then that 00131 // signals that it is not known here and it should be fetched from 00132 // the IF BANDWDTH column. 00133 virtual Double bw(uInt whichSampler) const; 00134 00135 // The center IF for the indicated sampler. If this is < 0 then that 00136 // signals that it is not known here and it should be fetched from 00137 // the IF CENTER_IF column. 00138 virtual Double centerIF(uInt whichSampler) const; 00139 00140 // Indicates whether frequency increases with channel number for the 00141 // given sampler. 00142 virtual Bool increases(uInt whichSampler) const; 00143 00144 // The keywords from the FITS data tables merged into a single record. 00145 virtual const TableRecord &keywords() const {return defBank().keywords();} 00146 00147 // advance to the next row in all tables 00148 virtual void next(); 00149 00150 // return the current row in the default underlying table 00151 // It is here because of inheritance but it should not be used. 00152 virtual const Record ¤tRow() const {return defBank().currentRow();} 00153 00154 // The unhandled keywords 00155 virtual const Record &unhandledKeywords() {return defBank().unhandledKeywords();} 00156 00157 // Mark a keyword as handled; 00158 virtual void handleKeyword(const String &kwname) {defBank().handleKeyword(kwname);} 00159 00160 virtual const RecordDesc &description() const {return defBank().description();} 00161 virtual const Record &units() const {return defBank().units();} 00162 virtual const Record &displayFormats() const {return defBank().displayFormats();} 00163 virtual const Record &nulls() const {return defBank().nulls();} 00164 00165 // Return the unhandled fields in the current row of the current table 00166 virtual const Record &unhandledFields() {return defBank().unhandledFields();} 00167 00168 // Mark a field in the current row of all tables as being handled. 00169 virtual void handleField(const String &fieldname) {defBank().handleField(fieldname);} 00170 00171 // The ancilliary tables 00172 // <group> 00173 virtual const Table &sampler() const {return itsSampler;} 00174 virtual const GBTStateTable &state() const {return defBank().state();} 00175 virtual const Table &actState() const {return defBank().actState();} 00176 virtual const Table &port() const {return itsPort;} 00177 // </group> 00178 00179 // Total number of rows in each bank (should be the same) 00180 virtual uInt nrow() const {return defBank().nrow();} 00181 00182 // This specific row (relative to total from all banks) 00183 virtual uInt rownr() const {return defBank().rownr();} 00184 00185 // FITSVER - should be the same for all banks 00186 virtual const String &fitsVers() const {return defBank().fitsVers();} 00187 00188 // Leading integer (before decimal) of FITSVER 00189 virtual Int baseVersion() const {return defBank().baseVersion();} 00190 00191 // Trailing integer(after decimal) of FITSVER 00192 virtual Int deviceVersion() const {return defBank().deviceVersion();} 00193 00194 // get the raw data at the current row. 00195 virtual const Array<Float> rawdata(uInt whichSampler); 00196 00197 // get the data for the current row, applying the indicated vanVleck 00198 // correction and smoothing for the Schwab correction, use the indicated 00199 // table size. If useDCBias is True, an attempt is made to use the 00200 // DCBias (average of the autocorrelations over the last 5% of the lags) in 00201 // the van vleck correction if the Schwab correction is specified. 00202 virtual const Array<Float> data(uInt whichSampler); 00203 00204 // get the zero channel for the current row, vanVleck correction is 00205 // applied. It is only done once for each row, independent of whether 00206 // data or zeroChannel are called first. 00207 virtual const Array<Float> zeroChannel(uInt whichSampler); 00208 00209 // is the data in the current row bad. It is only done once for each row, 00210 // independent of whether data, zeroChannel, or badData are called first. 00211 virtual const Array<Bool> badData(uInt whichSampler); 00212 00213 // Do the switching signals in ACT_STATE follow the 00214 // documentation? Prior to FITSVER 1.2 they had the 00215 // opposite sense. 00216 virtual Bool switchOK() const {return defBank().switchOK();} 00217 00218 // return the number of sampler levels for the indicate sampler 00219 virtual Int nlevels(uInt whichSampler) const; 00220 00221 // The value of the INTEGRAT field in the current row for 00222 // the given sampler and state 00223 virtual Float integrat(uInt whichSampler, uInt whichState) const; 00224 00225 // The DMJD value from the current row 00226 virtual Double dmjd() {return defBank().dmjd();} 00227 00228 // The value of the TIME-MID field in the current row 00229 virtual Double timeMid() {return defBank().timeMid();} 00230 00231 // A string comprising the banks to be filled 00232 virtual String banks() {return itsBankNames;} 00233 private: 00234 Bool itsValid; 00235 00236 GBTACSTable::VanVleckCorr itsVVCorr; 00237 GBTACSTable::Smoothing itsSmoothing; 00238 Int itsVVSize, itsMinbiasfactor, itsSpikeStart; 00239 Bool itsUseDCBias, itsFixlags; 00240 Double itsDCBias, itsSigmaFactor; 00241 00242 Vector<String> itsFiles; 00243 00244 Table itsSampler, itsPort; 00245 TableRow itsSamplerRow, itsPortRow; 00246 00247 //# The individual banks, there should never be more than 4 00248 Block<GBTACSTable *> itsBanks; 00249 00250 //# the index of the 0 sampler in that bloc 00251 Block<uInt> itsSampler0; 00252 00253 uInt itsNbanks; 00254 00255 String itsBankNames; 00256 00257 //# maps from requested sampler to index into bank blocks 00258 SimpleOrderedMap<uInt, uInt> itsBankMap; 00259 00260 String itsFixLagsLog; 00261 00262 Bool init(Bool resync=False); 00263 00264 GBTACSTable &defBank() const {return *(itsBanks[0]);} 00265 00266 // Undefined and inaccessible. 00267 GBTMultiACSTable(); 00268 GBTMultiACSTable(const GBTMultiACSTable &); 00269 GBTMultiACSTable &operator=(const GBTMultiACSTable &); 00270 }; 00271 00272 00273 #endif