StandardVisCal.h

Go to the documentation of this file.
00001 //# StandardVisCal.h: Declaration of standard (Solvable)VisCal 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_STANDARDVISCAL_H
00029 #define SYNTHESIS_STANDARDVISCAL_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Containers/Record.h>
00033 #include <casa/BasicSL/Complex.h>
00034 #include <synthesis/MeasurementComponents/VisCal.h>
00035 #include <synthesis/MeasurementComponents/SolvableVisCal.h>
00036 #include <synthesis/MeasurementComponents/CalCorruptor.h>
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 // Forward declarations
00041 class VisEquation;
00042 class TJonesCorruptor;
00043 
00044 
00045 // **********************************************************
00046 //  PJones
00047 //
00048 
00049 class PJones : public VisJones {
00050 public:
00051 
00052   // Constructor
00053   PJones(VisSet& vs);
00054   PJones(String msname,Int MSnAnt,Int MSnSpw);
00055   PJones(const MSMetaInfoForCal& msmc);
00056   //   PJones(const Int& nAnt);  // NYI
00057 
00058   virtual ~PJones();
00059 
00060   // Return the type enum
00061   virtual Type type() { return VisCal::P; };
00062 
00063   // Return type name as string
00064   virtual String typeName()     { return "P Jones"; };
00065   virtual String longTypeName() { return "P Jones (parallactic angle phase)"; };
00066 
00067   // Type of Jones matrix according to nPar()
00068   Jones::JonesType jonesType() { return pjonestype_; };
00069 
00070 protected:
00071 
00072   // P has one trivial Complex parameter
00073   virtual Int nPar() { return 1; };
00074 
00075   virtual Vector<Float>& pa() { return pa_; };
00076 
00077   // Jones matrix elements are NOT trivial
00078   virtual Bool trivialJonesElem() { return False; };
00079 
00080   // Calculate parallactic angle
00081   virtual void calcPar();
00082 
00083   // Detect basis and feed_pa for this vb
00084   virtual void syncMeta(const VisBuffer& vb);
00085   virtual void syncMeta2(const vi::VisBuffer2& vb);
00086 
00087   // Calculate a single PJones matrix 
00088   virtual void calcOneJones(Vector<Complex>& mat, Vector<Bool>& mOk,
00089                             const Vector<Complex>& par, const Vector<Bool>& pOk );
00090 
00091 private:
00092 
00093   Jones::JonesType pjonestype_;
00094 
00095   Vector<Float> pa_;
00096   
00097 };
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 // **********************************************************
00110 //  TJones
00111 //
00112 
00113 class TJones : public SolvableVisJones {
00114 public:
00115 
00116   // Constructor
00117   TJones(VisSet& vs);
00118   TJones(String msname,Int MSnAnt,Int MSnSpw);
00119   TJones(const MSMetaInfoForCal& msmc);
00120   TJones(const Int& nAnt);
00121 
00122   virtual ~TJones();
00123 
00124   // Return the type enum
00125   virtual Type type() { return VisCal::T; };
00126 
00127   // Return type name as string
00128   virtual String typeName()     { return "T Jones"; };
00129   virtual String longTypeName() { return "T Jones (polarization-independent troposphere"; };
00130 
00131   // Type of Jones matrix according to nPar()
00132   virtual Jones::JonesType jonesType() { return Jones::Scalar; };
00133 
00134   // This type is accumulatable
00135   virtual Bool accumulatable() { return True; };
00136 
00137   // This type is smoothable
00138   virtual Bool smoothable() { return True; };
00139 
00140   // Hazard a guess at parameters
00141   virtual void guessPar(VisBuffer& vb);
00142   virtual void guessPar(SDBList& sdbs);  //  VI2
00143 
00144   // Set up corruptor
00145   virtual void createCorruptor(const VisIter& vi, const Record& simpar, const Int nSim);
00146 
00147 protected:
00148 
00149   // T has one trivial complex parameter
00150   virtual Int nPar() { return 1; };
00151 
00152   // Jones matrix elements are trivial
00153   virtual Bool trivialJonesElem() { return True; };
00154 
00155   // Are diff'd Js trivial?
00156   virtual Bool trivialDJ() { return True; };
00157 
00158   // Initialize trivial dJs
00159   virtual void initTrivDJ();
00160 
00161 private:
00162 
00163   // object that can simulate the corruption terms - internal to T;
00164   // public access is only to the CalCorruptor parts
00165   AtmosCorruptor *tcorruptor_p;
00166 
00167 };
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 // **********************************************************
00179 //  TfJones (freq-dep T)
00180 //
00181 
00182 class TfJones : public TJones {
00183 public:
00184 
00185   // Constructor
00186   TfJones(VisSet& vs);
00187   TfJones(String msname,Int MSnAnt,Int MSnSpw);
00188   TfJones(const MSMetaInfoForCal& msmc);
00189   TfJones(const Int& nAnt);
00190 
00191   virtual ~TfJones();
00192 
00193   // Return the type enum
00194   virtual Type type() { return VisCal::T; };
00195 
00196   // Return type name as string
00197   virtual String typeName()     { return "Tf Jones"; };
00198   virtual String longTypeName() { return "Tf Jones (frequency-dependent atmospheric complex gain"; };
00199 
00200   // This is the freq-dep version of T
00201   //   (this is the ONLY fundamental difference from T)
00202   virtual Bool freqDepPar() { return True; };
00203 
00204 protected:
00205 
00206   // <nothing>
00207 
00208 private:
00209 
00210   // <nothing>
00211   
00212 };
00213 
00214 
00215 
00216 
00217 
00218 // **********************************************************
00219 //  GJones
00220 //
00221 
00222 class GJones : public SolvableVisJones {
00223 public:
00224 
00225   // Constructor
00226   GJones(VisSet& vs);
00227   GJones(String msname,Int MSnAnt,Int MSnSpw);
00228   GJones(const MSMetaInfoForCal& msmc);
00229   GJones(const Int& nAnt);
00230 
00231   virtual ~GJones();
00232 
00233   // Return the type enum
00234   virtual Type type() { return VisCal::G; };
00235 
00236   // Return type name as string
00237   virtual String typeName()     { return "G Jones"; };
00238   virtual String longTypeName() { return "G Jones (electronic Gain)"; };
00239 
00240   // Type of Jones matrix according to nPar()
00241   virtual Jones::JonesType jonesType() { return Jones::Diagonal; };
00242 
00243   // This type is accumulatable
00244   virtual Bool accumulatable() { return True; };
00245 
00246   // This type is smoothable
00247   virtual Bool smoothable() { return True; };
00248 
00249   // Nominally, we will only use parallel hands for now
00250   virtual Bool phandonly() { return True; };
00251 
00252   // Hazard a guess at parameters
00253   virtual void guessPar(VisBuffer& vb);
00254   virtual void guessPar(SDBList& sdbs);   // VI2
00255 
00256   virtual void createCorruptor(const VisIter& vi, const Record& simpar, const Int nSim);
00257 
00258 protected:
00259 
00260   // G has two trivial Complex parameters
00261   virtual Int nPar() { return 2; };
00262 
00263   // Jones matrix elements are trivial
00264   virtual Bool trivialJonesElem() { return True; };
00265 
00266   // dG/dp are trivial
00267   virtual Bool trivialDJ() { return True; };
00268 
00269   // Initialize trivial dJs
00270   virtual void initTrivDJ();
00271 
00272 private:
00273 
00274   GJonesCorruptor *gcorruptor_p;
00275   
00276 };
00277 
00278 
00279 
00280 // **********************************************************
00281 //  BJones  (freq-dep GJones)
00282 //
00283 
00284 class BJones : public GJones {
00285 public:
00286 
00287   // Constructor
00288   BJones(VisSet& vs);
00289   BJones(String msname,Int MSnAnt,Int MSnSpw);
00290   BJones(const MSMetaInfoForCal& msmc);
00291   BJones(const Int& nAnt);
00292 
00293   virtual ~BJones();
00294 
00295   // Return the type enum
00296   virtual Type type() { return VisCal::B; };
00297 
00298   // Return type name as string
00299   virtual String typeName()     { return "B Jones"; };
00300   virtual String longTypeName() { return "B Jones (bandpass)"; };
00301 
00302   // Local setSolve
00303   using GJones::setSolve;
00304   virtual void setSolve(const Record& solve);
00305 
00306   // This is the freq-dep version of G 
00307   //   (this is the ONLY fundamental difference from G)
00308   virtual Bool freqDepPar() { return True; };
00309 
00310   virtual void normalize();
00311 
00312   // Specialize post solve operations (adds chan gap fill)
00313   virtual void globalPostSolveTinker();
00314   
00315   // Fill in bracketted channel gaps in solutions
00316   virtual void fillChanGaps();
00317   virtual void fillChanGapArray(Array<Complex>& sol,
00318                                 Array<Bool>& solOK);
00319 
00320 protected:
00321 
00322   // B-specific weight scaling factors
00323   virtual void calcWtScale(); // B-specific channel-collapsing weight scale calc
00324 
00325 private:
00326 
00327   // widest channel gap to fill by interpolation
00328   Int maxchangap_p;
00329 
00330 
00331 };
00332 
00333 
00334 
00335 // **********************************************************
00336 //  JJones
00337 //
00338 
00339 class JJones : public SolvableVisJones {
00340 public:
00341 
00342   // Constructor
00343   JJones(VisSet& vs);
00344   JJones(String msname,Int MSnAnt,Int MSnSpw);
00345   JJones(const MSMetaInfoForCal& msmc);
00346   JJones(const Int& nAnt);
00347 
00348   virtual ~JJones();
00349 
00350   // J-specific solve setup
00351   using SolvableVisJones::setSolve;
00352   void setSolve(const Record& solvepar);
00353 
00354   // Return the type enum
00355   virtual Type type() { return VisCal::J; };
00356 
00357   // Return type name as string
00358   virtual String typeName()     { return "J Jones"; };
00359   virtual String longTypeName() { return "J Jones (generic polarized gain)"; };
00360 
00361   // Type of Jones matrix according to nPar()
00362   virtual Jones::JonesType jonesType() { return Jones::General; };
00363 
00364   // Hazard a guess at parameters
00365   virtual void guessPar(VisBuffer& vb);
00366 
00367   // J-specific reReference
00368   // TBD: non-triv impl
00369   virtual void reReference() {};
00370 
00371 protected:
00372 
00373   // J has four trivial Complex parameters
00374   virtual Int nPar() { return 4; };
00375 
00376   // Jones matrix elements are trivial
00377   virtual Bool trivialJonesElem() { return True; };
00378 
00379   // dJ/dp are trivial
00380   virtual Bool trivialDJ() { return True; };
00381 
00382   // Initialize trivial dJs
00383   virtual void initTrivDJ();
00384 
00385 private:
00386 
00387   // <nothing>
00388   
00389 };
00390 
00391 
00392 // **********************************************************
00393 //  M: baseline-based (closure) 
00394 //
00395 
00396 
00397 class MMueller : public SolvableVisMueller {
00398 public:
00399 
00400   // Constructor
00401   MMueller(VisSet& vs);
00402   MMueller(String msname,Int MSnAnt,Int MSnSpw);
00403   MMueller(const MSMetaInfoForCal& msmc);
00404   MMueller(const Int& nAnt);
00405 
00406   virtual ~MMueller();
00407 
00408   // Return the type enum
00409   virtual Type type() { return VisCal::M; };
00410 
00411   // Return type name as string
00412   virtual String typeName()     { return "M Mueller"; };
00413   virtual String longTypeName() { return "M Mueller (baseline-based)"; };
00414 
00415   // Type of Jones matrix according to nPar()
00416   virtual Mueller::MuellerType muellerType() { return Mueller::Diag2; };
00417 
00418   // Local setApply
00419   using SolvableVisCal::setApply;
00420   virtual void setApply(const Record& apply);
00421 
00422   // M gathers/solves for itself
00423   virtual Bool useGenericGatherForSolve() { return False; };
00424 
00425   // M solves for itself (by copying averaged data)
00426   virtual void selfGatherAndSolve(VisSet& vs, VisEquation& ve) { newselfSolve(vs,ve); };
00427   virtual void newselfSolve(VisSet& vs, VisEquation& ve);  // new supports combine
00428 
00429   // Local M version only supports normalization
00430   virtual void globalPostSolveTinker();
00431 
00432   virtual void createCorruptor(const VisIter& vi, const Record& simpar, const Int nSim);
00433 protected:
00434 
00435   // M currently has just 2 complex parameters, i.e., both parallel hands
00436   virtual Int nPar() { return 2; };
00437 
00438   // Jones matrix elements are trivial
00439   virtual Bool trivialMuellerElem() { return True; };
00440 
00441 private:
00442   AtmosCorruptor *atmcorruptor_p;
00443 
00444 };
00445 
00446 
00447 
00448 
00449 
00450 
00451 // **********************************************************
00452 //  MfMueller (freq-dep MMueller)
00453 //
00454 
00455 class MfMueller : public MMueller {
00456 public:
00457 
00458   // Constructor
00459   MfMueller(VisSet& vs);
00460   MfMueller(String msname,Int MSnAnt,Int MSnSpw);
00461   MfMueller(const MSMetaInfoForCal& msmc);
00462   MfMueller(const Int& nAnt);
00463 
00464   virtual ~MfMueller();
00465 
00466   // Return the type enum
00467   virtual Type type() { return VisCal::M; };
00468 
00469   // Return type name as string
00470   virtual String typeName()     { return "Mf Mueller"; };
00471   virtual String longTypeName() { return "Mf Mueller (closure bandpass)"; };
00472 
00473   // This is the freq-dep version of M
00474   //   (this is the ONLY fundamental difference from M)
00475   virtual Bool freqDepPar() { return True; };
00476 
00477   // Normalize baseline spectra (after B)
00478   virtual void normalize();
00479 
00480 protected:
00481 
00482   // <nothing>
00483 
00484 private:
00485 
00486   // <nothing>
00487 
00488 };
00489 
00490 
00491 
00492 
00493 // **********************************************************
00494 //  TOPac 
00495 //
00496 
00497 class TOpac : public TJones {
00498 public:
00499 
00500   // Constructor
00501   TOpac(VisSet& vs);
00502   TOpac(String msname,Int MSnAnt,Int MSnSpw);
00503   TOpac(const MSMetaInfoForCal& msmc);
00504   //  TOpac(const Int& nAnt);  // NYI
00505 
00506   virtual ~TOpac();
00507 
00508   // Return the type enum
00509   virtual Type type() { return VisCal::T; };
00510 
00511   // Return type name as string
00512   virtual String typeName()     { return "TOpac"; };
00513   virtual String longTypeName() { return "TOpac (Opacity corrections in amplitude)"; };
00514 
00515   // Type of Jones matrix according to nPar()
00516   Jones::JonesType jonesType() { return Jones::Scalar; };
00517 
00518   // We have Float parameters
00519   virtual VisCalEnum::VCParType parType() { return VisCalEnum::REAL; };
00520 
00521   // Local specialization of setApply to extract opacity
00522   void setApply(const Record& applypar);
00523 
00524   // Report apply-related info
00525   String applyinfo();
00526 
00527 protected:
00528 
00529   // TOpac has one Float par per ant
00530   virtual Int nPar() { return 1; };
00531 
00532   // Jones matrix elements are NOT trivial
00533   virtual Bool trivialJonesElem() { return False; };
00534 
00535   // Access to z.a. data
00536   Vector<Double>& za() { return za_; };
00537 
00538   // Detect zenith angle for this vb
00539   virtual void syncMeta(const VisBuffer& vb);
00540   virtual void syncMeta2(const vi::VisBuffer2& vb);
00541 
00542   // Calculate parameters (in this case, the z.a.)
00543   virtual void calcPar();
00544 
00545   // Calculate the TOpac matrix for all ants
00546   virtual void calcAllJones();
00547 
00548 private:
00549 
00550   // avoid compiler warnings
00551   using TJones::setApply;  
00552 
00553   // opacity per spw
00554   Vector<Double> opacity_;
00555 
00556   // zenith angle per antenna
00557   Vector<Double> za_;
00558   
00559 };
00560 
00561 
00562 // **********************************************************
00563 //  TfOpac (freq-dep TOpac)
00564 //
00565 
00566 class TfOpac : public TOpac {
00567 public:
00568 
00569   // Constructor
00570   TfOpac(VisSet& vs);
00571   TfOpac(String msname,Int MSnAnt,Int MSnSpw);
00572   TfOpac(const MSMetaInfoForCal& msmc);
00573   //  TfOpac(const Int& nAnt);
00574 
00575   virtual ~TfOpac();
00576 
00577   // Return the type enum
00578   virtual Type type() { return VisCal::T; };
00579 
00580   // Return type name as string
00581   virtual String typeName()     { return "TfOpac"; };
00582   virtual String longTypeName() { return "TfOpac (frequency-dependent opacity"; };
00583 
00584   // This is the freq-dep version of TOpac
00585   //   (this is the ONLY fundamental difference from TOpac)
00586   virtual Bool freqDepPar() { return True; };
00587 
00588 protected:
00589 
00590   // Calculate the TfOpac matrix for all ants
00591   virtual void calcAllJones();
00592 
00593 private:
00594 
00595   //  Frequency weight scaling factors
00596   virtual void calcWtScale();
00597   
00598 };
00599 
00600 
00601 } //# NAMESPACE CASA - END
00602 
00603 #endif
00604 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1