Line data Source code
1 : //# CTTimeInterp1.h: Definition for Single-element Cal Interpolation time 2 : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be adressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# 27 : 28 : #ifndef CALTABLES_CTTIMEINTERP1_H 29 : #define CALTABLES_CTTIMEINTERP1_H 30 : 31 : #include <casacore/casa/aips.h> 32 : 33 : #include <synthesis/CalTables/NewCalTable.h> 34 : #include <synthesis/CalTables/RIorAParray.h> 35 : #include <casacore/casa/Arrays/Cube.h> 36 : #include <casacore/scimath/Functionals/Interpolate1D.h> 37 : #include <casacore/casa/Logging/LogMessage.h> 38 : #include <casacore/casa/Logging/LogSink.h> 39 : 40 : namespace casa { //# NAMESPACE CASA - BEGIN 41 : 42 : 43 : class CTTimeInterp1 44 : { 45 : public: 46 : 47 : // Null ctor 48 : // CTTimeInterp1(); // TBD: make private? 49 : 50 : // From NewCalTable 51 : CTTimeInterp1(NewCalTable& ct, 52 : const casacore::String& timetype, 53 : casacore::Array<casacore::Float>& result, 54 : casacore::Array<casacore::Bool>& rflag); 55 : 56 : // Destructor 57 : virtual ~CTTimeInterp1(); 58 : 59 : // Some state info 60 : casacore::Double timeRef() const { return timeRef_; }; 61 5026764 : casacore::String timeType() const { return timeType_; }; 62 : casacore::Vector<casacore::Double> domain() const { return domain_; }; 63 : 64 : // Interpolate, given timestamp; returns T if new result 65 : virtual casacore::Bool interpolate(casacore::Double time); 66 : 67 : // Interpolate, given timestamp and fiducial freq; returns T if new result 68 : virtual casacore::Bool interpolate(casacore::Double newtime, casacore::Double freq); 69 : 70 : virtual void state(casacore::Bool verbose=false); 71 : 72 : // static factory method to make CTTimeInterp1 73 9966 : static CTTimeInterp1* factory(NewCalTable& ct, 74 : const casacore::String& timetype, 75 : casacore::Array<casacore::Float>& result, 76 : casacore::Array<casacore::Bool>& rflag) { 77 9966 : return new casa::CTTimeInterp1(ct,timetype,result,rflag); } 78 : 79 : // Set interpolation type 80 : void setInterpType(casacore::String strtype); 81 : 82 : protected: 83 : 84 : // Find time registration 85 : casacore::Bool findTimeRegistration(casacore::Int& idx,casacore::Bool& exact,casacore::Float newtime); 86 : 87 : // Do phase delay math 88 : void applyPhaseDelay(casacore::Double freq); 89 : 90 : 91 : // The CalTable 92 : // Should be a single antenna, spw 93 : NewCalTable ct_; 94 : 95 : // Access to columns 96 : ROCTMainColumns *mcols_p; 97 : 98 : // Interpolation modes 99 : casacore::String timeType_; 100 : 101 : // Current time, idx 102 : casacore::Double currTime_; 103 : casacore::Int currIdx_; 104 : casacore::Bool lastWasExact_; 105 : 106 : // casacore::Time list 107 : casacore::Double timeRef_; 108 : casacore::Vector<casacore::Float> timelist_; 109 : casacore::Vector<casacore::Double> domain_; 110 : 111 : // Flags list 112 : casacore::Cube<casacore::Bool> flaglist_; 113 : 114 : // Pointer to the time interpolator 115 : casacore::Interpolate1D<casacore::Float,casacore::Array<casacore::Float> > *tInterpolator_p; 116 : 117 : // Phase-delay correction info 118 : casacore::Double cfreq_; 119 : casacore::Cube<casacore::Float> cycles_; // [npar,nchan,ntime] 120 : 121 : // Arrays in which to deposit results 122 : // (ordinarily, these (CASA-casacore::Array) reference external Arrays) 123 : casacore::Array<casacore::Float> result_; 124 : casacore::Array<casacore::Bool> rflag_; 125 : 126 : }; 127 : 128 : // Pointer to static factory methods for CTTimeInterp1 129 : typedef CTTimeInterp1* (*CTTIFactoryPtr)(NewCalTable&, 130 : const casacore::String&, 131 : casacore::Array<casacore::Float>&, 132 : casacore::Array<casacore::Bool>&); 133 : 134 : } //# NAMESPACE CASA - END 135 : 136 : #endif