LCOV - code coverage report
Current view: top level - synthesis/MeasurementComponents - VisCalGlobals.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 183 462 39.6 %
Date: 2024-11-06 17:42:47 Functions: 6 10 60.0 %

          Line data    Source code
       1             : //# VisCalGlobals.cc: Implementation of VisCalGlobals
       2             : //# Copyright (C) 1996,1997,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             : #include <synthesis/MeasurementComponents/VisCalGlobals.h>
      29             : #include <synthesis/MeasurementComponents/MSMetaInfoForCal.h>
      30             : #include <synthesis/MeasurementComponents/StandardVisCal.h>
      31             : #include <synthesis/MeasurementComponents/DJones.h>
      32             : #include <synthesis/MeasurementComponents/XJones.h>
      33             : #include <synthesis/MeasurementComponents/GSpline.h>
      34             : #include <synthesis/MeasurementComponents/BPoly.h>
      35             : #include <synthesis/MeasurementComponents/EJones.h>
      36             : #include <synthesis/MeasurementComponents/EPJones.h>
      37             : #include <synthesis/MeasurementComponents/FJones.h>
      38             : #include <synthesis/MeasurementComponents/FringeJones.h>
      39             : #include <synthesis/MeasurementComponents/AccorJones.h>
      40             : #include <synthesis/MeasurementComponents/KJones.h>
      41             : #include <synthesis/MeasurementComponents/LJJones.h>
      42             : #include <synthesis/MeasurementComponents/AMueller.h>
      43             : #include <synthesis/MeasurementComponents/TsysGainCal.h>
      44             : #include <synthesis/MeasurementComponents/EVLASwPow.h>
      45             : #include <synthesis/MeasurementComponents/SingleDishSkyCal.h>
      46             : #include <synthesis/MeasurementComponents/SDDoubleCircleGainCal.h>
      47             : 
      48             : using namespace casacore;
      49             : namespace casa { //# NAMESPACE CASA - BEGIN
      50             : 
      51             : 
      52             : // Create a specialized VisCal from VisSet
      53          37 : VisCal* createVisCal(const String& type, VisSet& vs) {
      54             : 
      55          37 :   String uptype=type;
      56          37 :   uptype.upcase();
      57             : 
      58          37 :   if (uptype=="P" || uptype=="P JONES") 
      59           0 :     return new PJones(vs);
      60             : 
      61             :   else
      62             :     // Try request as a solvable type
      63          37 :     return createSolvableVisCal(type,vs);
      64          37 : };
      65             : 
      66             : // Create a specialized VisCal from msname, nAnt, nSpw
      67          27 : VisCal* createVisCal(const String& type, String msname, Int MSnAnt, Int MSnSpw) {
      68             : 
      69          27 :   String uptype=type;
      70          27 :   uptype.upcase();
      71             : 
      72          27 :   if (uptype=="P" || uptype=="P JONES") 
      73           0 :     return new PJones(msname,MSnAnt,MSnSpw);
      74             : 
      75             :   else
      76             :     // Try request as a solvable type
      77          27 :     return createSolvableVisCal(type,msname,MSnAnt,MSnSpw);
      78          27 : };
      79             : 
      80             : // Create a specialized VisCal from MSMetaInfoForCal
      81         156 : VisCal* createVisCal(const String& type, const MSMetaInfoForCal& msmc) {
      82             : 
      83         156 :   String uptype=type;
      84         156 :   uptype.upcase();
      85             : 
      86         156 :   if (uptype=="P" || uptype=="P JONES") 
      87          38 :     return new PJones(msmc);
      88             : 
      89             :   else
      90             :     // Try request as a solvable type
      91         118 :     return createSolvableVisCal(type,msmc);
      92         156 : };
      93             : 
      94             : 
      95             : // Create a specialized VisCal from nAnt
      96           0 : VisCal* createVisCal(const String& type, const Int& nAnt) {
      97             : 
      98             :   // TBD: handle P w/out an MS?
      99             :   //  if (type=="P") 
     100             :   //    return new PJones(nAnt);
     101             :   //  else
     102             :     // Try request as a solvable type
     103           0 :     return createSolvableVisCal(type,nAnt);
     104             : };
     105             : 
     106             : 
     107             : // Create a specialized SolvableVisCal from VisSet
     108         124 : SolvableVisCal* createSolvableVisCal(const String& type, VisSet& vs) {
     109             : 
     110         124 :   String uptype=type;
     111         124 :   uptype.upcase();
     112             : 
     113         124 :   if      (uptype=="B" || uptype=="B JONES") 
     114           0 :     return new BJones(vs);
     115             : 
     116         124 :   else if (uptype=="BPOLY") 
     117           0 :     return new BJonesPoly(vs);
     118             : 
     119         124 :   else if (uptype=="G" || uptype=="G JONES") 
     120           0 :     return new GJones(vs);
     121             : 
     122         124 :   else if (uptype=="GSPLINE") 
     123           1 :     return new GJonesSpline(vs);
     124             :   
     125         123 :   else if (uptype=="TF" || uptype=="TF JONES" || uptype=="TF NOISE") 
     126          10 :     return new TfJones(vs);
     127             : 
     128         113 :   else if (uptype=="T" || uptype=="T JONES" || uptype=="T NOISE") 
     129           6 :     return new TJones(vs);
     130             : 
     131         321 :   else if (uptype.before('+')=="DLIN" ||
     132         321 :            uptype.before('+')=="D" || 
     133         107 :            uptype=="D JONES") 
     134           0 :     return new DlinJones(vs);
     135             : 
     136         321 :   else if (uptype.before('+')=="DFLIN" || 
     137         321 :            uptype.before('+')=="DF" || 
     138         107 :            uptype=="DF JONES") 
     139           0 :     return new DflinJones(vs);
     140             : 
     141         214 :   else if (uptype.before('+')=="DLLS" || 
     142         107 :            uptype=="DLLS JONES")
     143           0 :     return new DllsJones(vs);
     144             : 
     145         214 :   else if (uptype.before('+')=="DFLLS" || 
     146         107 :            uptype=="DFLLS JONES")
     147           0 :     return new DfllsJones(vs);
     148             : 
     149         321 :   else if (uptype.before('+')=="DGEN" ||
     150         321 :            uptype.before('+')=="DGENERAL" || 
     151         107 :            uptype=="DGEN JONES") 
     152           0 :     return new DJones(vs);
     153             : 
     154         321 :   else if (uptype.before('+')=="DFGEN" || 
     155         321 :            uptype.before('+')=="DFGENERAL" || 
     156         107 :            uptype=="DFGEN JONES") 
     157           0 :     return new DfJones(vs);
     158             : 
     159         107 :   else if (uptype=="J" || uptype=="J JONES") 
     160           0 :     return new JJones(vs);
     161             : 
     162         107 :   else if (uptype=="JF" || uptype=="JF JONES")
     163           0 :     return new JfJones(vs);
     164             : 
     165         107 :   else if (uptype == "EP" || uptype == "EP JONES")
     166           0 :     return new EPJones(vs);
     167             : 
     168         107 :   else if (uptype == "LJ" || uptype == "LJ JONES")
     169           0 :     return new LJJones(vs);
     170             : 
     171         107 :   else if (uptype=="M" || uptype=="M MUELLER")
     172           0 :     return new MMueller(vs);
     173             : 
     174         107 :   else if (uptype=="A" || uptype=="A MUELLER")
     175          14 :     return new AMueller(vs);
     176             : 
     177          93 :   else if (uptype=="N" || uptype=="A NOISE")
     178          16 :     return new ANoise(vs);
     179             : 
     180          77 :   else if (uptype=="MF" || uptype=="MF MUELLER")
     181           0 :     return new MfMueller(vs);
     182             :      
     183          77 :   else if (uptype=="X" || uptype=="X MUELLER")
     184           0 :     return new XMueller(vs);
     185             : 
     186          77 :   else if (uptype=="XJ" || uptype=="X JONES")
     187           0 :     return new XJones(vs);
     188             : 
     189          77 :   else if (uptype=="XF" || uptype=="XF JONES")
     190           0 :     return new XfJones(vs);
     191             : 
     192          77 :   else if (uptype=="K" || uptype=="K JONES")
     193           0 :     return new KJones(vs);
     194             : 
     195          77 :   else if (uptype=="KCROSS" || uptype=="KCROSS JONES")
     196           0 :     return new KcrossJones(vs);
     197             : 
     198         154 :   else if (uptype=="GLINXPH" || uptype=="GLINXPH JONES" ||
     199          77 :            uptype=="XY+QU")
     200           0 :     return new GlinXphJones(vs);
     201             : 
     202         154 :   else if (uptype=="GLINXPHF" || uptype=="GLINXPHF JONES" ||
     203          77 :            uptype=="XYF+QU")
     204           0 :     return new GlinXphfJones(vs);
     205             : 
     206          77 :   else if (uptype=="KMBD" || uptype=="KMBD JONES")
     207           0 :     return new KMBDJones(vs);
     208             : 
     209          77 :   else if (uptype.contains("KANTPOS") || uptype.contains("KANTPOS JONES"))
     210           0 :     return new KAntPosJones(vs);
     211             : 
     212          77 :   else if (uptype.contains("TSYS"))
     213          26 :     return new StandardTsys(vs);
     214             : 
     215          51 :   else if (uptype.contains("EVLASWP"))
     216           0 :     return new EVLASwPow(vs);
     217             : 
     218          51 :   else if (uptype=="TFOPAC")  // Not yet solvable (even though an SVJ)
     219           0 :     return new TfOpac(vs);
     220             : 
     221          51 :   else if (uptype=="TOPAC")  // Not yet solvable (even though an SVJ)
     222           0 :     return new TOpac(vs);
     223             : 
     224          51 :   else if (uptype.contains("GAINCURVE"))  // Not yet solvable (even though an SVJ)
     225           0 :     return new EGainCurve(vs);
     226             :   
     227          51 :   else if (uptype.contains("POWERCURVE"))  // Not yet solvable (even though an SVJ)
     228           0 :     return new EPowerCurve(vs);
     229             :   
     230          51 :   else if (uptype.contains("EVLAGAIN"))
     231           0 :     throw(AipsError("Please regenerate EVLA Sw Pow table using gencal."));
     232             : 
     233          51 :   else if (uptype.contains("TEC") || uptype.contains("F JONES") )  // Ionosphere
     234           0 :     return new FJones(vs);
     235             : 
     236          51 :   else if (uptype.contains("FRINGE"))   // Fringe-fitting
     237           0 :     return new FringeJones(vs);
     238             : 
     239          51 :   else if (uptype.contains("ACCOR"))
     240           0 :     return new AccorJones(vs);
     241             : 
     242          51 :   else if (uptype.contains("SDSKY_PS"))
     243          27 :     return new SingleDishPositionSwitchCal(vs);
     244             : 
     245          24 :   else if (uptype.contains("SDSKY_RASTER"))
     246          10 :     return new SingleDishRasterCal(vs);
     247             : 
     248          14 :   else if (uptype.contains("SDSKY_OTF"))
     249          14 :     return new SingleDishOtfCal(vs);
     250             :   
     251           0 :   else if (uptype.contains("SDGAIN_OTFD"))
     252           0 :     return new SDDoubleCircleGainCal(vs);
     253             : 
     254             :   else {
     255           0 :     throw(AipsError("Unknown calibration type: '"+type+"'"));
     256             :   }
     257         124 : };
     258             : 
     259             : 
     260             : // Create a specialized VisCal from msname, nAnt, nSpw
     261          27 : SolvableVisCal* createSolvableVisCal(const String& type, String msname, Int MSnAnt, Int MSnSpw) {
     262          27 :   String uptype=type;
     263          27 :   uptype.upcase();
     264             : 
     265          27 :   if      (uptype=="B" || uptype=="B JONES") 
     266           9 :     return new BJones(msname,MSnAnt,MSnSpw);
     267             : 
     268          18 :   else if (uptype=="BPOLY") 
     269           0 :     throw(AipsError(uptype+" not yet supported via BJonesPoly(msname,MSnAnt,MSnSpw)"));
     270             :   //    return new BJonesPoly(msname,MSnAnt,MSnSpw);
     271             : 
     272          18 :   else if (uptype=="G" || uptype=="G JONES") 
     273          18 :     return new GJones(msname,MSnAnt,MSnSpw);
     274             : 
     275           0 :   else if (uptype=="GSPLINE") 
     276           0 :     throw(AipsError(uptype+" not yet supported via GJonesSpline(msname,MSnAnt,MSnSpw)"));
     277             :   //return new GJonesSpline(msname,MSnAnt,MSnSpw);
     278             :   
     279           0 :   else if (uptype=="TF" || uptype=="TF JONES" || uptype=="TF NOISE") 
     280           0 :     return new TfJones(msname,MSnAnt,MSnSpw);
     281             : 
     282           0 :   else if (uptype=="T" || uptype=="T JONES" || uptype=="T NOISE") 
     283           0 :     return new TJones(msname,MSnAnt,MSnSpw);
     284             : 
     285           0 :   else if (uptype.before('+')=="DLIN" ||
     286           0 :            uptype.before('+')=="D" || 
     287           0 :            uptype=="D JONES") 
     288           0 :     return new DlinJones(msname,MSnAnt,MSnSpw);
     289             : 
     290           0 :   else if (uptype.before('+')=="DFLIN" || 
     291           0 :            uptype.before('+')=="DF" || 
     292           0 :            uptype=="DF JONES") 
     293           0 :     return new DflinJones(msname,MSnAnt,MSnSpw);
     294             : 
     295           0 :   else if (uptype.before('+')=="DLLS" || 
     296           0 :            uptype=="DLLS JONES")
     297           0 :     return new DllsJones(msname,MSnAnt,MSnSpw);
     298             : 
     299           0 :   else if (uptype.before('+')=="DFLLS" || 
     300           0 :            uptype=="DFLLS JONES")
     301           0 :     return new DfllsJones(msname,MSnAnt,MSnSpw);
     302             : 
     303           0 :   else if (uptype.before('+')=="DGEN" ||
     304           0 :            uptype.before('+')=="DGENERAL" || 
     305           0 :            uptype=="DGEN JONES") 
     306           0 :     return new DJones(msname,MSnAnt,MSnSpw);
     307             : 
     308           0 :   else if (uptype.before('+')=="DFGEN" || 
     309           0 :            uptype.before('+')=="DFGENERAL" || 
     310           0 :            uptype=="DFGEN JONES") 
     311           0 :     return new DfJones(msname,MSnAnt,MSnSpw);
     312             : 
     313           0 :   else if (uptype=="J" || uptype=="J JONES") 
     314           0 :     return new JJones(msname,MSnAnt,MSnSpw);
     315             : 
     316           0 :   else if (uptype=="JF" || uptype=="JF JONES")
     317           0 :     return new JfJones(msname,MSnAnt,MSnSpw);
     318             : 
     319           0 :   else if (uptype == "EP" || uptype == "EP JONES")
     320           0 :     throw(AipsError(uptype+" not yet supported via EPJones(msname,MSnAnt,MSnSpw)"));
     321             :   //    return new EPJones(msname,MSnAnt,MSnSpw);
     322             : 
     323           0 :   else if (uptype == "LJ" || uptype == "LJ JONES")
     324           0 :     throw(AipsError(uptype+" not yet supported via LJJones(msname,MSnAnt,MSnSpw)"));
     325             :   //    return new LJJones(msname,MSnAnt,MSnSpw);
     326             : 
     327           0 :   else if (uptype=="M" || uptype=="M MUELLER")
     328           0 :     return new MMueller(msname,MSnAnt,MSnSpw);
     329             : 
     330           0 :   else if (uptype=="A" || uptype=="A MUELLER")
     331           0 :     return new AMueller(msname,MSnAnt,MSnSpw);
     332             : 
     333           0 :   else if (uptype=="N" || uptype=="A NOISE")
     334           0 :     return new ANoise(msname,MSnAnt,MSnSpw);
     335             : 
     336           0 :   else if (uptype=="MF" || uptype=="MF MUELLER")
     337           0 :     return new MfMueller(msname,MSnAnt,MSnSpw);
     338             :      
     339           0 :   else if (uptype=="X" || uptype=="X MUELLER")
     340           0 :     return new XMueller(msname,MSnAnt,MSnSpw);
     341             : 
     342           0 :   else if (uptype=="XJ" || uptype=="X JONES")
     343           0 :     return new XJones(msname,MSnAnt,MSnSpw);
     344             : 
     345           0 :   else if (uptype=="XF" || uptype=="XF JONES")
     346           0 :     return new XfJones(msname,MSnAnt,MSnSpw);
     347             : 
     348           0 :   else if (uptype=="K" || uptype=="K JONES")
     349           0 :     return new KJones(msname,MSnAnt,MSnSpw);
     350             : 
     351           0 :   else if (uptype=="KCROSS" || uptype=="KCROSS JONES")
     352           0 :     return new KcrossJones(msname,MSnAnt,MSnSpw);
     353             : 
     354           0 :   else if (uptype=="GLINXPH" || uptype=="GLINXPH JONES" ||
     355           0 :            uptype=="XY+QU")
     356           0 :     return new GlinXphJones(msname,MSnAnt,MSnSpw);
     357             : 
     358           0 :   else if (uptype=="GLINXPHF" || uptype=="GLINXPHF JONES" ||
     359           0 :            uptype=="XYF+QU")
     360           0 :     return new GlinXphfJones(msname,MSnAnt,MSnSpw);
     361             : 
     362           0 :   else if (uptype=="KMBD" || uptype=="KMBD JONES")
     363           0 :     return new KMBDJones(msname,MSnAnt,MSnSpw);
     364             : 
     365           0 :   else if (uptype.contains("KANTPOS") || uptype.contains("KANTPOS JONES"))
     366           0 :     return new KAntPosJones(msname,MSnAnt,MSnSpw);
     367             : 
     368           0 :   else if (uptype.contains("TSYS"))
     369           0 :     return new StandardTsys(msname,MSnAnt,MSnSpw);
     370             : 
     371           0 :   else if (uptype.contains("EVLASWP"))
     372           0 :     return new EVLASwPow(msname,MSnAnt,MSnSpw);
     373             : 
     374           0 :   else if (uptype=="TFOPAC")  // Not yet solvable (even though an SVJ)
     375           0 :     return new TfOpac(msname,MSnAnt,MSnSpw);
     376             : 
     377           0 :   else if (uptype=="TOPAC")  // Not yet solvable (even though an SVJ)
     378           0 :     return new TOpac(msname,MSnAnt,MSnSpw);
     379             : 
     380           0 :   else if (uptype.contains("GAINCURVE"))  // Not yet solvable (even though an SVJ)
     381           0 :     return new EGainCurve(msname,MSnAnt,MSnSpw);
     382             :   
     383           0 :   else if (uptype.contains("POWERCURVE"))  // Not yet solvable (even though an SVJ)
     384           0 :     return new EPowerCurve(msname,MSnAnt,MSnSpw);
     385             :   
     386           0 :   else if (uptype.contains("EVLAGAIN"))
     387           0 :     throw(AipsError("Please regenerate EVLA Sw Pow table using gencal."));
     388             : 
     389           0 :   else if (uptype.contains("TEC") || uptype.contains("F JONES") )  // Ionosphere
     390           0 :     return new FJones(msname,MSnAnt,MSnSpw);
     391             : 
     392           0 :   else if (uptype.contains("FRINGE"))  // Fringe-fitting
     393           0 :     return new FringeJones(msname,MSnAnt,MSnSpw);
     394             : 
     395           0 :   else if (uptype.contains("ACCOR"))
     396           0 :     return new AccorJones(msname,MSnAnt,MSnSpw);
     397             : 
     398           0 :   else if (uptype.contains("SDSKY_PS"))
     399           0 :     throw(AipsError(uptype+" not yet supported via SingleDishPositionSwitchCal(msname,MSnAnt,MSnSpw)"));
     400             :   //    return new SingleDishPositionSwitchCal(msname,MSnAnt,MSnSpw);
     401             : 
     402           0 :   else if (uptype.contains("SDSKY_RASTER"))
     403           0 :     throw(AipsError(uptype+" not yet supported via SingleDishRasterCal(msname,MSnAnt,MSnSpw)"));
     404             :   //    return new SingleDishRasterCal(msname,MSnAnt,MSnSpw);
     405             : 
     406           0 :   else if (uptype.contains("SDSKY_OTF"))
     407           0 :     throw(AipsError(uptype+" not yet supported via SingleDishOtfCal(msname,MSnAnt,MSnSpw)"));
     408             :   //    return new SingleDishOtfCal(msname,MSnAnt,MSnSpw);
     409             :   
     410             :   else {
     411           0 :     throw(AipsError("Unknown calibration type: '"+type+"'"));
     412             :   }
     413          27 : };
     414             : 
     415             : 
     416             : // Create a specialized VisCal from MSMetaInfoForCal
     417         550 : SolvableVisCal* createSolvableVisCal(const String& type, const MSMetaInfoForCal& msmc) {
     418         550 :   String uptype=type;
     419         550 :   uptype.upcase();
     420             : 
     421         550 :   if      (uptype=="B" || uptype=="B JONES") 
     422          14 :     return new BJones(msmc);
     423             : 
     424         536 :   else if (uptype=="BPOLY") 
     425             :     //throw(AipsError(uptype+" not yet supported via BJonesPoly(msmc)"));
     426           0 :     return new BJonesPoly(msmc);
     427             : 
     428         536 :   else if (uptype=="G" || uptype=="G JONES") 
     429         345 :     return new GJones(msmc);
     430             : 
     431         191 :   else if (uptype=="GSPLINE") 
     432             :     //throw(AipsError(uptype+" not yet supported via GJonesSpline(msmc)"))
     433           0 :     return new GJonesSpline(msmc);
     434             :   
     435         191 :   else if (uptype=="TF" || uptype=="TF JONES" || uptype=="TF NOISE") 
     436           0 :     return new TfJones(msmc);
     437             : 
     438         191 :   else if (uptype=="T" || uptype=="T JONES" || uptype=="T NOISE") 
     439          14 :     return new TJones(msmc);
     440             : 
     441         531 :   else if (uptype.before('+')=="DLIN" ||
     442         531 :            uptype.before('+')=="D" || 
     443         177 :            uptype=="D JONES") 
     444          14 :     return new DlinJones(msmc);
     445             : 
     446         489 :   else if (uptype.before('+')=="DFLIN" || 
     447         489 :            uptype.before('+')=="DF" || 
     448         160 :            uptype=="DF JONES") 
     449           3 :     return new DflinJones(msmc);
     450             : 
     451         316 :   else if (uptype.before('+')=="DLLS" || 
     452         156 :            uptype=="DLLS JONES")
     453           4 :     return new DllsJones(msmc);
     454             : 
     455         302 :   else if (uptype.before('+')=="DFLLS" || 
     456         146 :            uptype=="DFLLS JONES")
     457          10 :     return new DfllsJones(msmc);
     458             : 
     459         438 :   else if (uptype.before('+')=="DGEN" ||
     460         438 :            uptype.before('+')=="DGENERAL" || 
     461         146 :            uptype=="DGEN JONES") 
     462           0 :     return new DJones(msmc);
     463             : 
     464         438 :   else if (uptype.before('+')=="DFGEN" || 
     465         438 :            uptype.before('+')=="DFGENERAL" || 
     466         146 :            uptype=="DFGEN JONES") 
     467           0 :     return new DfJones(msmc);
     468             : 
     469         146 :   else if (uptype=="J" || uptype=="J JONES") 
     470           0 :     return new JJones(msmc);
     471             : 
     472         146 :   else if (uptype=="JF" || uptype=="JF JONES")
     473           0 :     return new JfJones(msmc);
     474             : 
     475         146 :   else if (uptype == "EP" || uptype == "EP JONES")
     476           0 :     throw(AipsError(uptype+" not yet supported via EPJones(msmc)"));
     477             :   //    return new EPJones(msmc);
     478             : 
     479         146 :   else if (uptype == "LJ" || uptype == "LJ JONES")
     480           0 :     throw(AipsError(uptype+" not yet supported via LJJones(msmc)"));
     481             :   //    return new LJJones(msmc);
     482             : 
     483         146 :   else if (uptype=="M" || uptype=="M MUELLER")
     484          15 :     return new MMueller(msmc);
     485             : 
     486         131 :   else if (uptype=="A" || uptype=="A MUELLER")
     487           0 :     return new AMueller(msmc);
     488             : 
     489         131 :   else if (uptype=="N" || uptype=="A NOISE")
     490           0 :     return new ANoise(msmc);
     491             : 
     492         131 :   else if (uptype=="MF" || uptype=="MF MUELLER")
     493           1 :     return new MfMueller(msmc);
     494             :      
     495         130 :   else if (uptype=="X" || uptype=="X MUELLER")
     496           0 :     return new XMueller(msmc);
     497             : 
     498         130 :   else if (uptype=="XJ" || uptype=="X JONES")
     499           0 :     return new XJones(msmc);
     500             : 
     501         130 :   else if (uptype=="XF" || uptype=="XF JONES")
     502           5 :     return new XfJones(msmc);
     503             : 
     504         125 :   else if (uptype=="K" || uptype=="K JONES")
     505          10 :     return new KJones(msmc);
     506             : 
     507         115 :   else if (uptype=="KCROSS" || uptype=="KCROSS JONES")
     508           1 :     return new KcrossJones(msmc);
     509             : 
     510         228 :   else if (uptype=="GLINXPH" || uptype=="GLINXPH JONES" ||
     511         114 :            uptype=="XY+QU")
     512           0 :     return new GlinXphJones(msmc);
     513             : 
     514         228 :   else if (uptype=="GLINXPHF" || uptype=="GLINXPHF JONES" ||
     515         114 :            uptype=="XYF+QU")
     516           0 :     return new GlinXphfJones(msmc);
     517             : 
     518         228 :   else if (uptype=="XPARANG" || uptype=="XPARANG JONES" ||
     519         114 :            uptype=="XPARANG+QU")
     520           0 :     return new XparangJones(msmc);
     521             : 
     522         227 :   else if (uptype=="XFPARANG" || uptype=="XFPARANG JONES" ||
     523         113 :            uptype=="XFPARANG+QU")
     524           7 :     return new XfparangJones(msmc);
     525             : 
     526         107 :   else if (uptype=="POSANG" || uptype=="POSANG JONES")
     527           8 :     return new PosAngJones(msmc);
     528             : 
     529          99 :   else if (uptype=="KMBD" || uptype=="KMBD JONES")
     530           0 :     return new KMBDJones(msmc);
     531             : 
     532          99 :   else if (uptype.contains("KANTPOS") || uptype.contains("KANTPOS JONES"))
     533           6 :     return new KAntPosJones(msmc);
     534             : 
     535          93 :   else if (uptype.contains("TSYS"))
     536           5 :     return new StandardTsys(msmc);
     537             : 
     538          88 :   else if (uptype.contains("EVLASWP"))
     539           1 :     return new EVLASwPow(msmc);
     540             : 
     541          87 :   else if (uptype=="TFOPAC")  // Not yet solvable (even though an SVJ)
     542           0 :     return new TfOpac(msmc);
     543             : 
     544          87 :   else if (uptype=="TOPAC")  // Not yet solvable (even though an SVJ)
     545           0 :     return new TOpac(msmc);
     546             : 
     547          87 :   else if (uptype.contains("GAINCURVE"))  // Not yet solvable (even though an SVJ)
     548           2 :     return new EGainCurve(msmc);
     549             :   
     550          85 :   else if (uptype.contains("POWERCURVE"))  // Not yet solvable (even though an SVJ)
     551           2 :     return new EPowerCurve(msmc);
     552             :   
     553          83 :   else if (uptype.contains("EVLAGAIN"))
     554           0 :     throw(AipsError("Please regenerate EVLA Sw Pow table using gencal."));
     555             : 
     556          83 :   else if (uptype.contains("TEC") || uptype.contains("F JONES") )  // Ionosphere
     557           1 :     return new FJones(msmc);
     558             : 
     559          82 :   else if (uptype.contains("FRINGE"))  // Fringe-fitting
     560          34 :     return new FringeJones(msmc);
     561             : 
     562          48 :   else if (uptype.contains("ACCOR"))
     563          35 :     return new AccorJones(msmc);
     564             : 
     565          13 :   else if (uptype.contains("SDSKY_PS"))
     566           3 :     return new SingleDishPositionSwitchCal(msmc);
     567             : 
     568          10 :   else if (uptype.contains("SDSKY_RASTER"))
     569           0 :     return new SingleDishRasterCal(msmc);
     570             : 
     571          10 :   else if (uptype.contains("SDSKY_OTF"))
     572           0 :     throw(AipsError(uptype+" not yet supported via SingleDishOtfCal(msmc)"));
     573             :   //return new SingleDishOtfCal(msmc);
     574             :   
     575          10 :   else if (uptype.contains("SDGAIN_OTFD"))
     576          10 :     return new SDDoubleCircleGainCal(msmc);
     577             :   
     578             :   else {
     579           0 :     throw(AipsError("Unknown calibration type: '"+type+"'"));
     580             :   }
     581         550 : };
     582             : 
     583             : // Create a specialized SolvableVisCal from nAnt
     584           0 : SolvableVisCal* createSolvableVisCal(const String& type, const Int& nAnt) {
     585             : 
     586           0 :   if      (type=="B") 
     587           0 :     return new BJones(nAnt);
     588             : 
     589           0 :   else if (type=="G") 
     590           0 :     return new GJones(nAnt);
     591             : 
     592           0 :   else if (type=="T") 
     593           0 :     return new TJones(nAnt);
     594             :   
     595           0 :   else if (type=="D") 
     596           0 :     return new DJones(nAnt);
     597             : 
     598           0 :   else if (type=="Df") 
     599           0 :     return new DfJones(nAnt);
     600             : 
     601           0 :   else if (type=="J") 
     602           0 :     return new JJones(nAnt);
     603             :      
     604             :   else {
     605           0 :     throw(AipsError("Unknown calibration type: '"+type+"'"));
     606             :   }
     607             : };
     608             : 
     609             : 
     610             : namespace viscal {
     611             : 
     612             : // Parameter axis slicer for caltables
     613             : //   (experimental)
     614           0 : Slice calParSlice(String caltabname, String what, String pol)
     615             : {
     616           0 :   String caltype=calTableType(caltabname);  // From SolvableVisCal.h (for now)
     617           0 :   return calParSliceByType(caltype,what,pol);
     618           0 : }
     619             : 
     620           0 : Slice calParSliceByType(String caltype, String what, String pol)
     621             : {
     622             :   // Upcase all inputs
     623             :   //  TBD: do this with local copies
     624           0 :   caltype.upcase();
     625           0 :   what.upcase();
     626           0 :   pol.upcase();
     627           0 :   Int s(0),n(0),i(1);
     628             : 
     629           0 :   if (caltype=="B TSYS") {
     630           0 :     if (what=="TSYS") {
     631           0 :       s=0;
     632           0 :       i=1;
     633             :     }
     634             :     else
     635           0 :       throw(AipsError("Unsupported value type: "+what));
     636             :   }
     637           0 :   else if (caltype=="TOPAC") {
     638           0 :     if (what=="OPAC") {
     639           0 :       if (pol=="")
     640           0 :         return Slice(0,1,1); // trivial
     641             :       else
     642           0 :         throw(AipsError("Can't select with pol='"+pol+"' on unpolarized OPAC table."));
     643             :     }
     644             :     else
     645           0 :       throw(AipsError("Unsupported value type: "+what));
     646             :   }
     647           0 :   else if (caltype.contains("EVLASWP")) {
     648             :       // caltype = "G EVLASWPOW" so put before "G" !
     649           0 :     i=2;  // 2 pars-per-pol
     650           0 :     if ((what=="GAINAMP") || (what=="SWPOWER"))
     651           0 :       s=0;
     652           0 :     else if (what=="TSYS")
     653           0 :       s=1;
     654             :     else
     655           0 :       throw(AipsError("Unsupported value type: "+what));
     656             :   }
     657           0 :   else if ((caltype[0]=='G') ||
     658           0 :             caltype[0]=='B' ||
     659           0 :             caltype[0]=='D') {
     660           0 :     if (what=="AMP" ||
     661           0 :         what=="PHASE" ||
     662           0 :         what=="REAL" ||
     663           0 :         what=="IMAG") {
     664           0 :       s=0;  // nominal start is first pol
     665           0 :       i=1;  // increment is nominally 1 (only good for 1-par-per-pol caltypes
     666             :     }
     667             :     else
     668           0 :       throw(AipsError("Unsupported value type: "+what));
     669             :   } 
     670           0 :   else if ((caltype[0]=='T') || (caltype[0]=='X' && !caltype.contains("MUELLER"))) {
     671           0 :     if (what=="AMP" ||
     672           0 :         what=="PHASE" ||
     673           0 :         what=="REAL" ||
     674           0 :         what=="IMAG") {
     675           0 :       if (pol=="")
     676           0 :          return Slice(0,1,1); // trivial
     677             :       else
     678           0 :          throw(AipsError("Can't select with pol='"+pol+"' on unpolarized table."));
     679             :     }
     680             :     else
     681           0 :       throw(AipsError("Unsupported value type: "+what));
     682             :   }
     683           0 :   else if (caltype[0]=='A') {
     684           0 :     if (what=="AMP" ||
     685           0 :         what=="PHASE" ||
     686           0 :         what=="REAL" ||
     687           0 :         what=="IMAG") {
     688           0 :       s=0;  // nominal start is first pol
     689           0 :       i=1;  // increment is nominally 1 (only good for 1-par-per-pol caltypes
     690             :     }
     691             :     else
     692           0 :       throw(AipsError("Unsupported value type: "+what));
     693             :   } 
     694           0 :   else if (caltype[0]=='K') {
     695           0 :     if (caltype=="KANTPOS JONES") {
     696             :       // antenna x,y,z corrections not pol
     697           0 :       if (pol=="")
     698           0 :         return Slice(0,3,1);
     699             :       else
     700           0 :         throw(AipsError("Can't select with pol='"+pol+"' on antpos table."));
     701             :     } else {
     702           0 :       if (what=="DELAY") {
     703           0 :         s=0;
     704           0 :         i=1;
     705             :       } else {
     706           0 :         throw(AipsError("Unsupported value type: "+what));
     707             :       }
     708             :     }
     709             :   }
     710           0 :   else if (caltype[0]=='F') {
     711           0 :     if (caltype.contains("FRINGE")) {
     712           0 :       i = 4;
     713           0 :       if (what=="PHASE") {
     714           0 :         s = 0;
     715           0 :       } else if (what=="DELAY") {
     716           0 :         s = 1;
     717           0 :       } else if (what=="RATE") {
     718           0 :         s = 2;
     719           0 :       } else if (what=="DISP") {
     720           0 :         s = 3;
     721             :       } else { 
     722           0 :         throw(AipsError("Unsupported value type: "+what));
     723             :       }
     724           0 :     } else if (what=="TEC") {
     725           0 :       if (pol=="")
     726           0 :         return Slice(0,1,1); // trivial
     727             :       else
     728           0 :         throw(AipsError("Can't select with pol='"+pol+"' on unpolarized TEC table."));
     729             :     }
     730             :     else
     731           0 :       throw(AipsError("Unsupported value type: "+what));
     732             :   }
     733           0 :   else if (caltype.contains("SDSKY") || caltype.contains("SDGAIN")) {
     734           0 :     if ((what=="AMP") || (what=="REAL")) {
     735           0 :       s=0;  // nominal start is first pol
     736           0 :       i=1;  // increment is nominally 1 (only good for 1-par-per-pol caltypes
     737             :     } else { 
     738           0 :       throw(AipsError("Unsupported value type: "+what));
     739             :     }
     740             :   }
     741           0 :   else if (caltype=="EGAINCURVE") {
     742           0 :     if (what=="AMP" ||
     743           0 :         what=="PHASE" ||
     744           0 :         what=="REAL" ||
     745           0 :         what=="IMAG") {
     746           0 :       if (pol=="")
     747           0 :         return Slice(0,8,1);
     748             :     }
     749             :   }
     750           0 :   else if (caltype=="EPOWERCURVE") {
     751           0 :     if (what=="AMP" ||
     752           0 :         what=="PHASE" ||
     753           0 :         what=="REAL" ||
     754           0 :         what=="IMAG") {
     755           0 :       if (pol=="")
     756           0 :         return Slice(0,16,1);
     757             :     }
     758             :   }
     759             :   else
     760           0 :     throw(AipsError("Unsupported cal type: "+caltype));
     761             : 
     762             :   // Apply generalized pol selection
     763           0 :   if (pol=="L" ||
     764           0 :       pol=="Y") {
     765           0 :     s+=i; // jump by incr to 2nd pol
     766           0 :     n=1;
     767             :   }
     768           0 :   else if (pol=="R" || pol=="X") {
     769           0 :     n=1;  // for _all_ single-pol selections
     770             :   }
     771           0 :   else if (pol=="" || pol=="RL" || pol=="XY") {
     772           0 :     n=2;  // both pols
     773             :   }
     774             :   else {
     775           0 :     throw(AipsError("Unsupported pol: "+pol));
     776             :   }
     777             : 
     778           0 :   return Slice(s,n,i);
     779             : 
     780             : }
     781             : 
     782             : } //# NAMESPACE VISCAL - END
     783             : 
     784             : 
     785             : } //# NAMESPACE CASA - END

Generated by: LCOV version 1.16