casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LimbDarkenedDiskShape.h
Go to the documentation of this file.
00001 //# LimbDarkenedDiskShape.h: defines LimbDarkened Disk shape
00002 //
00003 //#  CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
00004 //# Copyright (C) 2012
00005 //# Associated Universities, Inc. Washington DC, USA.
00006 //#
00007 //# This library is free software; you can redistribute it and/or modify it
00008 //# under the terms of the GNU Lesser General Public License as published by
00009 //# the Free Software Foundation; either version 2.1 of the License, or (at your
00010 //# option) any later version.
00011 //#
00012 //# This library is distributed in the hope that it will be useful, but WITHOUT
00013 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00015 //# License for more details.
00016 //#
00017 //# You should have received a copy of the GNU Lesser General Public License
00018 //# along with this library; if not, write to the Free Software Foundation,
00019 //# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 //#
00021 //#
00022 //#
00023 //# $Id: LimbDarkenedDiskShape.h 23802 2013-04-12 23:51:54Z tak.tsutsumi $
00024 
00025 #ifndef COMPONENT_LIMBDARKENED_DISKSHAPE_H
00026 #define COMPONENT_LIMBDARKENED_DISKSHAPE_H
00027 
00028 //#! Includes go here
00029 #include <casa/aips.h>
00030 #include <casa/BasicSL/Complex.h>
00031 #include <components/ComponentModels/TwoSidedShape.h>
00032 
00033 namespace casa { //# NAMESPACE CASA - BEGIN
00034 
00035 //# Forward Declarations
00036 class MDirection;
00037 class MVAngle;
00038 template <class Qtype> class Quantum;
00039 template <class T> class Matrix;
00040 template <class T> class Vector;
00041 
00042 // <summary>A limb-darkened disk model for the spatial distribution of emission</summary>
00043 
00044 //<use visibility=export>
00045 
00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00047 // </reviewed>
00048 
00049 // <prerequisite>
00050 //   <li><linkto class=TwoSidedShape>TwoSidedShape</linkto>
00051 // </prerequisite>
00052 //
00053 // <etymology>
00054 //#! Except when it is obvious (e.g., "Array") explain how the class name
00055 //#! expresses the role of this class.  Example: IPosition is short for
00056 //#! "Integral Position" - a specialized integer vector for specifying
00057 //#! array dimensions and indices.
00058 // </etymology>
00059 //
00060 // <synopsis>
00061 // A LimbDarkenedDiskShape models the spatial distribution of radiation from 
00062 // the sky as a using a limb-darkened elliptical disk with user specified major axis
00063 // width, minor axis width and position angle.
00064 //
00065 // This class like the other component shapes becomes more useful when used
00066 // through the <linkto class=SkyComponent>SkyComponent</linkto> class, which
00067 // incorperates the flux and spectral variation of the emission, or through the
00068 // <linkto class=ComponentList>ComponentList</linkto> class, which handles
00069 // groups of SkyComponent objects.
00070 // 
00071 // The functionality of this class is similar to that of <linkto class=DiskShape>
00072 // DiskShape</linkto> with an additional parameter to describe the exponent in 
00073 // the limb darkened disk model (\f$I=I_{0}(1-(r/R)^{2})^{n/2}\f$). 
00074 //
00075 // </synopsis>
00076 //
00077 // <example>
00078 //#! One or two concise (~10-20 lines) examples, with a modest amount of
00079 //#! text to support code fragments.  Use <srcblock> and </srcblock> to
00080 //#! delimit example code.
00081 // </example>
00082 //
00083 // <motivation>
00084 //#! Insight into a class is often provided by a description of
00085 //#! the circumstances that led to its conception and design.  Describe
00086 //#! them here.
00087 // </motivation>
00088 //
00089 // <todo asof="yyyy/mm/dd">
00090 //#! A List of bugs, limitations, extensions or planned refinements.
00091 //#! The programmer should fill in a date in the "asof" field, which
00092 //#! will usually be the date at which the class is submitted for review.
00093 //#! If, during the review, new "todo" items come up, then the "asof"
00094 //#! date should be changed to the end of the review period.
00095 //#   <li> add this feature
00096 //#   <li> fix this bug
00097 //#   <li> start discussion of this possible extension
00098 // </todo>
00099 
00100 class LimbDarkenedDiskShape: public TwoSidedShape
00101 {
00102 public:
00103 
00104 //#! Please arrange class members in the sections laid out below.  A
00105 //#! possible exception (there may be others) -- some operator functions
00106 //#! may perform the same task as "General Member Functions", and so you
00107 //#! may wish to group them together.
00108 
00109 //#! Friends
00110 
00111 //#! Enumerations
00112 
00113 //#! Constructors
00114   //Default constsructor
00115   LimbDarkenedDiskShape();
00116 
00117   //<group>
00118   LimbDarkenedDiskShape(const MDirection& direction,
00119             const Quantum<Double>& majorAxis,
00120             const Quantum<Double>& minorAxis,
00121             const Quantum<Double>& positionAngle,
00122             const Float& n);
00123   LimbDarkenedDiskShape(const MDirection& direction, const Quantum<Double>& width,
00124             const Double axialRatio,
00125             const Quantum<Double>& positionAngle,
00126             const Float& n);
00127   // </group>
00128 
00129   // The copy constructor 
00130   LimbDarkenedDiskShape(const LimbDarkenedDiskShape& other);
00131 
00132   // The destructor
00133   virtual ~LimbDarkenedDiskShape();
00134 
00135   //#! Operators
00136   //The assignment operator
00137   LimbDarkenedDiskShape& operator=(const LimbDarkenedDiskShape& other);
00138 
00139   //#! General Member Functions
00140   // get the type of the shape (always returns ComponentType::LimbDakenedDisk)
00141   virtual ComponentType::Shape type() const;
00142 
00143   // use diskshape ones?
00144   //<group>
00145   virtual void setWidthInRad(const Double majorAxis,
00146                              const Double minorAxis,
00147                              const Double positionAngle);
00148   virtual Double majorAxisInRad() const;
00149   virtual Double minorAxisInRad() const;
00150   virtual Double positionAngleInRad() const;
00151   virtual Float getAttnFactor() const;
00152   //set n factor in darkening equation, \f$I=I_{0}(1-(\frac{r}{R})^{2})^{\frac{n}{2}}\f$
00153   virtual void setAttnFactor(const Float attnFactor);  
00154   virtual Vector<Double> optParameters() const;
00155   virtual void setOptParameters(const Vector<Double>& newOptParms);
00156   //</group>
00157 
00158   // Calculate the proportion of the flux that is in a pixel of specified size
00159   // centered in the specified direction. The returned value will always be
00160   // between zero and one (inclusive).
00161   virtual Double sample(const MDirection& direction,
00162                         const MVAngle& pixelLatSize,
00163                         const MVAngle& pixelLongSize) const;
00164 
00165 
00166   // Same as the previous function except that many directions can be sampled
00167   // at once. The reference frame and pixel size must be the same for all the
00168   // specified directions.
00169   virtual void sample(Vector<Double>& scale,
00170                       const Vector<MDirection::MVType>& directions,
00171                       const MDirection::Ref& refFrame,
00172                       const MVAngle& pixelLatSize,
00173                       const MVAngle& pixelLongSize) const;
00174 
00175   // Return the Fourier transform of the component at the specified point in
00176   // the spatial frequency domain. The point is specified by a 3 element vector
00177   // (u,v,w) that has units of meters and the frequency of the observation, in
00178   // Hertz. These two quantities can be used to derive the required spatial
00179   // frequency <src>(s = uvw*freq/c)</src>. The w component is not used in
00180   // these functions.
00181 
00182   // The reference position for the transform is the direction of the
00183   // component. As this component is symmetric about this point the transform
00184   // is always a real value.
00185   virtual DComplex visibility(const Vector<Double>& uvw,
00186                               const Double& frequency) const;
00187 
00188 
00189   // Same as the previous function except that many (u,v,w) points can be
00190   // sampled at once. The uvw Matrix must have a first dimension of three, and
00191   // a second dimension that is the same as the length of the scale
00192   // Vector. Otherwise and exception is thrown (when compiled in debug mode).
00193   virtual void visibility(Vector<DComplex>& scale, const Matrix<Double>& uvw,
00194                           const Double& frequency) const;
00195 
00196   //same as above except with many frequencies
00197   virtual void visibility(Matrix<DComplex>& scale, const Matrix<Double>& uvw,
00198                           const Vector<Double>& frequency) const;
00199 
00200   // Return a pointer to a copy of this object upcast to a ComponentShape
00201   // object. The class that uses this function is responsible for deleting the
00202   // pointer. This is used to implement a virtual copy constructor.
00203   virtual ComponentShape* clone() const;
00204 
00205   // Function which checks the internal data of this class for correct
00206   // dimensionality and consistent values. Returns True if everything is fine
00207   // otherwise returns False.
00208   virtual Bool ok() const;
00209 
00210   // return a pointer to this object.
00211   virtual const ComponentShape* getPtr() const;
00212 
00213   virtual String sizeToString() const;
00214 
00215 private:
00216   Double calcSample(const MDirection::MVType& compDirValue,
00217                     const MDirection::MVType& dirVal,
00218                     const Double majRad, const Double minRad,
00219                     const Double pixValue) const;
00220 
00221   Double calcVis(Double u, Double v, const Double factor) const;
00222   static void rotateVis(Double& u, Double& v,
00223                         const Double cpa, const Double spa);
00224 
00225   //# The parameters of the limb-darkened disk
00226   // <group>
00227   Double itsMajValue;
00228   Double itsMinValue;
00229   Double itsPaValue;
00230   Double itsHeight;
00231   Float  itsAttnFactor;  
00232   // </group>
00233 };
00234 
00235 } //# NAMESPACE CASA - END
00236 
00237 #endif