casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PlotMSTransformations.h
Go to the documentation of this file.
00001 //# PlotMSAveraging.h: Transformation parameters.
00002 //# Copyright (C) 2009
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 #ifndef PLOTMSTRANSFORMATIONS_H_
00028 #define PLOTMSTRANSFORMATIONS_H_
00029 
00030 #include <plotms/PlotMS/PlotMSConstants.h>
00031 #include <casa/Quanta/Quantum.h>
00032 #include <measures/Measures/MFrequency.h>
00033 #include <measures/Measures/MDoppler.h>
00034 
00035 #include <casa/namespace.h>
00036 
00037 namespace casa {
00038 
00039 // Specifies averaging parameters for an MS.
00040 class PlotMSTransformations {
00041 public:
00042   // Static //
00043   
00044   // Enum and methods to define the different fields for an MS averaging.
00045   // <group>
00046   PMS_ENUM1(Field, fields, fieldStrings, field,
00047             FRAME, VELDEF)
00048   PMS_ENUM2(Field, fields, fieldStrings, field,
00049             "Frame", "veldef")
00050   // </group>
00051               
00052   // Non-Static //
00053     
00054   // Constructor, which uses default values.
00055   PlotMSTransformations();
00056     
00057   // Destructor.
00058   ~PlotMSTransformations();
00059     
00060     
00061   // Converts this object to/from a record.  Each field will have a key that
00062   // is its enum name
00063   // <group>
00064   void fromRecord(const RecordInterface& record);
00065   Record toRecord() const;
00066   // </group>
00067 
00068 
00069   // If any transformations are specified, return True
00070   Bool anyTransform() const { return ((frameStr()!="") ||
00071                                 (veldefStr()!="RADIO") ||
00072                                 (xpcOffset()!=0.0) ||
00073                                 (ypcOffset()!=0.0) ||
00074                                 (formStokes()) ); };
00075   
00076   // Convenience methods for returning the standard field values.
00077   // <group>
00078   MFrequency::Types frame() { return mfreqType_; };
00079   MDoppler::Types veldef()  { return mdoppType_; };
00080   String frameStr() const   { return (mfreqType_==MFrequency::N_Types ? 
00081                                       "" : MFrequency::showType(mfreqType_)); };
00082   String veldefStr() const  { return MDoppler::showType(mdoppType_); };
00083   Double restFreq() const   { return restFreq_; };  // In MHz
00084   Double restFreqHz() const   { return restFreq_*1.0e6; };
00085   Double xpcOffset() const  { return XpcOffset_; };
00086   Double ypcOffset() const  { return YpcOffset_; };
00087   Bool formStokes() const   { return formStokes_; };
00088 
00089   // </group>
00090   
00091   
00092   // Convenience methods for setting the standard field values.
00093   // <group>
00094   void setFrame(MFrequency::Types type) { mfreqType_=type; };
00095   void setFrame(const String& typeStr)  { 
00096     if (typeStr=="") mfreqType_=MFrequency::N_Types;
00097     else MFrequency::getType(mfreqType_,typeStr); };
00098   void setVelDef(MDoppler::Types type)  { mdoppType_=type; };
00099   void setVelDef(const String& typeStr) { MDoppler::getType(mdoppType_,typeStr); };
00100   void setRestFreq(Double restfreq)     { restFreq_ = restfreq; };  // in MHz
00101   void setRestFreq(Quantity restfreq)   { restFreq_ = restfreq.getValue("MHz"); };
00102   void setXpcOffset(Double dx)          { XpcOffset_ = dx; };
00103   void setYpcOffset(Double dy)          { YpcOffset_ = dy; };
00104   void setFormStokes(Bool formstokes)   { formStokes_ = formstokes; };
00105   // </group>
00106   
00107   
00108   // Equality operators.
00109   // <group>
00110   bool operator==(const PlotMSTransformations& other) const;
00111   bool operator!=(const PlotMSTransformations& other) const {
00112     return !(operator==(other)); }
00113   // </group>
00114 
00115   // Print out a summary
00116   String summary() const;
00117   
00118 private:
00119 
00120   // The Frequency frame
00121   MFrequency::Types mfreqType_;
00122   
00123   // The Velocity Defn
00124   MDoppler::Types mdoppType_;
00125   
00126   // The rest frequency (MHz)
00127   Double restFreq_;
00128 
00129   // Phase center offsets
00130   Double XpcOffset_, YpcOffset_;
00131 
00132   // Form Stokes from correlations
00133   Bool formStokes_;
00134 
00135   // Sets the default values.
00136   void setDefaults();
00137     
00138 };
00139 
00140 }
00141 
00142 #endif /* PLOTMSTRANSFORMATIONS_H_ */