casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
KJones.h
Go to the documentation of this file.
00001 //# KJones.h: Declaration of delay-like (geometry) calibration types
00002 //# Copyright (C) 1996,1997,2000,2001,2002,2003,2011
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 SYNTHESIS_KJONES_H
00029 #define SYNTHESIS_KJONES_H
00030 
00031 #include <casa/aips.h>
00032 #include <synthesis/MeasurementComponents/StandardVisCal.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 // Forward declarations
00037 
00038 // K Jones provides support for SBD delays
00039 class KJones : public GJones {
00040 public:
00041 
00042   // Constructor
00043   KJones(VisSet& vs);
00044   KJones(const Int& nAnt);
00045 
00046   virtual ~KJones();
00047 
00048   // Local setApply to enforce calWt=F for delays
00049   virtual void setApply(const Record& apply);
00050   using GJones::setApply;
00051 
00052   // Local setSolve (traps lack of refant)
00053   virtual void setSolve(const Record& solve);
00054   using GJones::setSolve;
00055 
00056   // We have Float parameters
00057   virtual VisCalEnum::VCParType parType() { return VisCalEnum::REAL; };
00058 
00059   // Return the type enum
00060   virtual Type type() { return VisCal::K; };
00061 
00062   // Return type name as string
00063   virtual String typeName()     { return "K Jones"; };
00064   virtual String longTypeName() { return "K Jones (single-band delay)"; };
00065 
00066   // Type of Jones matrix according to nPar()
00067   virtual Jones::JonesType jonesType() { return Jones::Diagonal; };
00068 
00069   // Freq dependence (delays)
00070   virtual Bool freqDepPar() { return False; };
00071   virtual Bool freqDepMat() { return True; };
00072 
00073   // Default parameter value
00074   virtual Complex defaultPar() { return Complex(0.0); };
00075 
00076   // Type-specific specify
00077   virtual void specify(const Record& specify);
00078 
00079   // This type is not yet accumulatable
00080   virtual Bool accumulatable() { return False; };
00081 
00082   // This type is smoothable
00083   virtual Bool smoothable() { return True; };
00084 
00085   // Calculate phase(chan) from delay
00086   virtual void calcAllJones();
00087 
00088   // Delay to phase calculator
00089   //  virtual void calcOneJones(Vector<Complex>& mat, Vector<Bool>& mOk, 
00090   //                            const Vector<Complex>& par, const Vector<Bool>& pOk );
00091 
00092 
00093   // Hazard a guess at parameters (unneeded here)
00094   virtual void guessPar(VisBuffer& ) {};
00095 
00096   // K now uses generic gather, but solves for itself per solution
00097   virtual Bool useGenericGatherForSolve() { return True; };
00098   virtual Bool useGenericSolveOne() { return False; }
00099 
00100   // Override G here; nothing to do for K, for now
00101   virtual void globalPostSolveTinker() {};
00102 
00103 
00104 protected:
00105 
00106   // K has two "real" parameters
00107   virtual Int nPar() { return 2; };
00108 
00109   // Jones matrix elements are trivial
00110   virtual Bool trivialJonesElem() { return False; };
00111 
00112   // dG/dp are trivial
00113   virtual Bool trivialDJ() { return False; };
00114 
00115   // Initialize trivial dJs
00116   virtual void initTrivDJ() {};
00117 
00118   // Local implementation of selfSolveOne (generalized signature)
00119   virtual void selfSolveOne(VisBuffGroupAcc& vbga);
00120 
00121   // FFT solver for on VB
00122   virtual void solveOneVB(const VisBuffer& vb);
00123 
00124   // Reference frequencies
00125   Vector<Double> KrefFreqs_;
00126 
00127 private:
00128 
00129   
00130 };
00131 
00132 // (sbd) K for cross-hand solve
00133 class KcrossJones : public KJones {
00134 public:
00135 
00136   // Constructor
00137   KcrossJones(VisSet& vs);
00138   KcrossJones(const Int& nAnt);
00139 
00140   virtual ~KcrossJones();
00141 
00142   // Return type name as string
00143   virtual String typeName()     { return "Kcross Jones"; };
00144   virtual String longTypeName() { return "Kcross Jones (single-band cross delay)"; };
00145 
00146   // By definition, we consider cross-hands
00147   virtual Bool phandonly() { return False; };
00148 
00149 protected:
00150 
00151   // FFT solver for on VB, that collapses baselines and cross-hands first
00152   virtual void solveOneVB(const VisBuffer& vb);
00153 
00154 };
00155 
00156 
00157 // KMBD Jones provides support for multi-band delays
00158 class KMBDJones : public KJones {
00159 public:
00160 
00161   // Constructor
00162   KMBDJones(VisSet& vs);
00163   KMBDJones(const Int& nAnt);
00164 
00165   virtual ~KMBDJones();
00166 
00167   // Return the type enum
00168   virtual Type type() { return VisCal::K; };
00169 
00170   // Return type name as string
00171   virtual String typeName()     { return "KMBD Jones"; };
00172   virtual String longTypeName() { return "KMBD Jones (multi-band delay)"; };
00173 
00174   // Local setApply (to enforce KrefFreq_=0.0)
00175   virtual void setApply(const Record& apply);
00176 
00177  
00178 };
00179 
00180 
00181 
00182 class KAntPosJones : public KJones {
00183 public:
00184 
00185   // Constructor
00186   KAntPosJones(VisSet& vs);
00187   KAntPosJones(const Int& nAnt);
00188 
00189   virtual ~KAntPosJones();
00190 
00191   // Return the type enum
00192   virtual Type type() { return VisCal::KAntPos; };
00193 
00194   // Return type name as string
00195   virtual String typeName()     { return "KAntPos Jones"; };
00196   virtual String longTypeName() { return "KAntPos Jones (antenna position errors)"; };
00197 
00198   // This is a scalar Jones matrix
00199   virtual Jones::JonesType jonesType() { return Jones::Scalar; };
00200 
00201   virtual Bool timeDepMat() { return True; };
00202 
00203   // This type is not smoothable
00204   virtual Bool smoothable() { return False; };
00205 
00206   // Local setApply to enforce spwmap=0 for all spw
00207   virtual void setApply(const Record& apply);
00208   using KJones::setApply;
00209 
00210   // Type-specific specify
00211   virtual void specify(const Record& specify);
00212 
00213   // Calculate phase(chan) from delay
00214   virtual void calcAllJones();
00215 
00216 protected:
00217 
00218   // AntPos has three "real" parameters (dBx, dBy, dBz)
00219   virtual Int nPar() { return 3; };
00220 
00221   // Jones matrix elements are not trivial
00222   virtual Bool trivialJonesElem() { return False; };
00223 
00224   // dG/dp are not trivial
00225   virtual Bool trivialDJ() { return False; };
00226 
00227   // Initialize trivial dJs
00228   virtual void initTrivDJ() {};
00229 
00230 private:
00231   
00232   // Some info from the MS we need for Measures work
00233   ArrayMeasColumn<MDirection> dirmeas_p;
00234   String epochref_p;
00235 
00236 };
00237 
00238 } //# NAMESPACE CASA - END
00239 
00240 #endif