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 class DelayFFT {
00037 public:
00038   // Construct from freq info and data-like Cube<Complex>
00039   //  (for generic testing w/out MS data)
00040   DelayFFT(Double f0, Double df, Double padBW, 
00041            Cube<Complex> V);
00042 
00043   // Construct from freq info and shape, w/ initialization
00044   //   (for accumulation)
00045   DelayFFT(Double f0, Double df, Double padBW, 
00046            Int nCorr, Int nElem, Int refant, Complex v0);
00047 
00048   // Construct from a VB
00049   DelayFFT(const VisBuffer& vb,Double padBW,Int refant);
00050 
00051   // Perform FFT
00052   void FFT();
00053 
00054   // Apply shift theorem
00055   void shift(Double f);
00056 
00057   // Accumulate another DelayFFT
00058   void add(const DelayFFT& other);
00059 
00060   // Find peaks
00061   void searchPeak();
00062 
00063   const Cube<Complex>& Vpad() const { return Vpad_; };
00064 
00065   // Access to results
00066   const Matrix<Float>& delay() const { return delay_; };
00067   const Matrix<Bool>& flag() const { return flag_; };
00068 
00069   // Report some stateinfo
00070   void state();
00071 
00072 private:
00073   Double f0_, df_, padBW_;
00074   Int nCorr_, nPadChan_, nElem_;
00075   Int refant_;
00076   Cube<Complex> Vpad_;
00077   Matrix<Float> delay_;
00078   Matrix<Bool> flag_;
00079 
00080 };
00081 
00082 
00083 
00084 
00085 
00086 
00087 // Forward declarations
00088 
00089 // K Jones provides support for SBD delays
00090 class KJones : public GJones {
00091 public:
00092 
00093   // Constructor
00094   KJones(VisSet& vs);
00095   KJones(String msname,Int MSnAnt,Int MSnSpw);
00096   KJones(const MSMetaInfoForCal& msmc);
00097   KJones(const Int& nAnt);
00098 
00099   virtual ~KJones();
00100 
00101   // Local setApply to enforce calWt=F for delays
00102   virtual void setApply(const Record& apply);
00103   using GJones::setApply;
00104   virtual void setCallib(const Record& callib,
00105                          const MeasurementSet& selms);
00106 
00107   // Local setSolve (traps lack of refant)
00108   virtual void setSolve(const Record& solve);
00109   using GJones::setSolve;
00110 
00111   // We have Float parameters
00112   virtual VisCalEnum::VCParType parType() { return VisCalEnum::REAL; };
00113 
00114   // Return the type enum
00115   virtual Type type() { return VisCal::K; };
00116 
00117   // Return type name as string
00118   virtual String typeName()     { return ( (isSolved() && combspw()) ? 
00119                                            "KMBD Jones" : 
00120                                            "K Jones" ); };
00121   virtual String longTypeName() { return ( (isSolved() && combspw()) ? 
00122                                            "KMBD Jones (multi-band delay)" : 
00123                                            "K Jones (single-band delay)"  ); };
00124 
00125   // Type of Jones matrix according to nPar()
00126   virtual Jones::JonesType jonesType() { return Jones::Diagonal; };
00127 
00128   // Freq dependence (delays)
00129   virtual Bool freqDepPar() { return False; };
00130   virtual Bool freqDepMat() { return True; };
00131 
00132   // Default parameter value
00133   virtual Complex defaultPar() { return Complex(0.0); };
00134 
00135   // Type-specific specify
00136   virtual void specify(const Record& specify);
00137 
00138   // This type is not yet accumulatable
00139   virtual Bool accumulatable() { return False; };
00140 
00141   // This type is smoothable
00142   virtual Bool smoothable() { return True; };
00143 
00144   // Calculate phase(chan) from delay
00145   virtual void calcAllJones();
00146 
00147   // Delay to phase calculator
00148   //  virtual void calcOneJones(Vector<Complex>& mat, Vector<Bool>& mOk, 
00149   //                            const Vector<Complex>& par, const Vector<Bool>& pOk );
00150 
00151 
00152   // Hazard a guess at parameters (unneeded here)
00153   virtual void guessPar(VisBuffer& ) {};
00154 
00155   // K now uses generic gather, but solves for itself per solution
00156   virtual Bool useGenericGatherForSolve() { return True; };
00157   virtual Bool useGenericSolveOne() { return False; }
00158 
00159   // Override G here; nothing to do for K, for now
00160   virtual void globalPostSolveTinker() {};
00161 
00162 
00163 protected:
00164 
00165   // K has two "real" parameters
00166   virtual Int nPar() { return 2; };
00167 
00168   // Jones matrix elements are trivial
00169   virtual Bool trivialJonesElem() { return False; };
00170 
00171   // dG/dp are trivial
00172   virtual Bool trivialDJ() { return False; };
00173 
00174   // Initialize trivial dJs
00175   virtual void initTrivDJ() {};
00176 
00177   // Local implementation of selfSolveOne (generalized signature)
00178   virtual void selfSolveOne(VisBuffGroupAcc& vbga);
00179 
00180   // FFT solver for one VB
00181   virtual void solveOneVB(const VisBuffer& vb);
00182 
00183   // FFT solver for multi-VB (MBD)
00184   virtual void solveOneVBmbd(VisBuffGroupAcc& vbga);
00185 
00186   // Reference frequencies
00187   Vector<Double> KrefFreqs_;
00188 
00189 private:
00190 
00191   
00192 };
00193 
00194 // (sbd) K for cross-hand solve
00195 class KcrossJones : public KJones {
00196 public:
00197 
00198   // Constructor
00199   KcrossJones(VisSet& vs);
00200   KcrossJones(String msname,Int MSnAnt,Int MSnSpw);
00201   KcrossJones(const MSMetaInfoForCal& msmc);
00202   KcrossJones(const Int& nAnt);
00203 
00204   virtual ~KcrossJones();
00205 
00206   // Return type name as string
00207   virtual String typeName()     { return "Kcross Jones"; };
00208   virtual String longTypeName() { return "Kcross Jones (single-band cross delay)"; };
00209 
00210   // By definition, we consider cross-hands
00211   virtual Bool phandonly() { return False; };
00212 
00213 protected:
00214 
00215   // Local implementation of selfSolveOne 
00216   //   This traps combine='spw', which isn't supported yet
00217   virtual void selfSolveOne(VisBuffGroupAcc& vbga);
00218 
00219   // FFT solver for on VB, that collapses baselines and cross-hands first
00220   virtual void solveOneVB(const VisBuffer& vb);
00221 
00222 };
00223 
00224 
00225 // KMBD Jones provides support for multi-band delays
00226 class KMBDJones : public KJones {
00227 public:
00228 
00229   // Constructor
00230   KMBDJones(VisSet& vs);
00231   KMBDJones(String msname,Int MSnAnt,Int MSnSpw);
00232   KMBDJones(const MSMetaInfoForCal& msmc);
00233   KMBDJones(const Int& nAnt);
00234 
00235   virtual ~KMBDJones();
00236 
00237   // Return the type enum
00238   virtual Type type() { return VisCal::K; };
00239 
00240   // Return type name as string
00241   virtual String typeName()     { return "KMBD Jones"; };
00242   virtual String longTypeName() { return "KMBD Jones (multi-band delay)"; };
00243 
00244   // Local setApply (to enforce KrefFreq_=0.0)
00245   virtual void setApply(const Record& apply);
00246 
00247  
00248 };
00249 
00250 
00251 
00252 class KAntPosJones : public KJones {
00253 public:
00254 
00255   // Constructor
00256   KAntPosJones(VisSet& vs);
00257   KAntPosJones(String msname,Int MSnAnt,Int MSnSpw);
00258   KAntPosJones(const MSMetaInfoForCal& msmc);
00259   KAntPosJones(const Int& nAnt);
00260 
00261   virtual ~KAntPosJones();
00262 
00263   // Return the type enum
00264   virtual Type type() { return VisCal::KAntPos; };
00265 
00266   // Return type name as string
00267   virtual String typeName()     { return "KAntPos Jones"; };
00268   virtual String longTypeName() { return "KAntPos Jones (antenna position errors)"; };
00269 
00270   // This is a scalar Jones matrix
00271   virtual Jones::JonesType jonesType() { return Jones::Scalar; };
00272 
00273   virtual Bool timeDepMat() { return True; };
00274 
00275   // This type is not smoothable
00276   virtual Bool smoothable() { return False; };
00277 
00278   // Local setApply to enforce spwmap=0 for all spw
00279   virtual void setApply(const Record& apply);
00280   using KJones::setApply;
00281   virtual void setCallib(const Record& callib,const MeasurementSet& selms);
00282 
00283   // Type-specific specify
00284   virtual void specify(const Record& specify);
00285 
00286   // Calculate phase(chan) from delay
00287   virtual void calcAllJones();
00288 
00289 protected:
00290 
00291   // Detect phase direction and antpos for the current VB
00292   virtual void syncMeta(const VisBuffer& vb);
00293   virtual void syncMeta2(const vi::VisBuffer2& vb);
00294 
00295   // AntPos has three "real" parameters (dBx, dBy, dBz)
00296   virtual Int nPar() { return 3; };
00297 
00298   // Jones matrix elements are not trivial
00299   virtual Bool trivialJonesElem() { return False; };
00300 
00301   // dG/dp are not trivial
00302   virtual Bool trivialDJ() { return False; };
00303 
00304   // Initialize trivial dJs
00305   virtual void initTrivDJ() {};
00306 
00307 private:
00308   
00309   // Geometry info for internal calculations (updated per VB)
00310   String epochref_p;
00311   MDirection phasedir_p;
00312   MPosition antpos0_p;
00313 
00314 };
00315 
00316 } //# NAMESPACE CASA - END
00317 
00318 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1