casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DiskShape.h
Go to the documentation of this file.
1 //# DiskShape.h:
2 //# Copyright (C) 1998,1999,2000
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id: DiskShape.h 21130 2011-10-18 07:39:05Z gervandiepen $
28 
29 #ifndef COMPONENTS_DISKSHAPE_H
30 #define COMPONENTS_DISKSHAPE_H
31 
32 #include <casa/aips.h>
33 #include <casa/BasicSL/Complex.h>
36 
37 namespace casacore{
38 
39 class MDirection;
40 class MVAngle;
41 template <class Qtype> class Quantum;
42 template <class T> class Matrix;
43 template <class T> class Vector;
44 }
45 
46 namespace casa { //# NAMESPACE CASA - BEGIN
47 
48 
49 // <summary>A disk model for the spatial distribution of emission</summary>
50 
51 // <use visibility=export>
52 
53 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tDiskShape" demos="dTwoSidedShape">
54 // </reviewed>
55 
56 // <prerequisite>
57 // <li> <linkto class=TwoSidedShape>TwoSidedShape</linkto>
58 // </prerequisite>
59 
60 // <synopsis>
61 
62 // A DiskShape models the spatial distribution of radiation from the sky as a
63 // using a uniform brightness elliptical disk with user specified major axis
64 // width, minor axis width and position angle.
65 
66 // This class like the other component shapes becomes more useful when used
67 // through the <linkto class=SkyComponent>SkyComponent</linkto> class, which
68 // incorperates the flux and spectral variation of the emission, or through the
69 // <linkto class=ComponentList>ComponentList</linkto> class, which handles
70 // groups of SkyComponent objects.
71 
72 // The reference direction is defined in celestial co-ordinates, using a
73 // <linkto class=casacore::MDirection>MDirection</linkto> object. It indicates where the
74 // centre of the disk is on the sky. The direction can be specified both in
75 // the constructor or with the <src>setRefDirection</src> function.
76 
77 // The width of the disk is defined as the angular diameter along the specified
78 // axis. The major axis has the larger width and is aligned North-South when
79 // the position angle is zero. A positive position angle moves the Northern
80 // side of the disk to the East. The axial ratio is the ratio of the
81 // minor to major axis widths. The major axis MUST not be smaller than the
82 // minor axis otherwise an casacore::AipsError is thrown.
83 
84 // These parameters of the disk (width, position angle, direction etc.) can be
85 // specified at construction time, using the <src>*inRad</src> functions or
86 // through functions, in the base classes. The base classes also implement
87 // functions for inter-converting this object into a record representation.
88 
89 // The flux, or integrated intensity, is always normalised to one. This class
90 // does not model the actual flux or its variation with frequency. It solely
91 // models the way the emission varies with position on the sky.
92 
93 // The <src>sample</src> member function is used to sample the component at any
94 // point on the sky. The scale factor calculated by this function is the
95 // proportion of the flux that is within a specified pixel size centered on the
96 // specified direction. This is not accurate for pixels which are partially
97 // covered by the disk. Ultimately this function will integrate the emission
98 // from the disk over the entire pixel but currently the returned flux will be
99 // either zero or a constant value with the returned value depending on whether
100 // the centre of the pixel in within the disk or not. This inaccuracy becomes
101 // more important when the pixel size become large compared to the disk width.
102 
103 // This class contains functions that return the Fourier transform of the
104 // disk at a specified spatial frequency. There are described more fully
105 // in the description of the <src>visibility</src> functions below.
106 // </synopsis>
107 
108 // <example>
109 // Shown below is code to construct a disk shaped model whose direction is
110 // always centred on the disk of Jupiter. Note that it is necessary to specify
111 // the observation time in order for the DiskShape class to be able to do the
112 // conversion into J2000 coordinates. This example is also available in the
113 // <src>dTwoSidedShape.cc</src> file.
114 // <srcblock>
115 // { // construct a model for Jupiter.
116 // casacore::Quantity clk_time; casacore::MVTime::read(clk_time, "01-10-2000/12:59");
117 // casacore::MEpoch obs_epoch(clk_time, casacore::MEpoch::UTC);
118 // casacore::MeasFrame obs_frame(obs_epoch);
119 // casacore::MDirection jupiter_dir(casacore::MVDirection(0),
120 // casacore::MDirection::Ref(casacore::MDirection::JUPITER, obs_frame));
121 // DiskShape jupiter_shape;
122 // jupiter_shape.setRefDirection(jupiter_dir);
123 // jupiter_shape.setWidth(casacore::Quantity(4,"arcmin"), casacore::Quantity(3.9,"arcmin"),
124 // casacore::Quantity(3, "deg"));
125 // printShape(jupiter_shape);
126 // casacore::MDirection sample_dir(casacore::MVDirection(1.218, 0.37), casacore::MDirection::J2000);
127 // if (jupiter_shape.sample(sample_dir, casacore::MVAngle(0.1)) > 0.0) {
128 // cout << "The position in J2000 coordinates is near: "
129 // << sample_dir.getAngle("deg") << endl;
130 // }
131 // }
132 // </srcblock>
133 // The printShape function is the example shown for the TwoSidedShape class.
134 // </example>
135 //
136 // <todo asof="1999/11/12">
137 // <li> Use Measures & Quanta in the interface to the visibility functions.
138 // <li> Use a better way of integrating over the pixel area in the sample
139 // function.
140 // <li> Ensure that the position angle is always between zero and 180
141 // degrees, and that the widths are always positive.
142 // </todo>
143 
144 // <linkfrom anchor="GaussianShape" classes="ComponentShape TwoSidedShape PointShape GaussianShape">
145 // <here>DiskShape</here> - a uniform brightness disk shape.
146 // </linkfrom>
147 
148 
150 {
151 public:
152  // The default GaussianShape is at the J2000 North Pole with a width of 1
153  // arc-min on both axes.
154  DiskShape();
155 
156  // Construct a disk shape centred in the specified direction, specifying
157  // the widths & position angle.
158  // <group>
159  DiskShape(
160  const casacore::MDirection& direction,
164  );
165 
166  DiskShape(
167  const casacore::MDirection& direction, const casacore::Quantum<casacore::Double>& width,
169  const casacore::Quantum<casacore::Double>& positionAngle
170  );
171  // </group>
172 
173  // The copy constructor uses copy semantics.
174  DiskShape(const DiskShape& other);
175 
176  // The destructor does nothing special.
177  virtual ~DiskShape();
178 
179  // The assignment operator uses copy semantics.
180  DiskShape& operator=(const DiskShape& other);
181 
182  // get the type of the shape. This function always returns
183  // ComponentType::DISK.
184  virtual ComponentType::Shape type() const;
185 
186  // set or return the width and orientation of the disk. All numerical
187  // values are in radians. There are also functions in the base class for
188  // doing this with other angular units.
189  // <group>
190  virtual void setWidthInRad(
191  const casacore::Double majorAxis,
192  const casacore::Double minorAxis,
193  const casacore::Double positionAngle
194  );
195 
196  virtual casacore::Double majorAxisInRad() const;
197 
198  virtual casacore::Double minorAxisInRad() const;
199 
200  virtual casacore::Double positionAngleInRad() const;
201  // </group>
202 
203  // Calculate the proportion of the flux that is in a pixel of specified size
204  // centered in the specified direction. The returned value will always be
205  // between zero and one (inclusive).
206  virtual casacore::Double sample(
207  const casacore::MDirection& direction,
208  const casacore::MVAngle& pixelLatSize,
209  const casacore::MVAngle& pixelLongSize
210  ) const;
211 
212  // Same as the previous function except that many directions can be sampled
213  // at once. The reference frame and pixel size must be the same for all the
214  // specified directions.
215  virtual void sample(
218  const casacore::MDirection::Ref& refFrame,
219  const casacore::MVAngle& pixelLatSize,
220  const casacore::MVAngle& pixelLongSize
221  ) const;
222 
223  // Return the Fourier transform of the component at the specified point in
224  // the spatial frequency domain. The point is specified by a 3 element vector
225  // (u,v,w) that has units of meters and the frequency of the observation, in
226  // Hertz. These two quantities can be used to derive the required spatial
227  // frequency <src>(s = uvw*freq/c)</src>. The w component is not used in
228  // these functions.
229 
230  // The reference position for the transform is the direction of the
231  // component. As this component is symmetric about this point the transform
232  // is always a real value.
235  const casacore::Double& frequency
236  ) const;
237 
238  // Same as the previous function except that many (u,v,w) points can be
239  // sampled at once. The uvw casacore::Matrix must have a first dimension of three, and
240  // a second dimension that is the same as the length of the scale
241  // Vector. Otherwise and exception is thrown (when compiled in debug mode).
242  virtual void visibility(
244  const casacore::Double& frequency
245  ) const;
246 
247  //same as above except with many frequencies
248  virtual void visibility(
250  const casacore::Vector<casacore::Double>& frequency
251  ) const;
252 
253  // Return a pointer to a copy of this object upcast to a ComponentShape
254  // object. The class that uses this function is responsible for deleting the
255  // pointer. This is used to implement a virtual copy constructor.
256  virtual ComponentShape* clone() const;
257 
258  // casacore::Function which checks the internal data of this class for correct
259  // dimensionality and consistent values. Returns true if everything is fine
260  // otherwise returns false.
261  virtual casacore::Bool ok() const;
262 
263  // return a pointer to this object.
264  virtual const ComponentShape* getPtr() const;
265 
266  virtual casacore::String sizeToString() const;
267 
268 private:
269  // area of disk
270  casacore::Double _area() const;
271 
273  const casacore::MDirection::MVType& compDirValue,
274  const casacore::MDirection::MVType& dirVal,
275  const casacore::Double majRad, const casacore::Double minRad,
276  const casacore::Double pixValue
277  ) const;
278 
281  ) const;
282 
283  static void _rotateVis(
285  const casacore::Double cpa, const casacore::Double spa
286  );
287 
288  // The parameters of the disk
289  // <group>
294  // </group>
295 };
296 
297 }
298 
299 #endif
virtual ~DiskShape()
The destructor does nothing special.
A Measure: astronomical direction.
Definition: MDirection.h:174
std::vector< double > Vector
Definition: ds9context.h:24
virtual casacore::Double minorAxisInRad() const
Base class for component shapes with two sides.
DiskShape()
The default GaussianShape is at the J2000 North Pole with a width of 1 arc-min on both axes...
virtual casacore::DComplex visibility(const casacore::Vector< casacore::Double > &uvw, const casacore::Double &frequency) const
Return the Fourier transform of the component at the specified point in the spatial frequency domain...
virtual void setWidthInRad(const casacore::Double majorAxis, const casacore::Double minorAxis, const casacore::Double positionAngle)
set or return the width and orientation of the disk.
Shape
The shapes of all the components.
casacore::Double _majorAxis
The parameters of the disk.
Definition: DiskShape.h:290
casacore::Double _pa
Definition: DiskShape.h:292
virtual casacore::String sizeToString() const
Get the string containing the various size quantities of a component.
virtual casacore::Bool ok() const
casacore::Function which checks the internal data of this class for correct dimensionality and consis...
virtual const ComponentShape * getPtr() const
return a pointer to this object.
casacore::Double _minorAxis
Definition: DiskShape.h:291
casacore::Quantum< casacore::Double > minorAxis() const
static void _rotateVis(casacore::Double &u, casacore::Double &v, const casacore::Double cpa, const casacore::Double spa)
casacore::Double _recipArea
Definition: DiskShape.h:293
Base class for component shapes.
double Double
Definition: aipstype.h:55
virtual casacore::Double positionAngleInRad() const
virtual casacore::Double sample(const casacore::MDirection &direction, const casacore::MVAngle &pixelLatSize, const casacore::MVAngle &pixelLongSize) const
Calculate the proportion of the flux that is in a pixel of specified size centered in the specified d...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual ComponentShape * clone() const
Return a pointer to a copy of this object upcast to a ComponentShape object.
casacore::Double _calcSample(const casacore::MDirection::MVType &compDirValue, const casacore::MDirection::MVType &dirVal, const casacore::Double majRad, const casacore::Double minRad, const casacore::Double pixValue) const
casacore::Double axialRatio() const
casacore::Double _area() const
area of disk
casacore::Double _calcVis(casacore::Double u, casacore::Double v, const casacore::Double factor) const
A disk model for the spatial distribution of emission.
Definition: DiskShape.h:149
casacore::Quantum< casacore::Double > positionAngle() const
virtual ComponentType::Shape type() const
get the type of the shape.
virtual casacore::Double majorAxisInRad() const
DiskShape & operator=(const DiskShape &other)
The assignment operator uses copy semantics.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Vector of three direction cosines.
Definition: MVDirection.h:106
casacore::Quantum< casacore::Double > majorAxis() const
Class to handle angle type conversions and I/O.
Definition: MVAngle.h:245
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42