casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFDataMapper.h
Go to the documentation of this file.
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: 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 #ifndef FLAGGING_RFDATAMAPPER_H
28 #define FLAGGING_RFDATAMAPPER_H
29 
32 #include <casa/Arrays/Cube.h>
34 #include <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
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>
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.
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.
95 
96  // gets a value from the DDMapper
98  // gets a value from the row mapper
100 
101  // uses mapper to compute a correlations mask
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
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
126  CubeMapperFunc cubemap; // function to map a chunk to a visibility cube
128  casacore::Double full_cycle,cycle_base; // for cyclic values (i.e. angles)
129 
130 // various row mappers
141 
142 // required by the HA mapper - sin(declination) of phase center;
144 };
145 
147 { return mytype; }
148 
150 {
151  if (pviscube == NULL) {
152  throw(casacore::AipsError("Visibility buffer is unset, cannot get value!"));
153  }
154  return ddm->map(*pviscube,ich,irow);
155 }
156 
158 { return (this->*rowmapper)(irow); }
159 
161 { return desc; }
163 { return expr_desc; }
164 
166 { return full_cycle; }
168 { return cycle_base; }
169 
170 
171 } //# NAMESPACE CASA - END
172 
173 #endif
casacore::Cube< casacore::Complex > *(* CubeMapperFunc)(VisBuffer &)
a cube mapper function maps a visbuffer to a data cube.
Definition: RFDataMapper.h:114
casacore::Double sin_dec
required by the HA mapper - sin(declination) of phase center;
Definition: RFDataMapper.h:143
casacore::uInt RFlagWord
RFAs use bitwise flags.
Definition: RFCommon.h:41
Abstract Derived casacore::Data Mapper class.
Definition: DDMapper.h:62
casacore::Double getValueBase()
Returns base of a cyclic value (e.g.
Definition: RFDataMapper.h:167
casacore::Float HA_RowMapper(casacore::uInt)
casacore::String descExpression() const
returns description of expression
Definition: RFDataMapper.h:162
RFDataMapper(const casacore::String &col, DDMapper *map)
construct from a column and a DDMapper
casacore::Double cycle_base
Definition: RFDataMapper.h:128
void setVisBuffer(VisBuffer &vb)
point the datamapper at a visbuffer - called for every new buffer
~RFDataMapper()
destructor
casacore::String expr_desc
Definition: RFDataMapper.h:121
casacore::Float UVA_RowMapper(casacore::uInt)
static CubeMapperFunc getCubeMapper(const casacore::String &col, casacore::Bool throw_excp=false)
static helper function to interpret constructor parameters into a cube mapper
RFlagWord corrMask(const VisibilityIterator &vi)
uses mapper to compute a correlations mask
casacore::Double full_cycle
Definition: RFDataMapper.h:128
casacore::Float AbsV_RowMapper(casacore::uInt)
casacore::Float W_RowMapper(casacore::uInt)
casacore::Float AbsW_RowMapper(casacore::uInt)
casacore::Float AbsU_RowMapper(casacore::uInt)
double Double
Definition: aipstype.h:55
casacore::Float(RFDataMapper::* RowMapperFunc)(casacore::uInt)
a row mapper member function maps a row to a single value
Definition: RFDataMapper.h:42
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
CubeMapperFunc cubemap
Definition: RFDataMapper.h:126
float Float
Definition: aipstype.h:54
virtual casacore::Float map(const casacore::Cube< casacore::Complex > &vis, casacore::uInt ich, casacore::uInt irow) const =0
Maps a slice of visibilities at (*,ich,irow) from the given viscube into a the derived value...
MapperType type()
returns type of mapper
Definition: RFDataMapper.h:146
RowMapperFunc rowmapper
Definition: RFDataMapper.h:123
casacore::Float mapValue(casacore::uInt ich, casacore::uInt irow)
gets a value from the DDMapper
Definition: RFDataMapper.h:149
casacore::Cube< casacore::Complex > * pviscube
Definition: RFDataMapper.h:124
Base class for all Casacore library errors.
Definition: Error.h:134
MapperType
type of data mapper: row or individual correlations
Definition: RFDataMapper.h:77
String: the storage and methods of handling collections of characters.
Definition: String.h:223
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
VisibilityIterator iterates through one or more writable MeasurementSets.
casacore::String desc
Definition: RFDataMapper.h:121
casacore::Float dummyRowMapper(casacore::uInt)
various row mappers
casacore::Double getValueCycle()
If the value being mapped into is cyclic (i.e.
Definition: RFDataMapper.h:165
casacore::Float V_RowMapper(casacore::uInt)
casacore::Float UVD_RowMapper(casacore::uInt)
casacore::Float U_RowMapper(casacore::uInt)
casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > * puvw
Definition: RFDataMapper.h:125
casacore::String description() const
returns description
Definition: RFDataMapper.h:160
unsigned int uInt
Definition: aipstype.h:51
RFDataMapper: maps complex visibilities to a single real value.
Definition: RFDataMapper.h:73