PointingDirectionCalculator.h

Go to the documentation of this file.
00001 //# PointingDirectionCalculator.h: Does for MSes various fixes which do not involve calibrating.
00002 //# Copyright (C) 2008
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 //#
00028 
00029 #ifndef _SYNTHESIS_POINTING_DIRECTION_CALCULATOR_H_
00030 #define _SYNTHESIS_POINTING_DIRECTION_CALCULATOR_H_
00031 
00032 #include <casa/aipstype.h>
00033 #include <casa/BasicSL/String.h>
00034 #include <casa/Arrays/Matrix.h>
00035 #include <casa/Arrays/Vector.h>
00036 #include <casa/Quanta/MVDirection.h>
00037 #include <casa/Utilities/CountedPtr.h>
00038 #include <ms/MeasurementSets/MeasurementSet.h>
00039 #include <ms/MeasurementSets/MSPointing.h>
00040 #include <ms/MeasurementSets/MSPointingColumns.h>
00041 #include <measures/Measures/MCDirection.h>
00042 #include <measures/Measures/MDirection.h>
00043 #include <measures/Measures/MPosition.h>
00044 #include <measures/Measures/MEpoch.h>
00045 #include <measures/Measures/MeasFrame.h>
00046 #include <measures/TableMeasures/ScalarMeasColumn.h>
00047 #include <measures/TableMeasures/ArrayMeasColumn.h>
00048 #include <tables/Tables/ScalarColumn.h>
00049 
00050 namespace casa {
00051 
00052 class PointingDirectionCalculator {
00053 public:
00054     enum MatrixShape {
00055         COLUMN_MAJOR, ROW_MAJOR
00056     };
00057     PointingDirectionCalculator(MeasurementSet const &ms);
00058 
00059     ~PointingDirectionCalculator() {
00060     }
00061 
00062     void selectData(String const &antenna = "", String const &spw =
00063             "", String const &field = "", String const &time = "",
00064             String const &scan = "", String const &feed = "",
00065             String const &intent = "", String const &observation =
00066                     "", String const &uvrange = "",
00067             String const &msselect = "");
00068     void setDirectionColumn(String const &columnName = "DIRECTION");
00069     void setFrame(String const frameType);
00070     void setDirectionListMatrixShape(
00071             PointingDirectionCalculator::MatrixShape const shape);
00072     void setMovingSource(String const sourceName);
00073     void setMovingSource(MDirection const &sourceDirection);
00074     void unsetMovingSource();
00075 
00076     uInt getNrowForSelectedMS() {return selectedMS_->nrow();}
00077     MDirection::Types const &getDirectionType() {return directionType_;}
00078     MDirection const &getMovingSourceDirection() {return *movingSource_;}
00079     Matrix<Double> getDirection();
00080     Vector<Double> getDirection(uInt irow);
00081     Vector<uInt> getRowId();
00082     uInt getRowId(uInt i);
00083 
00084 private:
00085     void init();
00086     void initPointingTable(Int const antennaId);
00087     void resetAntennaPosition(Int const antennaId);
00088     void resetTime(Double const timestamp);
00089     void inspectAntenna();
00090     void configureMovingSourceCorrection();
00091     Vector<Double> doGetDirection(uInt irow);
00092 
00093     // table access stuff
00094     CountedPtr<MeasurementSet> originalMS_;
00095     CountedPtr<MeasurementSet> selectedMS_;
00096     CountedPtr<MSPointing> pointingTable_;
00097     CountedPtr<ROMSPointingColumns> pointingColumns_;
00098     ROScalarMeasColumn<MEpoch> timeColumn_;
00099     ROScalarColumn<Double> intervalColumn_;
00100     ROScalarColumn<Int> antennaColumn_;
00101     String directionColumnName_;
00102     MDirection (*accessor_)(ROMSPointingColumns &pointingColumns,
00103             uInt rownr);
00104 
00105     // conversion stuff
00106     MPosition antennaPosition_;
00107     MEpoch referenceEpoch_;
00108     MeasFrame referenceFrame_;
00109     CountedPtr<MDirection::Convert> directionConvert_;
00110     MDirection::Types directionType_;
00111     CountedPtr<MDirection> movingSource_;
00112     CountedPtr<MDirection::Convert> movingSourceConvert_;
00113     void (*movingSourceCorrection_)(
00114             CountedPtr<MDirection::Convert> &convertToAzel,
00115             CountedPtr<MDirection::Convert> &convertToCelestial,
00116             Vector<Double> &direction);
00117 
00118     // other
00119     Vector<uInt> antennaBoundary_;
00120     uInt numAntennaBoundary_;
00121     Vector<Double> pointingTimeUTC_;
00122     Double lastTimeStamp_;
00123     Int lastAntennaIndex_;
00124     uInt pointingTableIndexCache_;
00125     PointingDirectionCalculator::MatrixShape shape_;
00126 
00127     // privatize  default constructor
00128     PointingDirectionCalculator();
00129 }
00130 ;
00131 
00132 } //# NAMESPACE CASA - END
00133 
00134 #endif /* _SYNTHESIS_POINTING_DIRECTION_CALCULATOR_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1