casacore
Loading...
Searching...
No Matches
StokesConverter.h
Go to the documentation of this file.
1//# StokesConverter.h: convert any set of polarizations into any other one
2//# Copyright (C) 1997,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#ifndef MS_STOKESCONVERTER_H
27#define MS_STOKESCONVERTER_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Arrays/Vector.h>
31#include <casacore/casa/Arrays/Matrix.h>
32#include <casacore/casa/BasicSL/Complex.h>
33#include <casacore/measures/Measures/Stokes.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37// <summary>
38// StokesConverter converts any set of polarizations into any other one
39// </summary>
40
41// <use visibility=export>
42
43// <reviewed reviewer="" date="yyyy/mm/dd" tests="tStokesConverter" demos="">
44// </reviewed>
45
46// <prerequisite>
47// <li> <a href="StokesConverter.html"> Stokes </a>
48// </prerequisite>
49//
50// <etymology>
51// StokesConverter is a class that converts Stokes Parameters
52// </etymology>
53//
54// <synopsis>
55// This class is used to convert polarizations from one system to
56// another.
57// First the conversion wanted is specified and then large blocks of data
58// can be converted.
59// <example>
60// <srcblock>
61// // create converter
62// StokesConverter sc;
63// Vector<Int> out(7),in(4);
64// // set the input polarizations
65// in(0)=Stokes::RR;
66// in(1)=Stokes::LL;
67// in(2)=Stokes::RL;
68// in(3)=Stokes::LR;
69// // set the required output
70// out(0)=Stokes::I;
71// out(1)=Stokes::Q;
72// out(2)=Stokes::U;
73// out(3)=Stokes::V;
74// out(4)=Stokes::Ptotal;
75// out(5)=Stokes::Pangle;
76// out(6)=Stokes::PFlinear;
77// // initialize the conversion engine
78// sc.setConversion(out,in);
79// // set up some test data
80// Vector<Complex> datain(4),dataout(7);
81// datain(0)=1.0;
82// datain(1)=0.9;
83// datain(2)=0.3;
84// datain(3)=0.2;
85// // convert the data
86// sc.convert(dataout,datain);
87// </srcblock>
88// </example>
89// </synopsis>
90//
91// <motivation>
92// Polarization conversion is needed in various places. It makes sense to
93// provide all conversion in one place.
94// </motivation>
95//
96// <thrown>
97// <li>
98// <li>
99// </thrown>
100//
101// <todo asof="1997/10/09">
102// <li> cope with incomplete input polarizations sensibly
103// <li> decide what to do about factor 2 between I and RR/LL,XX/YY etc.
104// </todo>
105
107{
108public:
109
110 // default constructor, does not set up a conversion
112
113 // Set up a conversion from in to out.
114 // The in and out vectors contain a list of polarization present/wanted
115 // in that order. The in vector should match the data to convert.
116 // (CORR_TYPE column in SPECTRAL_WINDOW table contains this info)
117 // The rescale option will correct for crosscorrelation data that
118 // has been scaled to the level Stokes I (common practice
119 // in radioastronomy: even though officially I=XX+YY, in practice
120 // we need to do I=(XX+YY)/2, set rescale to True to do the latter).
122 Bool rescale=False);
123
124 // desctructor
126
127 // Copy constructor
129
130 // Assignment,
132
133 // Change or Set the conversion. Arguments are the same as for
134 // constructor above.
135 void setConversion(const Vector<Int>& out, const Vector<Int>& in,
136 Bool rescale = False);
137
138 // convert data, first dimension of input must match
139 // that of the input conversion vector used to set up the conversion.
140 // Output is resized as needed.
141 void convert(Array<Complex>& out, const Array<Complex>& in) const;
142
143 // convert flags, first dimension of input must match
144 // that of the input conversion vector used to set up the conversion.
145 // Output is resized as needed. All output depending on a flagged input
146 // will be flagged.
147 void convert(Array<Bool>& out, const Array<Bool>& in) const;
148
149 // convert weights, first dimension of input must match
150 // that of the input conversion vector used to set up the conversion.
151 // Output is resized as needed.
152 // Set sigma to True when converting sigma's using this routine.
153 void convert(Array<Float>& out, const Array<Float>& in,
154 Bool sigma=False) const;
155
156 // invert flags, first dimension of input must match
157 // that of the output conversion vector used to set up the conversion.
158 // Output is resized as needed. All output depending on a flagged input
159 // will be flagged. This does the inverse operation of convert, allowing
160 // flagging of converted data to be transferred back to the original data.
161 void invert(Array<Bool>& out, const Array<Bool>& in) const;
162
163protected:
164
165 // initialize the polarization conversion matrix
167
168private:
171 //# mutable because operator Matrix(Slice,Slice) doesn't have const version
178};
179
180
181} //# NAMESPACE CASACORE - END
182
183#endif
StokesConverter(const StokesConverter &other)
Copy constructor.
StokesConverter()
default constructor, does not set up a conversion
void setConversion(const Vector< Int > &out, const Vector< Int > &in, Bool rescale=False)
Change or Set the conversion.
StokesConverter & operator=(const StokesConverter &other)
Assignment,
~StokesConverter()
desctructor
void invert(Array< Bool > &out, const Array< Bool > &in) const
invert flags, first dimension of input must match that of the output conversion vector used to set up...
void convert(Array< Bool > &out, const Array< Bool > &in) const
convert flags, first dimension of input must match that of the input conversion vector used to set up...
StokesConverter(const Vector< Int > &out, const Vector< Int > &in, Bool rescale=False)
Set up a conversion from in to out.
void convert(Array< Complex > &out, const Array< Complex > &in) const
convert data, first dimension of input must match that of the input conversion vector used to set up ...
Matrix< Complex > iquvConv_p
void convert(Array< Float > &out, const Array< Float > &in, Bool sigma=False) const
convert weights, first dimension of input must match that of the input conversion vector used to set ...
Matrix< Complex > polConv_p
void initConvMatrix()
initialize the polarization conversion matrix
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40