casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CTTimeInterp1.h
Go to the documentation of this file.
00001 //# CTTimeInterp1.h: Definition for Single-element Cal Interpolation time
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,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 adressed 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 
00028 #ifndef CALTABLES_CTTIMEINTERP1_H
00029 #define CALTABLES_CTTIMEINTERP1_H
00030 
00031 #include <casa/aips.h>
00032 
00033 #include <synthesis/CalTables/NewCalTable.h>
00034 #include <synthesis/CalTables/RIorAParray.h>
00035 #include <casa/Arrays/Cube.h>
00036 #include <scimath/Functionals/Interpolate1D.h>
00037 #include <casa/Logging/LogMessage.h>
00038 #include <casa/Logging/LogSink.h>
00039 
00040 namespace casa { //# NAMESPACE CASA - BEGIN
00041 
00042 
00043 class CTTimeInterp1
00044 {
00045 public:
00046 
00047   // Null ctor 
00048   //  CTTimeInterp1();  // TBD: make private?
00049 
00050   // From NewCalTable
00051   CTTimeInterp1(NewCalTable& ct,
00052                 const String& timetype,
00053                 Array<Float>& result,
00054                 Array<Bool>& rflag);
00055 
00056   // Destructor
00057   virtual ~CTTimeInterp1();
00058 
00059   // Some state info
00060   Double timeRef() { return timeRef_; };
00061   String timeType() { return timeType_; };
00062   Vector<Double> domain() { return domain_; };
00063 
00064   // Set interpolation type
00065   void setInterpType(String strtype);
00066 
00067   // Interpolate, given timestamp; returns T if new result
00068   Bool interpolate(Double time);
00069 
00070   // Interpolate, given timestamp and fiducial freq; returns T if new result
00071   Bool interpolate(Double newtime, Double freq);
00072 
00073   void state(Bool verbose=False);
00074 
00075 private:
00076   
00077   // Find 
00078   Bool findTimeRegistration(Int& idx,Bool& exact,Float newtime);
00079 
00080   // 
00081   void applyPhaseDelay(Double freq);
00082 
00083 
00084   // The CalTable 
00085   //  Should be a single antenna, spw
00086   NewCalTable ct_;
00087 
00088   // Access to columns
00089   ROCTMainColumns *mcols_p;
00090 
00091   // Interpolation modes
00092   String timeType_;
00093 
00094   // Current time, idx
00095   Double currTime_;
00096   Int currIdx_;
00097   Bool lastWasExact_;
00098 
00099   // Time list
00100   Double timeRef_;
00101   Vector<Float> timelist_;
00102   Vector<Double> domain_;
00103 
00104   // Flags list
00105   Cube<Bool> flaglist_;
00106 
00107   // Pointer to the time interpolator
00108   Interpolate1D<Float,Array<Float> > *tInterpolator_p;
00109 
00110   // Phase-delay correction info
00111   Double cfreq_;
00112   Cube<Float> cycles_;   // [npar,nchan,ntime]
00113   
00114   // Arrays in which to deposit results
00115   //  (ordinarily, these (CASA-Array) reference external Arrays)
00116   Array<Float> result_;
00117   Array<Bool> rflag_;
00118 
00119 };
00120 
00121 
00122 } //# NAMESPACE CASA - END
00123 
00124 #endif