[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 | |
---|
| 40 | namespace asap { |
---|
| 41 | |
---|
| 42 | class 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); |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | class SDStokesEngine : public casa::BaseMappedArrayEngine<casa::Float, casa::Float> |
---|
| 60 | { |
---|
| 61 | //# Make members of parent class known. |
---|
| 62 | public: |
---|
| 63 | using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::sourceName; |
---|
| 64 | protected: |
---|
| 65 | using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::targetName; |
---|
| 66 | using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::table; |
---|
| 67 | using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::roColumn; |
---|
| 68 | using casa::BaseMappedArrayEngine<casa::Float,casa::Float>::rwColumn; |
---|
| 69 | |
---|
| 70 | public: |
---|
[427] | 71 | // Construct engine. The sourveColumnName holds the XX,YY,R(XY),I(XY) |
---|
| 72 | // correlations |
---|
| 73 | SDStokesEngine (const casa::String& virtualColumnName, |
---|
| 74 | const casa::String& sourceColumnName); |
---|
[419] | 75 | |
---|
| 76 | // Construct from a record specification as created by getmanagerSpec(). |
---|
| 77 | SDStokesEngine (const casa::Record& spec); |
---|
| 78 | |
---|
| 79 | // Destructor is mandatory. |
---|
| 80 | ~SDStokesEngine(); |
---|
| 81 | |
---|
| 82 | // Return the type name of the engine (i.e. its class name). |
---|
| 83 | virtual casa::String dataManagerType() const; |
---|
| 84 | |
---|
| 85 | // Get the name given to the engine (is the source column name). |
---|
| 86 | virtual casa::String dataManagerName() const; |
---|
| 87 | |
---|
| 88 | // casa::Record a casa::Record containing data manager specifications. |
---|
| 89 | virtual casa::Record dataManagerSpec() const; |
---|
| 90 | |
---|
| 91 | // Return the name of the class. |
---|
| 92 | // This includes the names of the template arguments. |
---|
| 93 | static casa::String className(); |
---|
| 94 | |
---|
| 95 | // The engine can access column cells. |
---|
| 96 | virtual casa::Bool canAccessArrayColumnCells (casa::Bool& reask) const; |
---|
| 97 | |
---|
| 98 | // Register the class name and the static makeObject "constructor". |
---|
| 99 | // This will make the engine known to the table system. |
---|
| 100 | // The automatically invoked registration function in DataManReg.cc |
---|
| 101 | // contains SDStokesEngine |
---|
| 102 | // Any other instantiation of this class must be registered "manually" |
---|
| 103 | // (or added to DataManReg.cc). |
---|
| 104 | static void registerClass(); |
---|
| 105 | |
---|
| 106 | private: |
---|
| 107 | // Copy constructor is only used by clone(). |
---|
| 108 | // (so it is made private). |
---|
| 109 | SDStokesEngine (const SDStokesEngine&); |
---|
| 110 | |
---|
| 111 | // Assignment is not needed and therefore forbidden |
---|
| 112 | // (so it is made private and not implemented). |
---|
| 113 | SDStokesEngine& operator=(const SDStokesEngine&); |
---|
| 114 | |
---|
| 115 | // Clone the engine object. |
---|
| 116 | DataManager* clone() const; |
---|
| 117 | |
---|
| 118 | // Initialize the object for a new table. |
---|
| 119 | // It defines the keywords containing the engine parameters. |
---|
| 120 | void create (casa::uInt initialNrrow); |
---|
| 121 | |
---|
| 122 | // Preparing consists of setting the writable switch and |
---|
| 123 | // adding the initial number of rows in case of create. |
---|
| 124 | // Furthermore it reads the keywords containing the engine parameters. |
---|
| 125 | void prepare(); |
---|
| 126 | |
---|
| 127 | // Get an array in the given row. |
---|
| 128 | void getArray (casa::uInt rownr, casa::Array<casa::Float>& array); |
---|
| 129 | |
---|
[427] | 130 | // Exception |
---|
[419] | 131 | void putArray (casa::uInt rownr, const casa::Array<casa::Float>& array); |
---|
| 132 | |
---|
[427] | 133 | // Compute Stokes parameters |
---|
[419] | 134 | void computeOnGet (casa::Array<casa::Float>& array, |
---|
| 135 | const casa::Array<casa::Float>& target); |
---|
| 136 | |
---|
[427] | 137 | // Set shapes |
---|
| 138 | virtual void setShape (casa::uInt rownr, const casa::IPosition& outputShape); |
---|
| 139 | virtual void setShapeColumn (const casa::IPosition& outputShape); |
---|
| 140 | virtual casa::IPosition shape (casa::uInt rownr); |
---|
[419] | 141 | |
---|
[427] | 142 | // Convert input/output shapes |
---|
| 143 | casa::IPosition findInputShape (const casa::IPosition& outputShape) const; |
---|
| 144 | casa::IPosition findOutputShape (const casa::IPosition& inputShape) const; |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | |
---|
[419] | 148 | public: |
---|
| 149 | //*display 4 |
---|
| 150 | // Define the "constructor" to construct this engine when a |
---|
| 151 | // table is read back. |
---|
| 152 | // This "constructor" has to be registered by the user of the engine. |
---|
| 153 | // If the engine is commonly used, its registration can be added |
---|
| 154 | // to the registerAllCtor function in DataManReg.cc. |
---|
| 155 | // That function gets automatically invoked by the table system. |
---|
| 156 | static DataManager* makeObject (const casa::String& dataManagerType, |
---|
| 157 | const casa::Record& spec); |
---|
| 158 | }; |
---|
| 159 | |
---|
| 160 | } // namespace |
---|
| 161 | |
---|
| 162 | #endif |
---|