casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GaussianBeam.h
Go to the documentation of this file.
1 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2003
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 //# $Id: HostInfoDarwin.h 21521 2014-12-10 08:06:42Z gervandiepen $
26 
27 #ifndef SCIMATH_GAUSSIANBEAM_H
28 #define SCIMATH_GAUSSIANBEAM_H
29 
30 #include <casacore/casa/aips.h>
32 
33 namespace casacore {
34 
35 // <summary>
36 // Represents a Gaussian restoring beam associated with an image.
37 // </summary>
38 
39 // <use visibility=export>
40 
41 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
42 // </reviewed>
43 
44 // <prerequisite>
45 // </prerequisite>
46 
47 // <etymology>
48 // A Gaussian Beam.
49 // </etymology>
50 
51 // <synopsis>
52 // This class represents a Gaussian restoring beam associated with
53 // a deconvolved image.
54 // </synopsis>
55 //
56 // <example>
57 
58 // </example>
59 
60 
61 // <motivation>
62 // Restoring beams are used many places in image analysis tasks.
63 // </motivation>
64 
65 // <todo>
66 // </todo>
67 
68 class GaussianBeam {
69 public:
70 
71  static const GaussianBeam NULL_BEAM;
72 
73  // create a beam with all quantities zero (a null beam).
74  GaussianBeam();
75 
76 
77  // Construct a beam from a set of Quantities. If minor > major
78  // an exception is thrown. If any units are not angular, an
79  // exception is thrown
81  const Quantity& major, const Quantity& minor,
82  const Quantity& pa
83  );
84 
85  // Construct a beam from a 3-Vector of Quantities representing
86  // the major axis, the minor axis and the position angle (in that order).
87  // If parms[1] > parms[0] (minor axis > major axis),
88  // an exception is thrown. If any units are not angular, an
89  // exception is thrown
91  const Vector<Quantity>& parms
92  );
93 
94  GaussianBeam(const GaussianBeam& other);
95 
96  ~GaussianBeam();
97 
98  GaussianBeam& operator=(const GaussianBeam& other);
99 
100  Bool operator==(const GaussianBeam& other) const;
101 
102  Bool operator!=(const GaussianBeam& other) const;
103 
104  // returns the major axis in the same units as it had at construction
105  const Quantity& getMajor() const;
106 
107  // returns the value portion of the major axis in the specified units
108  Double getMajor(const Unit& u) const;
109 
110  // returns the minor axis in the same units as it had at construction
111  const Quantity& getMinor() const;
112 
113  // returns the value portion of the minor axis in the specified units
114  Double getMinor(const Unit& u) const;
115 
116  // returns the position angle's value as it was at construction,
117  // unless <src>unwrap</src> is True, in which case the value of the angle
118  // returned will be between -90 and 90 degrees (but with unit the same
119  // as it had when this object was constructed).
120  Quantity getPA(const Bool unwrap=True) const;
121 
122  // returns the value portion of the position angle in the specified units
123  Double getPA(const Unit& u, const Bool unwrap=True) const;
124 
125  // returns the beam area in the specified <src>unit</src>, which much conform to
126  // solid angle units.
127  Double getArea(const Unit& unit) const;
128 
129  // is this object a null beam (ie is either its major and/or minor axis zero)?
130  Bool isNull() const;
131 
132  // returns GassianBeam.
133  static const String& className();
134 
135  Record toRecord() const;
136 
137  void setMajorMinor(const Quantity& majAx, const Quantity& minAx);
138 
139  // if unwrap=True, unwrap pa so its value lies in the range
140  // -90 to 90 degrees before setting it.
141  void setPA(const Quantity& pa, Bool unwrap=False);
142 
143  static GaussianBeam fromRecord(const Record& rec);
144 
145  // convert this object to a three-Vector of (major FWHM, minor FWHM, and pa).
146  // If <src>unwrap</src> is True, the returned pa will fall between -90 and +90
147  // degrees.
148  Vector<Quantity> toVector(const Bool unwrap=True) const;
149 
150  // convert stored Quantities to the specified units
151  void convert(const String& majUnit, const String& minUnit,
152  const String& paUnit);
153 
154 protected:
156 
157 private:
158  static Quantity _unwrap(const Quantity& pa);
159 
160 };
161 
162 
163 
164 ostream &operator<<(ostream &os, const GaussianBeam& beam);
165 
166 LogIO &operator<<(LogIO &os, const GaussianBeam& beam);
167 
168 Bool near(const GaussianBeam& left, const GaussianBeam& other,
169  const Double relWidthTol, const Quantity& absPaTol);
170 
171 } //# end namespace
172 
173 #endif
174 
A 1-D Specialization of the Array class.
Definition: ArrayFwd.h:9
void setPA(const Quantity &pa, Bool unwrap=False)
if unwrap=True, unwrap pa so its value lies in the range -90 to 90 degrees before setting it...
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
void convert(const String &majUnit, const String &minUnit, const String &paUnit)
convert stored Quantities to the specified units
ostream-like interface to creating log messages.
Definition: LogIO.h:167
Represents a Gaussian restoring beam associated with an image.
Definition: GaussianBeam.h:68
defines physical units
Definition: Unit.h:189
const Quantity & getMajor() const
returns the major axis in the same units as it had at construction
GaussianBeam()
create a beam with all quantities zero (a null beam).
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
Double getArea(const Unit &unit) const
returns the beam area in the specified unit, which much conform to solid angle units.
Bool isNull() const
is this object a null beam (ie is either its major and/or minor axis zero)?
double Double
Definition: aipstype.h:55
void setMajorMinor(const Quantity &majAx, const Quantity &minAx)
static const String & className()
returns GassianBeam.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Record toRecord() const
const Bool False
Definition: aipstype.h:44
Bool operator==(const GaussianBeam &other) const
GaussianBeam & operator=(const GaussianBeam &other)
String: the storage and methods of handling collections of characters.
Definition: String.h:225
static Quantity _unwrap(const Quantity &pa)
Bool operator!=(const GaussianBeam &other) const
static const GaussianBeam NULL_BEAM
Definition: GaussianBeam.h:71
Vector< Quantity > toVector(const Bool unwrap=True) const
convert this object to a three-Vector of (major FWHM, minor FWHM, and pa).
Quantity getPA(const Bool unwrap=True) const
returns the position angle&#39;s value as it was at construction, unless unwrap is True, in which case the value of the angle returned will be between -90 and 90 degrees (but with unit the same as it had when this object was constructed).
const Bool True
Definition: aipstype.h:43
static GaussianBeam fromRecord(const Record &rec)
const Quantity & getMinor() const
returns the minor axis in the same units as it had at construction