casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef SCIMATH_GAUSSIANBEAM_H
26#define SCIMATH_GAUSSIANBEAM_H
27
28#include <casacore/casa/aips.h>
29#include <casacore/casa/Quanta/Quantum.h>
30
31namespace casacore {
32
33// <summary>
34// Represents a Gaussian restoring beam associated with an image.
35// </summary>
36
37// <use visibility=export>
38
39// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
40// </reviewed>
41
42// <prerequisite>
43// </prerequisite>
44
45// <etymology>
46// A Gaussian Beam.
47// </etymology>
48
49// <synopsis>
50// This class represents a Gaussian restoring beam associated with
51// a deconvolved image.
52// </synopsis>
53//
54// <example>
55
56// </example>
57
58
59// <motivation>
60// Restoring beams are used many places in image analysis tasks.
61// </motivation>
62
63// <todo>
64// </todo>
65
67public:
68
69 static const GaussianBeam NULL_BEAM;
70
71 // create a beam with all quantities zero (a null beam).
73
74
75 // Construct a beam from a set of Quantities. If minor > major
76 // an exception is thrown. If any units are not angular, an
77 // exception is thrown
79 const Quantity& major, const Quantity& minor,
80 const Quantity& pa
81 );
82
83 // Construct a beam from a 3-Vector of Quantities representing
84 // the major axis, the minor axis and the position angle (in that order).
85 // If parms[1] > parms[0] (minor axis > major axis),
86 // an exception is thrown. If any units are not angular, an
87 // exception is thrown
89 const Vector<Quantity>& parms
90 );
91
93
95
97
98 Bool operator==(const GaussianBeam& other) const;
99
100 Bool operator!=(const GaussianBeam& other) const;
101
102 // returns the major axis in the same units as it had at construction
103 const Quantity& getMajor() const;
104
105 // returns the value portion of the major axis in the specified units
106 Double getMajor(const Unit& u) const;
107
108 // returns the minor axis in the same units as it had at construction
109 const Quantity& getMinor() const;
110
111 // returns the value portion of the minor axis in the specified units
112 Double getMinor(const Unit& u) const;
113
114 // returns the position angle's value as it was at construction,
115 // unless <src>unwrap</src> is True, in which case the value of the angle
116 // returned will be between -90 and 90 degrees (but with unit the same
117 // as it had when this object was constructed).
118 Quantity getPA(const Bool unwrap=True) const;
119
120 // returns the value portion of the position angle in the specified units
121 Double getPA(const Unit& u, const Bool unwrap=True) const;
122
123 // returns the beam area in the specified <src>unit</src>, which much conform to
124 // solid angle units.
125 Double getArea(const Unit& unit) const;
126
127 // is this object a null beam (ie is either its major and/or minor axis zero)?
128 Bool isNull() const;
129
130 // returns GassianBeam.
131 static const String& className();
132
134
135 void setMajorMinor(const Quantity& majAx, const Quantity& minAx);
136
137 // if unwrap=True, unwrap pa so its value lies in the range
138 // -90 to 90 degrees before setting it.
139 void setPA(const Quantity& pa, Bool unwrap=False);
140
141 static GaussianBeam fromRecord(const Record& rec);
142
143 // convert this object to a three-Vector of (major FWHM, minor FWHM, and pa).
144 // If <src>unwrap</src> is True, the returned pa will fall between -90 and +90
145 // degrees.
146 Vector<Quantity> toVector(const Bool unwrap=True) const;
147
148 // convert stored Quantities to the specified units
149 void convert(const String& majUnit, const String& minUnit,
150 const String& paUnit);
151
152protected:
154
155private:
156 static Quantity _unwrap(const Quantity& pa);
157
158};
159
160
161
162ostream &operator<<(ostream &os, const GaussianBeam& beam);
163
165
166Bool near(const GaussianBeam& left, const GaussianBeam& other,
167 const Double relWidthTol, const Quantity& absPaTol);
168
169} //# end namespace
170
171#endif
172
Double getMajor(const Unit &u) const
returns the value portion of the major axis in the specified units
Bool operator!=(const GaussianBeam &other) const
void convert(const String &majUnit, const String &minUnit, const String &paUnit)
convert stored Quantities to the specified units
static const String & className()
returns GassianBeam.
Record toRecord() const
void setMajorMinor(const Quantity &majAx, const Quantity &minAx)
Bool isNull() const
is this object a null beam (ie is either its major and/or minor axis zero)?
GaussianBeam(const GaussianBeam &other)
Double getMinor(const Unit &u) const
returns the value portion of the minor axis in the specified units
GaussianBeam(const Vector< Quantity > &parms)
Construct a beam from a 3-Vector of Quantities representing the major axis, the minor axis and the po...
static GaussianBeam fromRecord(const Record &rec)
const Quantity & getMajor() const
returns the major axis in the same units as it had at construction
Quantity getPA(const Bool unwrap=True) const
returns the position angle's value as it was at construction, unless unwrap is True,...
GaussianBeam(const Quantity &major, const Quantity &minor, const Quantity &pa)
Construct a beam from a set of Quantities.
Double getArea(const Unit &unit) const
returns the beam area in the specified unit, which much conform to solid angle units.
static Quantity _unwrap(const Quantity &pa)
Double getPA(const Unit &u, const Bool unwrap=True) const
returns the value portion of the position angle in the specified units
GaussianBeam()
create a beam with all quantities zero (a null beam).
Vector< Quantity > toVector(const Bool unwrap=True) const
convert this object to a three-Vector of (major FWHM, minor FWHM, and pa).
const Quantity & getMinor() const
returns the minor axis in the same units as it had at construction
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.
static const GaussianBeam NULL_BEAM
Bool operator==(const GaussianBeam &other) const
GaussianBeam & operator=(const GaussianBeam &other)
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
const Bool False
Definition aipstype.h:42
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
double Double
Definition aipstype.h:53
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)