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

          Line data    Source code
       1             : //# SimpleComponentGridMachine.cc: Implementation of SimpleComponentGridMachine class
       2             : //# Copyright (C) 1997,1998,1999,2000,2001
       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 addressed 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             : //# $Id$
      27             : 
      28             : #include <synthesis/TransformMachines/SimpCompGridMachine.h>
      29             : #include <casacore/scimath/Mathematics/RigidVector.h>
      30             : #include <components/ComponentModels/ComponentList.h>
      31             : #include <components/ComponentModels/ComponentShape.h>
      32             : #include <components/ComponentModels/ComponentType.h>
      33             : #include <components/ComponentModels/Flux.h>
      34             : #include <components/ComponentModels/SkyComponent.h>
      35             : #include <components/ComponentModels/SpectralModel.h>
      36             : #include <msvis/MSVis/VisBuffer.h>
      37             : #include <casacore/casa/Arrays/ArrayMath.h>
      38             : #include <casacore/casa/Arrays/Cube.h>
      39             : #include <casacore/casa/Arrays/Matrix.h>
      40             : #include <casacore/casa/Arrays/Vector.h>
      41             : #include <casacore/casa/Arrays/IPosition.h>
      42             : #include <casacore/casa/BasicSL/Complex.h>
      43             : #include <casacore/casa/BasicSL/Constants.h>
      44             : 
      45             : using namespace casacore;
      46             : namespace casa { //# NAMESPACE CASA - BEGIN
      47             : 
      48           0 : void SimpleComponentGridMachine::get(VisBuffer& vb,  SkyComponent& component,
      49             :                                      Int row)
      50             : {
      51             :   // If row is -1 then we pass through all rows
      52             :   uInt startRow, endRow;
      53           0 :   if (row < 0) {
      54           0 :     startRow = 0;
      55           0 :     endRow = vb.nRow() - 1;
      56             :   } else {
      57           0 :     startRow = row;
      58           0 :     endRow = row;
      59             :   }
      60           0 :   const uInt nRow = endRow - startRow + 1;
      61             : 
      62           0 :   const uInt npol=vb.visCube().shape()(0);
      63           0 :   const uInt nChan=vb.visCube().shape()(1);
      64           0 :   const IPosition blc(3, 0, 0, startRow);
      65           0 :   const IPosition trc(3, npol-1, nChan-1, endRow);
      66           0 :   const IPosition inc(3, 1);
      67           0 :   Cube<Complex> modelData = vb.modelVisCube()(blc, trc, inc);
      68           0 :   Vector<Double> xyPos(2);
      69           0 :   Vector<Complex> visibility(4);
      70           0 :   const Vector<Double> & frequency = vb.frequency();
      71             : 
      72             :   // Find the offsets in polarization. 
      73             :   Int startPol, offPol;
      74           0 :   Vector<Int> corrType(vb.corrType());
      75           0 :   startPol=corrType(0);
      76           0 :   if((startPol>4)&&(startPol<9)) {
      77           0 :     offPol=5;
      78             :   }
      79           0 :   else if((startPol>8)&&(startPol<13)) {
      80           0 :     offPol=9;
      81             :   }
      82             :   else {
      83           0 :     offPol=startPol;
      84             :   }
      85             : 
      86           0 :   Bool constantSpectrum = false;
      87           0 :   if (component.spectrum().type() == ComponentType::CONSTANT_SPECTRUM) {
      88           0 :     constantSpectrum = true;
      89             :   }
      90           0 :   Bool pointShape = false;
      91           0 :   if (component.shape().type() == ComponentType::POINT) {
      92           0 :     pointShape = true;
      93             :   }
      94             : 
      95             :   // Loop over all rows
      96           0 :   Vector<Double> uvValue(3);
      97           0 :   uvValue=0.0;
      98           0 :   for (uInt r = 0; r < nRow; r++) {
      99           0 :     for (uInt chn = 0; chn < nChan; chn++) {
     100           0 :       if (chn == 0 || !(pointShape && constantSpectrum)) {
     101             :         Vector<DComplex> fluxValue = 
     102           0 :           component.visibility(uvValue, frequency(chn)).value();
     103           0 :         convertArray(visibility, fluxValue);
     104             :       }
     105           0 :       for (uInt pol=0; pol < npol; pol++) {
     106           0 :         modelData(pol, chn, r) = visibility(corrType(pol)-offPol);
     107             :       }
     108             :     }
     109             :   }
     110           0 : }
     111             : 
     112             : 
     113             : 
     114             : 
     115             : 
     116           0 : void SimpleComponentGridMachine::get(VisBuffer& vb, const ComponentList& compList,
     117             :                                      Int row)
     118             : {
     119             : 
     120             :   // Unlike the SimpleComponentFTMachine, we don't have overhead
     121             :   // to save via this method; but we need to provide it due to the
     122             :   // inheritance structure, so we just loop through
     123             :   // and call the get(SkyComponent).
     124             : 
     125           0 :  uInt ncomponents=compList.nelements();
     126           0 :   for (uInt icomp=0;icomp<ncomponents;icomp++) {
     127           0 :     SkyComponent component=compList.component(icomp).copy();
     128           0 :     get(vb,  component, row);
     129             :   }
     130           0 : }
     131             : 
     132             : 
     133             : 
     134             : 
     135             : 
     136             : } //# NAMESPACE CASA - END
     137             : 

Generated by: LCOV version 1.16