casacore
Loading...
Searching...
No Matches
Stokes.h
Go to the documentation of this file.
1//# Stokes.h: Stokes parameter definitions for interface to table data
2//# Copyright (C) 1994,1995,1996,1997,2000
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 MEASURES_STOKES_H
27#define MEASURES_STOKES_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/BasicSL/String.h>
31#include <casacore/casa/Utilities/Fallible.h>
32#include <casacore/casa/Arrays/Vector.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// Stokes parameter definitions for interface to table data.
38// </summary>
39
40// <reviewed tests="tStokes">
41// </reviewed>
42
43// <synopsis>
44// This enumerates the available Stokes types, but does not define
45// the operations for conversion between Stokes types.
46// This class is a wrapper for the ENUM and conversion functions.
47// </synopsis>
48
49class Stokes {
50public:
51
52// The Stokes types are defined by this enum.
53//
54// <note role=warning>
55// <b>DO NOT CHANGE THE ORDER OF THESE TYPES</b>, as the integers corresponding
56// to the <src>enum</src> are required for storage in Tables.
57// One can add to these types, but the order must be preserved.
58// The correlation products are required to have the order indicated with
59// values of 1,2,3,4 plus n*4.
60// </note>
61//
62//# The enum comments below are placed in the position they are to make the
63//# extracted documentation look nice.
65 // undefined value = 0
67 I,
68 Q,
69 U,
70 // standard stokes parameters
72 //
76 // circular correlation products
78 //
82 // linear correlation products
84 //
92 // mixed correlation products
94 //
98 // general quasi-orthogonal correlation products
100 //
103 // single dish polarization types
105 // Polarized intensity ((Q^2+U^2+V^2)^(1/2))
107 // Linearly Polarized intensity ((Q^2+U^2)^(1/2))
109 // Polarization Fraction (Ptotal/I)
111 // Linear Polarization Fraction (Plinear/I)
113 // Linear Polarization Angle (0.5 arctan(U/Q)) (in radians)
114 Pangle
115 };
116
117// The number of StokesTypes.
118// <note role=warning>
119// <b>Update</b> <src>NumberOfTypes</src> when entries are added.
120// </note>
121 enum {
122 // The number of StokesTypes.
123 NumberOfTypes = 33
124 };
125
126// convert Int to StokesTypes, returns Stokes::Undefined if
127// it is an invalid type
128 static StokesTypes type(Int stokesNumber);
129
130// convert String to StokesTypes, returns Stokes::Undefined if
131// it is an unrecognized string. The valid strings are the
132// same as the characters used in the enum above (i.e.
133// "I" returns Stokes::I, "Linear" returns Stokes::Linear, etc).
134 static StokesTypes type(const String & stokesName);
135
136// convert StokesTypes to String, Stokes::Undefined returns
137// "??".
138 static String name(StokesTypes stokesType);
139
140 // get all recognized stokes names in no guaranteed order.
141 static Vector<String> allNames(Bool includeUndefined = False);
142
143// map StokesTypes to receptor number (0 or 1) for the
144// interferometric correlation products.
145// e.g. XY will give receptor1==0 receptor2==1 etc.
146// I,Q,U,V and the single dish types will produce invalid
147// Fallible.
148// <group>
151// </group>
152
153 // These two functions map stokes type to FITS type and vice versa. If you add a
154 // StokesType you should change these functions as well.
155 // <ul>
156 // <li> I,Q,U,V <-> 1,2,3,4
157 // <li> RR,LL,RL,LR <-> -1,-2,-3,-4 Note! Not the same as enum order!
158 // <li> XX,YY,XY,YX <-> -5,-6,-7,-8 Note! Not the same as enum order!
159 // <li> Otherwise, FITS type <-> 100 + Int(stokesType). This is not standard FITS.
160 // </ul>
161 // <group>
162 static Int FITSValue(StokesTypes which);
164 // </group>
165private:
166};
167
168
169} //# NAMESPACE CASACORE - END
170
171#endif
172
Mark a value as valid or invalid.
Definition Fallible.h:121
StokesTypes
The Stokes types are defined by this enum.
Definition Stokes.h:64
@ Undefined
undefined value = 0
Definition Stokes.h:66
@ Linear
single dish polarization types
Definition Stokes.h:104
@ YY
linear correlation products
Definition Stokes.h:83
@ PFtotal
Polarization Fraction (Ptotal/I)
Definition Stokes.h:110
@ QQ
general quasi-orthogonal correlation products
Definition Stokes.h:99
@ Ptotal
Polarized intensity ((Q^2+U^2+V^2)^(1/2))
Definition Stokes.h:106
@ PFlinear
Linear Polarization Fraction (Plinear/I)
Definition Stokes.h:112
@ LL
circular correlation products
Definition Stokes.h:77
@ V
standard stokes parameters
Definition Stokes.h:71
@ YL
mixed correlation products
Definition Stokes.h:93
@ Pangle
Linear Polarization Angle (0.5 arctan(U/Q)) (in radians)
Definition Stokes.h:114
@ Plinear
Linearly Polarized intensity ((Q^2+U^2)^(1/2))
Definition Stokes.h:108
@ NumberOfTypes
The number of StokesTypes.
Definition Stokes.h:123
static Fallible< Int > receptor1(StokesTypes stokesType)
map StokesTypes to receptor number (0 or 1) for the interferometric correlation products.
static Fallible< Int > receptor2(StokesTypes stokesType)
static Int FITSValue(StokesTypes which)
These two functions map stokes type to FITS type and vice versa.
static StokesTypes type(Int stokesNumber)
convert Int to StokesTypes, returns Stokes::Undefined if it is an invalid type
static StokesTypes fromFITSValue(Int)
static Vector< String > allNames(Bool includeUndefined=False)
get all recognized stokes names in no guaranteed order.
static StokesTypes type(const String &stokesName)
convert String to StokesTypes, returns Stokes::Undefined if it is an unrecognized string.
static String name(StokesTypes stokesType)
convert StokesTypes to String, Stokes::Undefined returns "??".
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40