source: trunk/src/SDPol.h@ 436

Last change on this file since 436 was 429, checked in by kil064, 20 years ago

add functions

getStokesSLice
circularPolarization

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
RevLine 
[419]1//#---------------------------------------------------------------------------
2//# SDPol.h: Polarimetric processing
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2004
5//# ATNF
6//#
7//# This program is free software; you can redistribute it and/or modify it
8//# under the terms of the GNU General Public License as published by the Free
9//# Software Foundation; either version 2 of the License, or (at your option)
10//# any later version.
11//#
12//# This program is distributed in the hope that it will be useful, but
13//# WITHOUT ANY WARRANTY; without even the implied warranty of
14//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15//# Public License for more details.
16//#
17//# You should have received a copy of the GNU General Public License along
18//# with this program; if not, write to the Free Software Foundation, Inc.,
19//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning this software should be addressed as follows:
22//# Internet email: Malte.Marquarding@csiro.au
23//# Postal address: Malte Marquarding,
24//# Australia Telescope National Facility,
25//# P.O. Box 76,
26//# Epping, NSW, 2121,
27//# AUSTRALIA
28//#
29//# $Id:
30//#---------------------------------------------------------------------------
31#ifndef SDPOL_H
32#define SDPOL_H
33
34//# Includes
35#include <casa/aips.h>
36#include <casa/Arrays/Array.h>
37#include <tables/Tables/BaseMappedArrayEngine.h>
38
39
40namespace asap {
41
42class SDPolUtil
43{
44 public:
45// Convert Q and U to polarized intensity
46 static casa::Array<casa::Float> polarizedIntensity (const casa::Array<casa::Float>& Q,
47 const casa::Array<casa::Float>& U);
48// Convert Q and U to polarized position angle (degrees)
49 static casa::Array<casa::Float> positionAngle (const casa::Array<casa::Float>& Q,
50 const casa::Array<casa::Float>& U);
51// Rotate phase of Complex correlation C3+iC4 by phase (degrees)
52 static void rotateXYPhase (casa::Array<casa::Float>& C3,
53 casa::Array<casa::Float>& C4,
54 casa::Float phase);
[429]55
56// Get Stokes slices from the Array. Start and End should
57// already be setup to access the Array at the current cursor location
58// (beam, IF, chanells; see SDMemTable). This function will modify the asap::PolAxis
59// location to access the desired Stokes slice ("I", "Q", "U", "V")
60 static casa::Array<casa::Float> getStokesSlice (casa::Array<casa::Float>& input, const casa::IPosition& start,
61 const casa::IPosition& end, const casa::String& stokes);
62
63// Compute Circular polarization RR or LL from I and V
64 static casa::Array<casa::Float> circularPolarizationFromStokes (casa::Array<casa::Float>& I,
65 casa::Array<casa::Float>& V,
66 casa::Bool doRR);
[419]67};
68
69
70
71class SDStokesEngine : public casa::BaseMappedArrayEngine<casa::Float, casa::Float>
72{
73 //# Make members of parent class known.
74public:
75 using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::sourceName;
76protected:
77 using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::targetName;
78 using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::table;
79 using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::roColumn;
80 using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::rwColumn;
81
82public:
[427]83 // Construct engine. The sourveColumnName holds the XX,YY,R(XY),I(XY)
84 // correlations
85 SDStokesEngine (const casa::String& virtualColumnName,
86 const casa::String& sourceColumnName);
[419]87
88 // Construct from a record specification as created by getmanagerSpec().
89 SDStokesEngine (const casa::Record& spec);
90
91 // Destructor is mandatory.
92 ~SDStokesEngine();
93
94 // Return the type name of the engine (i.e. its class name).
95 virtual casa::String dataManagerType() const;
96
97 // Get the name given to the engine (is the source column name).
98 virtual casa::String dataManagerName() const;
99
100 // casa::Record a casa::Record containing data manager specifications.
101 virtual casa::Record dataManagerSpec() const;
102
103 // Return the name of the class.
104 // This includes the names of the template arguments.
105 static casa::String className();
106
107 // The engine can access column cells.
108 virtual casa::Bool canAccessArrayColumnCells (casa::Bool& reask) const;
109
110 // Register the class name and the static makeObject "constructor".
111 // This will make the engine known to the table system.
112 // The automatically invoked registration function in DataManReg.cc
113 // contains SDStokesEngine
114 // Any other instantiation of this class must be registered "manually"
115 // (or added to DataManReg.cc).
116 static void registerClass();
117
118private:
119 // Copy constructor is only used by clone().
120 // (so it is made private).
121 SDStokesEngine (const SDStokesEngine&);
122
123 // Assignment is not needed and therefore forbidden
124 // (so it is made private and not implemented).
125 SDStokesEngine& operator=(const SDStokesEngine&);
126
127 // Clone the engine object.
128 DataManager* clone() const;
129
130 // Initialize the object for a new table.
131 // It defines the keywords containing the engine parameters.
132 void create (casa::uInt initialNrrow);
133
134 // Preparing consists of setting the writable switch and
135 // adding the initial number of rows in case of create.
136 // Furthermore it reads the keywords containing the engine parameters.
137 void prepare();
138
139 // Get an array in the given row.
140 void getArray (casa::uInt rownr, casa::Array<casa::Float>& array);
141
[427]142 // Exception
[419]143 void putArray (casa::uInt rownr, const casa::Array<casa::Float>& array);
144
[427]145 // Compute Stokes parameters
[419]146 void computeOnGet (casa::Array<casa::Float>& array,
147 const casa::Array<casa::Float>& target);
148
[427]149 // Set shapes
150 virtual void setShape (casa::uInt rownr, const casa::IPosition& outputShape);
151 virtual void setShapeColumn (const casa::IPosition& outputShape);
152 virtual casa::IPosition shape (casa::uInt rownr);
[419]153
[427]154 // Convert input/output shapes
155 casa::IPosition findInputShape (const casa::IPosition& outputShape) const;
156 casa::IPosition findOutputShape (const casa::IPosition& inputShape) const;
157
158
159
[419]160public:
161 //*display 4
162 // Define the "constructor" to construct this engine when a
163 // table is read back.
164 // This "constructor" has to be registered by the user of the engine.
165 // If the engine is commonly used, its registration can be added
166 // to the registerAllCtor function in DataManReg.cc.
167 // That function gets automatically invoked by the table system.
168 static DataManager* makeObject (const casa::String& dataManagerType,
169 const casa::Record& spec);
170};
171
172} // namespace
173
174#endif
Note: See TracBrowser for help on using the repository browser.