casa
$Rev:20696$
|
00001 //# GBTLO1DAPFiller: A GBTDAPFiller for LO1 DAPs 00002 //# Copyright (C) 2000,2001 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_GBTLO1DAPFILLER_H 00030 #define NRAO_GBTLO1DAPFILLER_H 00031 00032 #include <nrao/GBTFillers/GBTDAPFiller.h> 00033 00034 #include <casa/Arrays/Vector.h> 00035 #include <tables/Tables/Table.h> 00036 #include <tables/Tables/ScalarColumn.h> 00037 00038 //# Forward declarations 00039 namespace casa { //# NAMESPACE CASA - BEGIN 00040 class String; 00041 } //# NAMESPACE CASA - END 00042 00043 #include <casa/namespace.h> 00044 00045 // <summary> 00046 // A GBTDAPFiller for LO1 DAPs. 00047 // </summary> 00048 00049 // <use visibility=local> 00050 00051 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00052 // </reviewed> 00053 00054 // <prerequisite> 00055 // <li> GBT DAP FITS files 00056 // <li> GBTLO1DAPFillerBase.h 00057 // </prerequisite> 00058 // 00059 // <etymology> 00060 // This fills GBT DAP FITS file from the LO1 device into a subtable of 00061 // the MS. 00062 // </etymology> 00063 // 00064 // <synopsis> 00065 // </synopsis> 00066 // 00067 // <example> 00068 // </example> 00069 // 00070 // <motivation> 00071 // It is necessary to have access to the frequency information during each scan 00072 // for use in filling other parts of the MS. 00073 // </motivation> 00074 // 00075 // <thrown> 00076 // <li> 00077 // <li> 00078 // </thrown> 00079 // 00080 00081 class GBTLO1DAPFiller : public GBTDAPFiller 00082 { 00083 public: 00084 // makes new one if not already present in parent, otherwise 00085 // it opens that one up as is 00086 GBTLO1DAPFiller(const String &device, Table &parent); 00087 00088 virtual ~GBTLO1DAPFiller(); 00089 00090 virtual Int prepare(const String &fileName, const String &manager, 00091 const String &sampler, const MVTime &startTime); 00092 00093 // fill to the standard table attached to the parent used at construction 00094 virtual void fill(); 00095 00096 // Return the frequency for the given the phase numbers, given the time and interval 00097 // Time is in MJD seconds UT and interval is in seconds. 00098 // These values are based on the results of the most recent fill. 00099 // A value of 0.0 is returned for all phases if there are no rows within the 00100 // specified time interval 00101 const Vector<Double> &frequency(Double time, Double interval, Int nphases); 00102 00103 // return the value of the frequency column in the first row 00104 Double initialFreq() { return ((nrow()>0) ? itsFrequencyColumn.asdouble(0) : 0.0); } 00105 00106 // how many rows are in the underlying table 00107 uInt nrow() {return ( itsLO1Table ? itsLO1Table->nrow() : 0);} 00108 00109 private: 00110 Table *itsLO1Table; 00111 ROScalarColumn<Double> itsFrequencyColumn, itsTimeColumn; 00112 ROScalarColumn<Int> itsPhaseColumn; 00113 00114 Int itsCachePtr, itsCacheStart, itsCacheEnd, itsCacheSize; 00115 Bool itsHasPhaseState; 00116 00117 Vector<Double> itsFreqs; 00118 00119 Vector<Double> itsTimeCache, itsFreqCache; 00120 Vector<Int> itsPhaseCache; 00121 00122 void cleanup(); 00123 void nextCache(); 00124 void prevCache(); 00125 00126 Bool atCacheEnd() {return itsFrequencyColumn.isNull() || 00127 itsCacheEnd >= (Int(itsFrequencyColumn.nrow())-1);} 00128 Bool atCacheStart() {return itsFrequencyColumn.isNull() || itsCacheStart <= 0;} 00129 Bool atEnd() {return itsCachePtr >= (Int(itsFreqCache.nelements())-1) && atCacheEnd();} 00130 Bool atStart() {return itsCachePtr <= 0 && atCacheStart();} 00131 00132 // unavailable, undefined 00133 GBTLO1DAPFiller(); 00134 GBTLO1DAPFiller(const GBTLO1DAPFiller &); 00135 GBTLO1DAPFiller &operator=(const GBTLO1DAPFiller &); 00136 }; 00137 00138 #endif 00139 00140