LCOV - code coverage report
Current view: top level - flagging/Flagging - RFDataMapper.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 14 0.0 %
Date: 2024-11-06 17:42:47 Functions: 0 6 0.0 %

          Line data    Source code
       1             : 
       2             : //# Copyright (C) 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: 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             : #ifndef FLAGGING_RFDATAMAPPER_H
      28             : #define FLAGGING_RFDATAMAPPER_H
      29             : 
      30             : #include <flagging/Flagging/RFChunkStats.h> 
      31             : #include <flagging/Flagging/DDMapper.h> 
      32             : #include <casacore/casa/Arrays/Cube.h>
      33             : #include <casacore/scimath/Mathematics/RigidVector.h>
      34             : #include <casacore/casa/Containers/Block.h>
      35             : 
      36             : namespace casa { //# NAMESPACE CASA - BEGIN
      37             : 
      38             : class RFDataMapper;
      39             : class VisBuffer;
      40             : 
      41             : // a row mapper member function maps a row to a single value
      42             : typedef casacore::Float (RFDataMapper::*RowMapperFunc)(casacore::uInt);
      43             : 
      44             : // <summary>
      45             : // RFDataMapper: maps complex visibilities to a single real value
      46             : // </summary>
      47             : 
      48             : // <use visibility=local>
      49             : 
      50             : // <reviewed reviewer="" date="" tests="" demos="">
      51             : // </reviewed>
      52             : 
      53             : // <prerequisite>
      54             : //   <li> DDMapper
      55             : // </prerequisite>
      56             : //
      57             : // <synopsis>
      58             : // RFDataMapper provides a mechanism to derive a single real value from 
      59             : // a set of complex visibilities in a specific column, using a user-specified 
      60             : // expression (i.e. ABS(XX), ABS(XX)-ABS(YY), etc.) This is used by many 
      61             : // flagging agents.
      62             : // </synopsis>
      63             : //
      64             : // <motivation>
      65             : // To provide a common mechanism for all flagging agents
      66             : // </motivation>
      67             : //
      68             : // <todo asof="2001/04/16">
      69             : //   <li> add this feature
      70             : //   <li> fix this bug
      71             : //   <li> start discussion of this possible extension
      72             : // </todo>
      73             : class RFDataMapper
      74             : {
      75             : public:
      76             :   // type of data mapper: row or individual correlations
      77             :   typedef enum { MAPROW,MAPCORR } MapperType;
      78             :     
      79             :   // construct from a column and a DDMapper
      80             :   RFDataMapper( const casacore::String &col,DDMapper *map );
      81             :   // construct from a column and an expression
      82             :   RFDataMapper( const casacore::Vector<casacore::String> &expr,const casacore::String &defcol = "" );
      83             :   // destructor
      84             :   ~RFDataMapper();
      85             :   
      86             :   // returns type of mapper
      87             :   MapperType type ();
      88             :   
      89             :   // If the value being mapped into is cyclic (i.e. an angle),
      90             :   // returns value of full cycle (e.g. 360); otherwise returns 0.
      91             :   casacore::Double getValueCycle ();
      92             :   // Returns base of a cyclic value (e.g. -180, if value is an angle -180..180)
      93             :   // If value is non-cyclic, the result is undefined.
      94             :   casacore::Double getValueBase  ();
      95             : 
      96             :   // gets a value from the DDMapper
      97             :   casacore::Float mapValue ( casacore::uInt ich,casacore::uInt irow );
      98             :   // gets a value from the row mapper
      99             :   casacore::Float mapValue ( casacore::uInt irow );
     100             : 
     101             :   // uses mapper to compute a correlations mask
     102             :   RFlagWord corrMask (const VisibilityIterator &vi);
     103             :   
     104             :   // point the datamapper at a visbuffer - called for every new buffer
     105             :   void  setVisBuffer (VisBuffer &vb);
     106             : 
     107             :   // returns description
     108             :   casacore::String description () const;
     109             :   // returns description of expression
     110             :   casacore::String descExpression () const;
     111             : 
     112             :   // a cube mapper function maps a visbuffer to a data cube. This
     113             :   // belongs in private or protected, but the SGI compiler wouldn't hear of it
     114             :   typedef casacore::Cube<casacore::Complex> * (*CubeMapperFunc)(VisBuffer &);
     115             :   
     116             : protected:
     117             : 
     118             :   // static helper function to interpret constructor parameters into a cube mapper
     119             :   static CubeMapperFunc getCubeMapper( const casacore::String &col,casacore::Bool throw_excp = false );
     120             :       
     121             :   casacore::String expr_desc,desc;           // expression and description of data mapper
     122             :   DDMapper *ddm;                   // data mapper
     123             :   RowMapperFunc rowmapper;         // row mapper
     124             :   casacore::Cube<casacore::Complex> *pviscube;         // pointer to visibilities cube 
     125             :   casacore::Vector<casacore::RigidVector<casacore::Double,3> > *puvw; // pointer to UVW matrix
     126             :   CubeMapperFunc cubemap; // function to map a chunk to a visibility cube
     127             :   MapperType mytype;
     128             :   casacore::Double full_cycle,cycle_base;     // for cyclic values (i.e. angles)
     129             :   
     130             : // various row mappers
     131             :   casacore::Float dummyRowMapper (casacore::uInt);
     132             :   casacore::Float U_RowMapper (casacore::uInt);
     133             :   casacore::Float V_RowMapper (casacore::uInt);
     134             :   casacore::Float W_RowMapper (casacore::uInt);
     135             :   casacore::Float AbsU_RowMapper (casacore::uInt);
     136             :   casacore::Float AbsV_RowMapper (casacore::uInt);
     137             :   casacore::Float AbsW_RowMapper (casacore::uInt);
     138             :   casacore::Float UVD_RowMapper (casacore::uInt);
     139             :   casacore::Float UVA_RowMapper (casacore::uInt);
     140             :   casacore::Float HA_RowMapper (casacore::uInt);
     141             :   
     142             : // required by the HA mapper - sin(declination) of phase center; 
     143             :   casacore::Double sin_dec;
     144             : };
     145             : 
     146           0 : inline RFDataMapper::MapperType RFDataMapper::type ()
     147           0 : { return mytype; }
     148             : 
     149           0 : inline casacore::Float RFDataMapper::mapValue ( casacore::uInt ich,casacore::uInt irow )
     150             : { 
     151           0 :   if (pviscube == NULL) {
     152           0 :     throw(casacore::AipsError("Visibility buffer is unset, cannot get value!"));
     153             :   }
     154           0 :   return ddm->map(*pviscube,ich,irow); 
     155             : }
     156             : 
     157           0 : inline casacore::Float RFDataMapper::mapValue ( casacore::uInt irow )
     158           0 : { return (this->*rowmapper)(irow); }
     159             : 
     160           0 : inline casacore::String RFDataMapper::description () const
     161           0 : { return desc; }
     162             : inline casacore::String RFDataMapper::descExpression () const
     163             : { return expr_desc; }
     164             : 
     165           0 : inline casacore::Double RFDataMapper::getValueCycle ()
     166           0 : { return full_cycle; }
     167           0 : inline casacore::Double RFDataMapper::getValueBase ()
     168           0 : { return cycle_base; }
     169             : 
     170             : 
     171             : } //# NAMESPACE CASA - END
     172             : 
     173             : #endif

Generated by: LCOV version 1.16