LCOV - code coverage report
Current view: top level - synthesis/TransformMachines/test - tGridFT.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 46 48 95.8 %
Date: 2024-10-10 19:51:30 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //# tGridFT.cc: Tests the Synthesis model data serving
       2             : //# Copyright (C) 2016
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This program is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU General Public License as published by the Free
       7             : //# Software Foundation; either version 2 of the License, or (at your option)
       8             : //# any later version.
       9             : //#
      10             : //# This program 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 General Public License for
      13             : //# more details.
      14             : //#
      15             : //# You should have received a copy of the GNU General Public License along
      16             : //# with this program; if not, write to the Free Software Foundation, Inc.,
      17             : //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed 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             : //# $Id$
      27             : #include <casacore/measures/Measures/Stokes.h>
      28             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      29             : #include <casacore/coordinates/Coordinates/DirectionCoordinate.h>
      30             : #include <casacore/coordinates/Coordinates/SpectralCoordinate.h>
      31             : #include <casacore/coordinates/Coordinates/StokesCoordinate.h>
      32             : #include <casacore/coordinates/Coordinates/Projection.h>
      33             : #include <casacore/casa/Arrays/ArrayMath.h>
      34             : #include <casacore/images/Images/ImageInterface.h>
      35             : #include <casacore/images/Images/PagedImage.h>
      36             : #include <casacore/images/Images/TempImage.h>
      37             : #include <components/ComponentModels/ComponentList.h>
      38             : #include <components/ComponentModels/ComponentShape.h>
      39             : #include <components/ComponentModels/Flux.h>
      40             : #include <casacore/tables/TaQL/ExprNode.h>
      41             : #include <casacore/measures/Measures/MeasTable.h>
      42             : #include <casacore/ms/MSSel/MSSelection.h>
      43             : #include <synthesis/TransformMachines/FTMachine.h>
      44             : #include <synthesis/TransformMachines/GridFT.h>
      45             : #include <synthesis/TransformMachines/SimpleComponentFTMachine.h>
      46             : #include <msvis/MSVis/VisImagingWeight.h>
      47             : #include <msvis/MSVis/VisibilityIterator.h>
      48             : #include <msvis/MSVis/VisBuffer.h>
      49             : #include <casacore/casa/namespace.h>
      50             : #include <casacore/casa/OS/Directory.h>
      51             : #include <casacore/casa/Utilities/Regex.h>
      52             : #include "MakeMS.h"
      53             : 
      54             : using namespace std;
      55             : using namespace casa;
      56             : using namespace casacore;
      57             : using namespace casa::test;
      58             : 
      59           1 : Int main(/*int argc, char **argv*/){
      60             : 
      61           2 :   MDirection thedir(Quantity(20.0, "deg"), Quantity(20.0, "deg"));
      62           1 :   String msname("Test.ms");
      63           1 :   MakeMS::makems(msname, thedir);
      64           1 :   MeasurementSet thems(msname, Table::Update);
      65           1 :   thems.markForDelete();
      66           1 :   Block<Int> sort;
      67           1 :   VisibilityIterator vi(thems,sort,0.0);
      68           1 :   VisBuffer vb(vi);
      69           1 :   VisImagingWeight viw("natural");
      70           1 :   vi.useImagingWeight(viw);
      71           1 :   ComponentList cl;
      72           1 :   SkyComponent otherPoint(ComponentType::POINT);
      73           1 :   otherPoint.flux() = Flux<Double>(6.66e-2, 0.0, 0.0, 0.00000);
      74           1 :   otherPoint.shape().setRefDirection(thedir);
      75           1 :   cl.add(otherPoint);
      76           1 :    Matrix<Double> xform(2,2);
      77           1 :    xform = 0.0;
      78           1 :    xform.diagonal() = 1.0;
      79           2 :    DirectionCoordinate dc(MDirection::J2000, Projection::SIN, Quantity(20.0,"deg"), Quantity(20.0, "deg"),
      80           2 :                           Quantity(0.5, "arcsec"), Quantity(0.5,"arcsec"),
      81           0 :                           xform, 50.0, 50.0, 999.0, 
      82           4 :                           999.0);
      83           1 :    Vector<Int> whichStokes(1, Stokes::I);
      84           1 :    StokesCoordinate stc(whichStokes);
      85           1 :    SpectralCoordinate spc(MFrequency::LSRK, 1.5e9, 1e6, 0.0 , 1.420405752E9);
      86           1 :    CoordinateSystem cs;
      87           1 :    cs.addCoordinate(dc); cs.addCoordinate(stc); cs.addCoordinate(spc);
      88           2 :    TempImage<Complex> im(IPosition(4,100,100,1,1), cs); //, "gulu0.image");
      89           1 :    im.set(Complex(0.0));
      90           1 :    MPosition loc;
      91           1 :    MeasTable::Observatory(loc, MSColumns(thems).observation().telescopeName()(0));
      92           2 :    GridFT ftm(1000000, 16, "SF", loc, 1.0, false, false);
      93           1 :    Matrix<Float> weight;
      94           1 :    vi.originChunks();
      95           1 :    vi.origin();
      96           1 :    ftm.initializeToSky(im, weight, vb);
      97           1 :    SimpleComponentFTMachine cft;
      98             :   
      99           2 :    for (vi.originChunks();vi.moreChunks(); vi.nextChunk()){
     100         201 :      for (vi.origin(); vi.more(); vi++){
     101         200 :        cft.get(vb, cl);
     102         200 :        vb.setVisCube(vb.modelVisCube());
     103         200 :        ftm.put(vb);
     104             :      }
     105             :    }
     106             : 
     107           1 :    ftm.getImage(weight, true);
     108           1 :    ftm.finalizeToSky();
     109             :    //cerr << "val at center " << real(im.getAt(IPosition(4, 50, 50, 0, 0))) - 6.66e-2 << endl;
     110           1 :    AlwaysAssertExit(near(6.66e-2, real( im.getAt(IPosition(4, 50, 50, 0, 0))), 1.0e-5));
     111             : 
     112           1 :    exit(0);
     113           0 : }

Generated by: LCOV version 1.16