casa
$Rev:20696$
|
A Gaussian model for the spatial distribution of emission. More...
#include <GaussianShape.h>
Public Member Functions | |
GaussianShape () | |
The default GaussianShape is at the J2000 North Pole. | |
GaussianShape (const MDirection &direction, const Quantum< Double > &majorAxis, const Quantum< Double > &minorAxis, const Quantum< Double > &positionAngle) | |
Construct a Gaussian shape centred in the specified direction, specifying the widths & position angle. | |
GaussianShape (const MDirection &direction, const Quantum< Double > &width, const Double axialRatio, const Quantum< Double > &positionAngle) | |
GaussianShape (const GaussianShape &other) | |
The copy constructor uses copy semantics. | |
virtual | ~GaussianShape () |
The destructor does nothing special. | |
GaussianShape & | operator= (const GaussianShape &other) |
The assignment operator uses copy semantics. | |
virtual ComponentType::Shape | type () const |
get the type of the shape. | |
virtual void | setWidthInRad (const Double majorAxis, const Double minorAxis, const Double positionAngle) |
set or return the width and orientation of the Gaussian. | |
virtual Double | majorAxisInRad () const |
virtual Double | minorAxisInRad () const |
virtual Double | positionAngleInRad () const |
virtual Double | axialRatio () const |
virtual Double | sample (const MDirection &direction, const MVAngle &pixelLatSize, const MVAngle &pixelLongSize) const |
Calculate the proportion of the flux that is in a pixel of specified size centered in the specified direction. | |
virtual void | sample (Vector< Double > &scale, const Vector< MDirection::MVType > &directions, const MDirection::Ref &refFrame, const MVAngle &pixelLatSize, const MVAngle &pixelLongSize) const |
Same as the previous function except that many directions can be sampled at once. | |
virtual DComplex | visibility (const Vector< Double > &uvw, const Double &frequency) const |
Return the Fourier transform of the component at the specified point in the spatial frequency domain. | |
virtual void | visibility (Vector< DComplex > &scale, const Matrix< Double > &uvw, const Double &frequency) const |
Same as the previous function except that many (u,v,w) points can be sampled at once. | |
virtual void | visibility (Matrix< DComplex > &scale, const Matrix< Double > &uvw, const Vector< Double > &frequency) const |
as above but with many frequencies | |
virtual ComponentShape * | clone () const |
Return a pointer to a copy of this object upcast to a ComponentShape object. | |
virtual Bool | ok () const |
Function which checks the internal data of this class for correct dimensionality and consistent values. | |
virtual const ComponentShape * | getPtr () const |
return a pointer to this object. | |
virtual Quantity | getArea () const |
TODO This probably should be made a pure virtual method in TwoSidedShape Return the effective area of the Gaussian (pi/(4*ln(2))*maj*min. | |
virtual String | sizeToString () const |
Get the string containing the various size quantities of a component. | |
Private Member Functions | |
void | updateFT () |
Private Attributes | |
Gaussian2D< Double > | itsShape |
Gaussian2D< Double > | itsFT |
A Gaussian model for the spatial distribution of emission.
Public interface
<h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd<dt>Test programs:<dd>tGaussianShape<dt>Demo programs:<dd>dTwoSidedShape</dl>
A GaussianShape models the spatial distribution of radiation from the sky as a two-dimensional Gaussian function with user specified major axis width, minor axis width and position angle.
This class like the other component shapes becomes more useful when used through the SkyComponent class, which incorperates the flux and spectral variation of the emission, or through the ComponentList class, which handles groups of SkyComponent objects.
The reference direction is defined in celestial co-ordinates, using a MDirection object. It indicates where the centre of the Gaussian is on the sky. The direction can be specified both in the constructor or with the setRefDirection
function.
The width of the Gaussian is defined as the angle subtended by the full width at half maximum of the Gaussian. The major axis has the larger width and is aligned North-South when the position angle is zero. A positive position angle moves the Northern side of the component to the East. The axial ratio is the ratio of the minor to major axis widths. The major axis MUST not be smaller than the minor axis otherwise an exception (AipsError) is thrown.
These parameters of the Gaussian (width, position angle, direction etc.) can be specified at construction time, using the *inRad
functions or through functions in the base classes (TwoSidedShape & ComponentShape). The base classes also implement functions for inter-converting this object into a record representation.
The flux, or integrated intensity, is always normalised to one. This class does not model the actual flux or its variation with frequency. It solely models the way the emission varies with position on the sky.
The scale
member function is used to sample the component at any point on the sky. The scale factor calculated by this function is the proportion of the flux that is within a specified pixel size centered on the specified direction. Ultimatly this function will integrate the emission from the Gaussian over the entire pixel but currently it just assumes the flux can be calculated by the height of the Gaussian at the centre of the pixel scaled by the pixel area. This is NOT accurate for Gaussians whose width is small compared with the pixel size.
This class contains functions that return the Fourier transform of the component at a specified spatial frequency. There are described more fully in the description of the visibility
functions below.
Suppose I had an image of a region of the sky and we wanted to subtract a extended source from it. This could be done as follows:
Shown below is the code to perform the first step in this process, ie construct the SkyComponent. This example is also available in the dTwoSidedShape.cc
file. Note that it is more accurate to do subtraction of components in the (u,v) domain.
{ // Construct a Gaussian shape MDirection blob_dir; { // get the right direction into blob_dir Quantity blob_ra; MVAngle::read(blob_ra, "19:39:"); Quantity blob_dec; MVAngle::read(blob_dec, "-63.43."); blob_dir = MDirection(blob_ra, blob_dec, MDirection::J2000); } { const Flux<Double> flux(6.28, 0.1, 0.15, 0.01); const GaussianShape shape(blob_dir, Quantity(30, "arcmin"), Quantity(2000, "mas"), Quantity(C::pi_2, "rad")); const ConstantSpectrum spectrum; SkyComponent component(flux, shape, spectrum); printShape(shape); } }
The printShape function is the example shown for the TwoSidedShape class.
Definition at line 154 of file GaussianShape.h.
The default GaussianShape is at the J2000 North Pole.
with a full width at half maximum (FWHM) on both axes of 1 arc-min.
casa::GaussianShape::GaussianShape | ( | const MDirection & | direction, |
const Quantum< Double > & | majorAxis, | ||
const Quantum< Double > & | minorAxis, | ||
const Quantum< Double > & | positionAngle | ||
) |
Construct a Gaussian shape centred in the specified direction, specifying the widths & position angle.
casa::GaussianShape::GaussianShape | ( | const MDirection & | direction, |
const Quantum< Double > & | width, | ||
const Double | axialRatio, | ||
const Quantum< Double > & | positionAngle | ||
) |
casa::GaussianShape::GaussianShape | ( | const GaussianShape & | other | ) |
The copy constructor uses copy semantics.
virtual casa::GaussianShape::~GaussianShape | ( | ) | [virtual] |
The destructor does nothing special.
virtual Double casa::GaussianShape::axialRatio | ( | ) | const [virtual] |
Reimplemented from casa::TwoSidedShape.
virtual ComponentShape* casa::GaussianShape::clone | ( | ) | const [virtual] |
Return a pointer to a copy of this object upcast to a ComponentShape object.
The class that uses this function is responsible for deleting the pointer. This is used to implement a virtual copy constructor.
Implements casa::TwoSidedShape.
virtual Quantity casa::GaussianShape::getArea | ( | ) | const [virtual] |
TODO This probably should be made a pure virtual method in TwoSidedShape Return the effective area of the Gaussian (pi/(4*ln(2))*maj*min.
Units of the returned Quantity are steradians.
virtual const ComponentShape* casa::GaussianShape::getPtr | ( | ) | const [virtual] |
return a pointer to this object.
Implements casa::ComponentShape.
virtual Double casa::GaussianShape::majorAxisInRad | ( | ) | const [virtual] |
Implements casa::TwoSidedShape.
virtual Double casa::GaussianShape::minorAxisInRad | ( | ) | const [virtual] |
Implements casa::TwoSidedShape.
virtual Bool casa::GaussianShape::ok | ( | ) | const [virtual] |
Function which checks the internal data of this class for correct dimensionality and consistent values.
Returns True if everything is fine otherwise returns False.
Reimplemented from casa::TwoSidedShape.
GaussianShape& casa::GaussianShape::operator= | ( | const GaussianShape & | other | ) |
The assignment operator uses copy semantics.
virtual Double casa::GaussianShape::positionAngleInRad | ( | ) | const [virtual] |
Implements casa::TwoSidedShape.
virtual Double casa::GaussianShape::sample | ( | const MDirection & | direction, |
const MVAngle & | pixelLatSize, | ||
const MVAngle & | pixelLongSize | ||
) | const [virtual] |
Calculate the proportion of the flux that is in a pixel of specified size centered in the specified direction.
The returned value will always be between zero and one (inclusive).
Implements casa::TwoSidedShape.
virtual void casa::GaussianShape::sample | ( | Vector< Double > & | scale, |
const Vector< MDirection::MVType > & | directions, | ||
const MDirection::Ref & | refFrame, | ||
const MVAngle & | pixelLatSize, | ||
const MVAngle & | pixelLongSize | ||
) | const [virtual] |
Same as the previous function except that many directions can be sampled at once.
The reference frame and pixel size must be the same for all the specified directions.
Implements casa::TwoSidedShape.
virtual void casa::GaussianShape::setWidthInRad | ( | const Double | majorAxis, |
const Double | minorAxis, | ||
const Double | positionAngle | ||
) | [virtual] |
set or return the width and orientation of the Gaussian.
All numerical values are in radians. There are also functions in the base class for doing this with other angular units.
Implements casa::TwoSidedShape.
virtual String casa::GaussianShape::sizeToString | ( | ) | const [virtual] |
Get the string containing the various size quantities of a component.
Implements casa::TwoSidedShape.
virtual ComponentType::Shape casa::GaussianShape::type | ( | ) | const [virtual] |
get the type of the shape.
This function always returns ComponentType::GAUSSIAN.
Implements casa::TwoSidedShape.
void casa::GaussianShape::updateFT | ( | ) | [private] |
virtual DComplex casa::GaussianShape::visibility | ( | const Vector< Double > & | uvw, |
const Double & | frequency | ||
) | const [virtual] |
Return the Fourier transform of the component at the specified point in the spatial frequency domain.
The point is specified by a 3 element vector (u,v,w) that has units of meters and the frequency of the observation, in Hertz. These two quantities can be used to derive the required spatial frequency (s = uvw*freq/c)
. The w component is not used in these functions.
The reference position for the transform is the direction of the component. As this component is symmetric about this point the transform is always a real value.
Implements casa::TwoSidedShape.
virtual void casa::GaussianShape::visibility | ( | Vector< DComplex > & | scale, |
const Matrix< Double > & | uvw, | ||
const Double & | frequency | ||
) | const [virtual] |
Same as the previous function except that many (u,v,w) points can be sampled at once.
The uvw Matrix must have a first dimension of three, and a second dimension that is the same as the length of the scale Vector. Otherwise and exception is thrown (when compiled in debug mode).
Implements casa::TwoSidedShape.
virtual void casa::GaussianShape::visibility | ( | Matrix< DComplex > & | scale, |
const Matrix< Double > & | uvw, | ||
const Vector< Double > & | frequency | ||
) | const [virtual] |
as above but with many frequencies
Implements casa::TwoSidedShape.
Gaussian2D<Double> casa::GaussianShape::itsFT [private] |
Definition at line 265 of file GaussianShape.h.
Gaussian2D<Double> casa::GaussianShape::itsShape [private] |
Definition at line 263 of file GaussianShape.h.