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