casacore
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>
32 #include <casacore/casa/BasicSL/String.h>
33 #include <casacore/casa/Utilities/Fallible.h>
34 #include <casacore/casa/Arrays/Vector.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)
116  Pangle
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.
125  NumberOfTypes = 33
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);
166  // </group>
167 private:
168 };
169 
170 
171 } //# NAMESPACE CASACORE - END
172 
173 #endif
174 
Mark a value as valid or invalid.
Definition: Fallible.h:123
StokesTypes
The Stokes types are defined by this enum.
Definition: Stokes.h:66
@ Undefined
undefined value = 0
Definition: Stokes.h:68
@ Linear
single dish polarization types
Definition: Stokes.h:106
@ YY
linear correlation products
Definition: Stokes.h:85
@ PFtotal
Polarization Fraction (Ptotal/I)
Definition: Stokes.h:112
@ QQ
general quasi-orthogonal correlation products
Definition: Stokes.h:101
@ Ptotal
Polarized intensity ((Q^2+U^2+V^2)^(1/2))
Definition: Stokes.h:108
@ PFlinear
Linear Polarization Fraction (Plinear/I)
Definition: Stokes.h:114
@ LL
circular correlation products
Definition: Stokes.h:79
@ V
standard stokes parameters
Definition: Stokes.h:73
@ YL
mixed correlation products
Definition: Stokes.h:95
@ Pangle
Linear Polarization Angle (0.5 arctan(U/Q)) (in radians)
Definition: Stokes.h:116
@ Plinear
Linearly Polarized intensity ((Q^2+U^2)^(1/2))
Definition: Stokes.h:110
static Vector< String > allNames(Bool includeUndefined=False)
get all recognized stokes names in no guaranteed order.
static Fallible< Int > receptor2(StokesTypes stokesType)
@ NumberOfTypes
The number of StokesTypes.
Definition: Stokes.h:125
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 StokesTypes type(const String &stokesName)
convert String to StokesTypes, returns Stokes::Undefined if it is an unrecognized string.
static Fallible< Int > receptor1(StokesTypes stokesType)
map StokesTypes to receptor number (0 or 1) for the interferometric correlation products.
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:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Bool False
Definition: aipstype.h:44
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42