[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:
|
---|
| 71 | // Construct an engine to scale all arrays in a column with
|
---|
| 72 | // the given offset and scale factor.
|
---|
| 73 | // TargetColumnName is the name of the column where the scaled
|
---|
| 74 | // data will be put and must have data type Float.
|
---|
| 75 | // The source column using this engine must have data type Float.
|
---|
| 76 | SDStokesEngine (const casa::String& sourceColumnName,
|
---|
| 77 | const casa::String& targetColumnName);
|
---|
| 78 |
|
---|
| 79 | // Construct from a record specification as created by getmanagerSpec().
|
---|
| 80 | SDStokesEngine (const casa::Record& spec);
|
---|
| 81 |
|
---|
| 82 | // Destructor is mandatory.
|
---|
| 83 | ~SDStokesEngine();
|
---|
| 84 |
|
---|
| 85 | // Return the type name of the engine (i.e. its class name).
|
---|
| 86 | virtual casa::String dataManagerType() const;
|
---|
| 87 |
|
---|
| 88 | // Get the name given to the engine (is the source column name).
|
---|
| 89 | virtual casa::String dataManagerName() const;
|
---|
| 90 |
|
---|
| 91 | // casa::Record a casa::Record containing data manager specifications.
|
---|
| 92 | virtual casa::Record dataManagerSpec() const;
|
---|
| 93 |
|
---|
| 94 | // Return the name of the class.
|
---|
| 95 | // This includes the names of the template arguments.
|
---|
| 96 | static casa::String className();
|
---|
| 97 |
|
---|
| 98 | // The engine can access column cells.
|
---|
| 99 | virtual casa::Bool canAccessArrayColumnCells (casa::Bool& reask) const;
|
---|
| 100 |
|
---|
| 101 | // Register the class name and the static makeObject "constructor".
|
---|
| 102 | // This will make the engine known to the table system.
|
---|
| 103 | // The automatically invoked registration function in DataManReg.cc
|
---|
| 104 | // contains SDStokesEngine
|
---|
| 105 | // Any other instantiation of this class must be registered "manually"
|
---|
| 106 | // (or added to DataManReg.cc).
|
---|
| 107 | static void registerClass();
|
---|
| 108 |
|
---|
| 109 | private:
|
---|
| 110 | // Copy constructor is only used by clone().
|
---|
| 111 | // (so it is made private).
|
---|
| 112 | SDStokesEngine (const SDStokesEngine&);
|
---|
| 113 |
|
---|
| 114 | // Assignment is not needed and therefore forbidden
|
---|
| 115 | // (so it is made private and not implemented).
|
---|
| 116 | SDStokesEngine& operator=(const SDStokesEngine&);
|
---|
| 117 |
|
---|
| 118 | // Clone the engine object.
|
---|
| 119 | DataManager* clone() const;
|
---|
| 120 |
|
---|
| 121 | // Initialize the object for a new table.
|
---|
| 122 | // It defines the keywords containing the engine parameters.
|
---|
| 123 | void create (casa::uInt initialNrrow);
|
---|
| 124 |
|
---|
| 125 | // Preparing consists of setting the writable switch and
|
---|
| 126 | // adding the initial number of rows in case of create.
|
---|
| 127 | // Furthermore it reads the keywords containing the engine parameters.
|
---|
| 128 | void prepare();
|
---|
| 129 |
|
---|
| 130 | // Get an array in the given row.
|
---|
| 131 | void getArray (casa::uInt rownr, casa::Array<casa::Float>& array);
|
---|
| 132 |
|
---|
| 133 | // Excpetion
|
---|
| 134 | void putArray (casa::uInt rownr, const casa::Array<casa::Float>& array);
|
---|
| 135 |
|
---|
| 136 | // Compute STokes parameters
|
---|
| 137 | void computeOnGet (casa::Array<casa::Float>& array,
|
---|
| 138 | const casa::Array<casa::Float>& target);
|
---|
| 139 |
|
---|
| 140 |
|
---|
| 141 | public:
|
---|
| 142 | //*display 4
|
---|
| 143 | // Define the "constructor" to construct this engine when a
|
---|
| 144 | // table is read back.
|
---|
| 145 | // This "constructor" has to be registered by the user of the engine.
|
---|
| 146 | // If the engine is commonly used, its registration can be added
|
---|
| 147 | // to the registerAllCtor function in DataManReg.cc.
|
---|
| 148 | // That function gets automatically invoked by the table system.
|
---|
| 149 | static DataManager* makeObject (const casa::String& dataManagerType,
|
---|
| 150 | const casa::Record& spec);
|
---|
| 151 | };
|
---|
| 152 |
|
---|
| 153 | } // namespace
|
---|
| 154 |
|
---|
| 155 | #endif
|
---|