LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - BeamSquint.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 0 55 0.0 %
Date: 2023-11-02 14:27:30 Functions: 0 9 0.0 %

          Line data    Source code
       1             : //# BeamSquint.cc: Implementation for BeamSquint
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,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: aips2-request@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/Logging/LogIO.h>
      31             : #include <synthesis/TransformMachines/BeamSquint.h>
      32             : 
      33             : 
      34             : 
      35             : using namespace casacore;
      36             : namespace casa { //# NAMESPACE CASA - BEGIN
      37             : 
      38           0 : BeamSquint::BeamSquint()
      39             : {
      40           0 :   squint_p = MDirection( Quantity(0.0, "deg"), Quantity(0.0, "deg"),
      41           0 :                          MDirection::Ref(MDirection::AZEL));
      42           0 :   refFreq_p = 0.0;
      43           0 : };
      44             : 
      45             : 
      46           0 : BeamSquint::BeamSquint(const MDirection& squint, const Quantity& refFreq) :
      47             : squint_p(squint),
      48           0 : refFreq_p(refFreq)
      49             : {
      50           0 : };
      51             : 
      52           0 : BeamSquint::BeamSquint(const BeamSquint& other)
      53             : {
      54           0 :   squint_p = other.squint_p;
      55           0 :   refFreq_p = other.refFreq_p;
      56           0 : };
      57             : 
      58             : 
      59           0 : BeamSquint& BeamSquint::operator=(const BeamSquint& other)
      60             : {
      61           0 :   if (this == &other) 
      62           0 :     return *this;
      63             : 
      64           0 :   squint_p = other.squint_p;
      65           0 :   refFreq_p = other.refFreq_p;
      66           0 :   return *this;
      67             : };
      68             : 
      69           0 : BeamSquint::~BeamSquint()
      70             : {
      71           0 : };
      72             : 
      73           0 : void BeamSquint::show()
      74             : {
      75           0 :     LogIO os(LogOrigin("BeamSquint", "show"));
      76             :     os << "Beam Squint in arcmin (AZ-EL): "
      77           0 :        << squint_p.getAngle().getValue("'") << LogIO::POST;
      78             :     os << "Beam Squint ref freq, GHz    : "
      79           0 :        << refFreq_p.getValue("GHz") << LogIO::POST;
      80           0 : };
      81             : 
      82           0 : Bool BeamSquint::isNonNull()
      83             : {
      84           0 :   Double x = 0.0; x = squint_p.getAngle().getValue("'")(0);
      85           0 :   Double y = 0.0; y = squint_p.getAngle().getValue("'")(1);
      86           0 :   if (abs(x) > 1e-9 || abs(y) > 1e-9) {
      87           0 :     return true;
      88             :   } else {
      89           0 :     return false;
      90             :   }
      91             : };
      92             : 
      93           0 : MDirection& BeamSquint::scale(const Quantity& newFreq)
      94             : {
      95           0 :   Float fScale = 1.0;
      96           0 :   fScale = refFreq_p.getValue("GHz") / newFreq.getValue("GHz");
      97           0 :   Quantity q0 = Quantity(fScale*(squint_p.getAngle().getValue("'")(0)), "'");
      98           0 :   Quantity q1 = Quantity(fScale*(squint_p.getAngle().getValue("'")(1)), "'");
      99             :   MDirection * mdp = new MDirection( q0, q1, 
     100           0 :                                      MDirection::Ref(MDirection::AZEL));
     101           0 :   return *mdp;
     102             : };
     103             : 
     104             : 
     105             : void
     106           0 : BeamSquint::getPointingDirection (const MDirection& pointDir,
     107             :                                   const Quantity parAngle,
     108             :                                   const Quantity obsFreq,
     109             :                                   const SquintType doSquint,
     110             :                                   MDirection& newPointing)
     111             : {
     112             :   //  If there is a problem with the squint, look here first!
     113             :   //  Our convention: for a source which transits south of zenith,
     114             :   //  PA = 0 at its transit, and increases with time.  We need to
     115             :   //  rotate the beam by -PA on the sky
     116             : 
     117             : 
     118           0 :   newPointing = MDirection(pointDir);
     119             : 
     120             :   //  cout << "BS1:  pre-original pointing: " << pointDir.getAngle().getValue("'") << endl;
     121             : 
     122           0 :   if (doSquint != NONE) {
     123             : 
     124             :     // The sign convention here was incorrect, as determined on
     125             :     // VLA L-band observations of IC2233. I flipped it to obtain
     126             :     // the best V image after correction. - TJC 2003/06/18
     127           0 :     Float fScale =  -refFreq_p.getValue("GHz") / obsFreq.getValue("GHz");
     128             : 
     129           0 :     Double sx = fScale*(squint_p.getAngle().getValue()(0));
     130           0 :     Double sy = fScale*(squint_p.getAngle().getValue()(1));  
     131             : 
     132           0 :     String RRorLL = "RR";
     133             : 
     134           0 :     if (doSquint == LL) {
     135           0 :       RRorLL = "LL";
     136           0 :       sx = -sx;
     137           0 :       sy = -sy;
     138             :     }
     139             :     
     140             :     // rotate by -ParAngle
     141           0 :     Double pa = parAngle.getValue("rad");
     142             : 
     143           0 :     Double dx =  sx * cos(-pa) + sy * sin(-pa);
     144           0 :     Double dy = -sx * sin(-pa) + sy * cos(-pa);
     145             :     // but this is in an AZ-EL type frame; flip it for combining with RA/DEC
     146           0 :     dx = -dx;
     147             : 
     148           0 :     newPointing.shift(dx, dy, true);
     149             :     //    cout << "BeamSquint: " << RRorLL << "  sx: " << sx << " sy: " << sy 
     150             :     //    << " pa: " << pa << " dx: " << dx << " dy: " << dy << endl;
     151             :   }    
     152             : 
     153             : 
     154             :   //  cout << "BS2:           new pointing: " << newPointing.getAngle().getValue("'") << endl;
     155             :   //  cout << "BS3: post-original pointing: " << pointDir.getAngle().getValue("'") << endl;
     156             : 
     157             :     
     158           0 : };
     159             : 
     160             : } //# NAMESPACE CASA - END
     161             : 

Generated by: LCOV version 1.16