casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
UvwCoords.h
Go to the documentation of this file.
00001 #include <vector>
00002 #include <map>
00003 using namespace std;
00004 
00005 #include "Enum.hpp"
00006 #include "CorrelationMode.h"
00007 
00008 #include <measures/Measures.h>
00009 #include <measures/Measures/MEpoch.h>
00010 #include <measures/Measures/MPosition.h>
00011 #include <measures/Measures/MDirection.h>
00012 #include <measures/Measures/MCBaseline.h>
00013 #include <measures/Measures/MBaseline.h>
00014 #include <measures/Measures/MCuvw.h>
00015 #include <measures/Measures/Muvw.h>
00016 #include <casa/Quanta.h>
00017 
00018 using namespace casa;
00019 
00020 #include "ASDMEntities.h"
00021 using namespace asdm;
00022 
00040 class UvwCoords{
00041 public:
00042 
00050   UvwCoords(ASDM* const datasetPtr);
00051 
00053   ~UvwCoords();
00054 
00077   void uvw_bl( Tag configDescriptionId, 
00078                const vector<vector<Angle> >& phaseDir,
00079                double timeCentroid,
00080                Enum<CorrelationMode> correlationMode,
00081                bool reverse, bool autoTrailing,
00082                vector<Vector<casa::Double> >& v_uvw );
00083 
00107   void uvw_bl( Tag configDescriptionId, 
00108                const vector<vector<Angle> >& phaseDir,
00109                const vector<double>& v_timeCentroid,
00110                Enum<CorrelationMode> correlationMode,
00111                bool reverse, bool autoTrailing, 
00112                vector<Vector<casa::Double> >& v_uvw);
00113 
00151   void uvw_bl( asdm::MainRow* mainRow, vector<pair<unsigned int,double> > v_tci, 
00152                Enum<CorrelationMode> correlationMode,
00153                pair<bool,bool> dataOrder, vector<Vector<casa::Double> >& v_uvw);
00154 
00155 
00177   void uvw_bl( asdm::MainRow* mainRow, vector<double> v_timeCentroid, 
00178                Enum<CorrelationMode> correlationMode,
00179                pair<bool,bool> dataOrder,
00180                vector<casa::Vector<casa::Double> >& v_uvw );
00181 
00182 private:
00183 
00187   struct ArrayParam{
00188   public:
00189     Tag                   subarrayId;        //<! (sub)array identifier
00190     vector<Tag>           v_ant;             //<! sequence of antennas
00191     unsigned int          nrepeat;           //<! number of MS main table rows per antenna baseline
00192     Enum<CorrelationMode> e_correlationMode; //<! correlation mode (original mode passed through the user filter)
00197     bool operator== ( ArrayParam & rhs){
00198       set<Tag> a, b;
00199       for(unsigned int na=0; na<v_ant.size(); na++){
00200         a.insert(v_ant[na]);
00201       }
00202 
00203       for (unsigned int na=0; na<rhs.v_ant.size(); na++) {
00204         b.insert(rhs.v_ant[na]);
00205       }
00206 
00207       if( a != b ) return false;
00208       return true;
00209     }
00210     string show(){
00211       ostringstream os;
00212       for(unsigned int n=0; n<v_ant.size(); n++)os << v_ant[n].toString() << " ";
00213       os << " nrepeat " << nrepeat;
00214       return os.str();
00215     }
00216   };
00217 
00218   map<Tag,ArrayParam>            m_array_;
00219   map<Tag,MPosition>             m_antPos_;
00220   map<Tag,Vector<casa::Double> > m_antUVW_;
00221 
00222   // the 3 fundamental attributes of the state machine
00223   double                         timeCentroid_;
00224   vector<vector<Angle> >         phaseDir_; 
00225   Tag                            subarrayId_;
00226 
00227   Vector<casa::Double>           sduvw_;
00228 
00246   vector<double> antPos(const vector<double>& stationPos, const vector<double>& antOffset);
00247 
00261   void uvw_an(double timeCentroid, const vector<vector<Angle> >& phaseDir, const vector<Tag>& v_antId);
00262 
00263 
00281   void uvw_bl( const vector<Tag>& v_antennaId, unsigned int nrep, bool reverse, vector<Vector<casa::Double> >& v_uvw);
00282 
00283 };