LCOV - code coverage report
Current view: top level - air_casawvr/casawvr - msantdata.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 23 23 100.0 %
Date: 2024-12-11 20:54:31 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /**
       2             :    Bojan Nikolic <b.nikolic@mrao.cam.ac.uk>, <bojan@bnikolic.co.uk>
       3             :    Initial version September 2010. 
       4             :    Maintained by ESO since 2013.
       5             : 
       6             :    This file is part of LibAIR and is licensed under GNU Public
       7             :    License Version 2
       8             :    
       9             :    \file msantdata.cpp
      10             :    Renamed to msantdata.cc 2023
      11             : 
      12             : */
      13             : 
      14             : #include "msantdata.h"
      15             : #include <casacore/ms/MeasurementSets/MeasurementSet.h>
      16             : #include <casacore/ms/MeasurementSets/MSAntenna.h>
      17             : #include <casacore/ms/MeasurementSets/MSColumns.h>
      18             : 
      19             : namespace LibAIR2 {
      20             : 
      21          25 :   void getAntPos(const casacore::MeasurementSet &ms,
      22             :                  antpos_t &res)
      23             :   {
      24          25 :     const casacore::MSAntenna & antTable(ms.antenna());
      25          25 :     const size_t nant=antTable.nrow();
      26          25 :     res.resize(nant, 3);
      27          25 :     casacore::MSAntennaColumns acols(antTable);
      28          25 :     const casacore::ArrayColumn<casacore::Double> &pos (acols.position());
      29         489 :     for(size_t i=0; i<nant; ++i)
      30             :     {
      31         464 :       casacore::Array<casacore::Double> a;
      32         464 :       pos.get(i, a,
      33             :               casacore::True);
      34        1856 :       for(size_t j=0; j<3; ++j)
      35        1392 :         res(i,j)=a(casacore::IPosition(1,j));
      36         464 :     }
      37          25 :   }
      38             : 
      39          35 :   aname_t getAName(const casacore::MeasurementSet &ms)
      40             :   {
      41          35 :     aname_t res;
      42          35 :     const casacore::MSAntenna & antTable(ms.antenna());
      43          35 :     const size_t nant=antTable.nrow();
      44             : 
      45          35 :     casacore::MSAntennaColumns acols(antTable);
      46          35 :     const casacore::ScalarColumn<casacore::String> &names (acols.name());
      47         715 :     for(size_t i=0; i<nant; ++i)
      48             :     {
      49         680 :       res.insert(aname_t::value_type(i, std::string(names(i))));
      50             :     }
      51          70 :     return res;
      52          35 :   }
      53             : 
      54             : }
      55             : 
      56             : 

Generated by: LCOV version 1.16