LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - VPSkyJones.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 81 0.0 %
Date: 2024-10-10 15:00:01 Functions: 0 8 0.0 %

          Line data    Source code
       1             : //# VPSkyJones.cc: Implementation for VPSkyJones
       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             : //# $Id$
      28             : 
      29             : #include <casacore/casa/aips.h>
      30             : #include <casacore/casa/BasicSL/Complex.h>
      31             : #include <synthesis/TransformMachines/PBMath.h>
      32             : #include <synthesis/TransformMachines2/VPSkyJones.h>
      33             : 
      34             : #include <casacore/ms/MeasurementSets/MeasurementSet.h>
      35             : #include <casacore/tables/Tables.h>
      36             : #include <casacore/tables/Tables/TableRecord.h>
      37             : #include <casacore/ms/MeasurementSets/MSColumns.h>
      38             : 
      39             : #include <casacore/measures/Measures/Stokes.h>
      40             : 
      41             : #include <casacore/casa/BasicSL/Constants.h>
      42             : 
      43             : #include <components/ComponentModels/Flux.h>
      44             : #include <components/ComponentModels/ComponentShape.h>
      45             : 
      46             : #include <casacore/images/Images/ImageInterface.h>
      47             : #include <casacore/lattices/Lattices/LatticeStepper.h>
      48             : #include <casacore/lattices/Lattices/LatticeIterator.h>
      49             : 
      50             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      51             : #include <casacore/coordinates/Coordinates/DirectionCoordinate.h>
      52             : #include <casacore/coordinates/Coordinates/SpectralCoordinate.h>
      53             : #include <casacore/coordinates/Coordinates/StokesCoordinate.h>
      54             : #include <casacore/coordinates/Coordinates/Projection.h>
      55             : 
      56             : #include <casacore/casa/Utilities/Assert.h>
      57             : 
      58             : using namespace casacore;
      59             : namespace casa { //# NAMESPACE CASA - BEGIN
      60             : 
      61             : namespace refim {// REFIM namespace
      62             : 
      63             : using namespace casacore;
      64             :  using namespace casa;
      65             : using namespace casacore;
      66             :  using namespace casa::refim;
      67           0 : VPSkyJones::VPSkyJones(const MSColumns& msc, Table& tab,
      68             :                        const Quantity &parAngleInc,
      69             :                        BeamSquint::SquintType doSquint,
      70           0 :                        const Quantity &skyPositionThreshold) 
      71           0 :   : BeamSkyJones(parAngleInc, doSquint,skyPositionThreshold)
      72             : { 
      73           0 :   LogIO os(LogOrigin("VPSkyJones", "VPSkyJones"));
      74             : 
      75           0 :   const uInt nrow = tab.nrow();
      76             : 
      77           0 :   ScalarColumn<String> telCol(tab, "telescope");
      78           0 :   ScalarColumn<Int> antCol(tab, "antenna");
      79           0 :   ScalarColumn<TableRecord> recCol(tab, "pbdescription");
      80             : 
      81             :     
      82           0 :   for (uInt i=0; i < nrow; ++i) {
      83             :     // if-operator condition checks that the names are not redundant
      84           0 :     if (indexTelescope(telCol(i))<0) {
      85             :    
      86             :     
      87             :          
      88             :   
      89           0 :       String name;
      90           0 :       String commonpb;
      91           0 :       if(recCol(i).isDefined("name") && (recCol(i).asString("name") != "REFERENCE")){
      92             : 
      93           0 :         const Int nameFieldNumber=recCol(i).fieldNumber("name");
      94           0 :         if (nameFieldNumber!=-1)
      95           0 :           recCol(i).get(nameFieldNumber,name);      
      96             :         
      97           0 :         if (name == "COMMONPB") {
      98           0 :           const Int commonPBFieldNumber=recCol(i).fieldNumber("commonpb");
      99           0 :           AlwaysAssert(commonPBFieldNumber!=-1,AipsError);
     100           0 :           recCol(i).get(commonPBFieldNumber, commonpb );
     101             :         }      
     102             :         
     103           0 :         if (commonpb == "DEFAULT") {
     104           0 :           String band;
     105             :           PBMath::CommonPB whichPB;
     106           0 :           String commonPBName;
     107           0 :           ScalarColumn<String> telescopesCol(msc.observation().telescopeName());
     108           0 :           Quantity freq( msc.spectralWindow().refFrequency()(0), "Hz");       
     109           0 :           String tele =  telCol(i);
     110           0 :           if(tele=="") {
     111             :             os  << "Telescope name for row " << i << " of " << tab.tableName()
     112           0 :                 << " is blank : cannot find correct primary beam model" << LogIO::EXCEPTION;
     113             :           }
     114             :           else {
     115           0 :             PBMath::whichCommonPBtoUse( tele, freq, band, whichPB, commonPBName );
     116             :           }
     117             :           
     118           0 :           PBMath  myPBMath(tele, false, freq );
     119           0 :           setPBMath (telCol(i), myPBMath);      
     120             :           
     121           0 :         } else {        
     122           0 :           PBMath  myPBMath( recCol(i));
     123           0 :         setPBMath (telCol(i), myPBMath);
     124           0 :         }
     125             :       }
     126             : 
     127           0 :     }
     128             : 
     129             :   }
     130           0 : };
     131             : 
     132             : 
     133           0 : VPSkyJones::VPSkyJones(const MSColumns& msc,
     134             :                        Bool makePBs,
     135             :                        const Quantity &parAngleInc,
     136             :                        BeamSquint::SquintType doSquint,
     137           0 :                        const Quantity &skyPositionThreshold) 
     138           0 :   : BeamSkyJones(parAngleInc, doSquint, skyPositionThreshold)
     139             : { 
     140           0 :   LogIO os(LogOrigin("VPSkyJones", "VPSkyJones"));
     141             : 
     142           0 :   if (makePBs) {
     143           0 :     ScalarColumn<String> telescopesCol(msc.observation().telescopeName());
     144             :     
     145             : 
     146           0 :     for (uInt i=0; i < telescopesCol.nrow(); ++i) {
     147           0 :       String telescope_p = telescopesCol(i); 
     148             :       // if-operator condition checks that the names are not redundant
     149           0 :       if (indexTelescope(telescope_p)<0) {
     150             :         // Ultimately, we need to get the Beam parameters from the MS.beamSubTable,
     151             :         // but until then we will use this: figure it out from Telescope and Freq
     152           0 :         String band;
     153             :         PBMath::CommonPB whichPB;
     154           0 :         String commonPBName;
     155             :         // This frequency is ONLY required to determine which PB model to use:
     156             :         // The VLA, the ATNF, and WSRT have frequency - dependent PB models
     157           0 :         Quantity freq( msc.spectralWindow().refFrequency()(0), "Hz");
     158             :       
     159           0 :         if((telescope_p==" ") || (telescope_p=="")) {
     160           0 :           whichPB=PBMath::UNKNOWN;
     161             :         }
     162             :         else {
     163           0 :           PBMath::whichCommonPBtoUse( telescope_p, freq, band, whichPB, commonPBName );
     164             :         }
     165             :         
     166           0 :         if(whichPB != PBMath::UNKNOWN){
     167           0 :           os << "PB used " << commonPBName << LogIO::POST;
     168           0 :             PBMath  myPBMath(telescope_p, false, freq );
     169           0 :             setPBMath (telescope_p, myPBMath);
     170           0 :         }
     171             :         else{
     172             :           //lets do it by diameter
     173           0 :           os << "PB used determined from dish-diameter" << LogIO::POST;
     174           0 :           Double diam=msc.antenna().dishDiameter()(0);
     175           0 :           PBMath myPBMath(diam, false, freq);
     176           0 :           setPBMath(telescope_p, myPBMath);
     177             : 
     178           0 :         }
     179             : 
     180             : 
     181             : 
     182           0 :       }
     183           0 :     }
     184           0 :   }
     185           0 : };
     186             : 
     187             : 
     188           0 : VPSkyJones::VPSkyJones(const String& telescope,
     189             :                        PBMath::CommonPB commonPBType,
     190             :                        const Quantity &parAngleInc,
     191             :                        BeamSquint::SquintType doSquint,
     192           0 :                        const Quantity &skyPositionThreshold) 
     193           0 :   : BeamSkyJones(parAngleInc, doSquint,skyPositionThreshold)
     194             : {
     195           0 :   LogIO os(LogOrigin("VPSkyJones", "VPSkyJones"));
     196             :    
     197             : 
     198             :   // we need a way to do this for multiple telescope cases
     199           0 :   String telescope_p = telescope;
     200           0 :   PBMath  myPBMath(commonPBType);
     201           0 :   setPBMath (telescope_p, myPBMath);
     202             : 
     203           0 : };
     204             : 
     205             :  
     206             : 
     207             : 
     208           0 : VPSkyJones::VPSkyJones(const String& telescope,
     209             :                        PBMath& myPBMath,
     210             :                        const Quantity &parAngleInc,
     211             :                        BeamSquint::SquintType doSquint,
     212           0 :                        const Quantity &skyPositionThreshold) 
     213           0 :   : BeamSkyJones(parAngleInc, doSquint,skyPositionThreshold)
     214             : { 
     215           0 :   LogIO os(LogOrigin("VPSkyJones", "VPSkyJones"));
     216             :    
     217             : 
     218             :   // we need a way to do this for multiple telescope cases
     219           0 :   String telescope_p = telescope;
     220           0 :   setPBMath (telescope_p, myPBMath);
     221             : 
     222           0 : };
     223             : 
     224             :  
     225             : } //END of REFIM
     226             : } //# NAMESPACE CASA - END
     227             : 

Generated by: LCOV version 1.16