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

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1