casa
$Rev:20696$
|
A shape where emission comes from only one direction. More...
#include <PointShape.h>
Public Member Functions | |
PointShape () | |
The default PointShape is at the J2000 North Pole. | |
PointShape (const MDirection &direction) | |
Construct a point shape at the specified direction. | |
PointShape (const PointShape &other) | |
The copy constructor uses copy semantics. | |
virtual | ~PointShape () |
The destructor does nothing special. | |
PointShape & | operator= (const PointShape &other) |
The assignment operator uses copy semantics. | |
virtual ComponentType::Shape | type () const |
Return the type of shape. | |
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 the specified size centered on 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 |
Same as above except with many frequencies. | |
virtual Bool | isSymmetric () const |
A point shape is symmetric so this function always returns True;. | |
virtual ComponentShape * | clone () const |
Return a pointer to a copy of this object upcast to a ComponentShape object. | |
virtual uInt | nParameters () const |
return the number of parameters in this shape and set/get them. | |
virtual void | setParameters (const Vector< Double > &newParms) |
virtual Vector< Double > | parameters () const |
virtual void | setErrors (const Vector< Double > &newParms) |
virtual Vector< Double > | errors () const |
virtual Vector< Double > | optParameters () const |
virtual void | setOptParameters (const Vector< Double > &newOptParms) |
virtual Bool | fromRecord (String &errorMessage, const RecordInterface &record) |
This functions convert between a Record and a PointShape. | |
virtual Bool | toRecord (String &errorMessage, RecordInterface &record) const |
Convert the class to an Record representation. | |
virtual Bool | convertUnit (String &, const RecordInterface &) |
Convert the parameters of the component to the specified units. | |
virtual Bool | ok () const |
Function which checks the internal data of this class for consistent values. | |
virtual const ComponentShape * | getPtr () const |
return a pointer to this object. | |
virtual String | sizeToString () const |
Private Member Functions | |
Double | dirIsInPixel (Double longSize, Double latSize, Double nearSize, const MDirection::MVType &dirValue, const MDirection::MVType *compDirValue) const |
FInd out if a direction is located within a pixel. |
A shape where emission comes from only one direction.
Public interface
<h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd<dt>Test programs:<dd>tPointShape<dt>Demo programs:<dd>dPointShape</dl>
This class represents the shape of components where the emission comes from only one point in the sky.
This class like the other component shapes becomes more useful when used through the SkyComponent class, which incorporates the flux and spectral variation of the emission, or through the ComponentList class, which handles groups of SkyComponent objects.
For a point shape all the emission comes only from the reference direction which is specified in celestial co-ordinates, using a MDirection object. The direction can be specified both in the constructor or with the setRefDirection
function.
The sample
member functions are used to determine the proportion of flux the component at any point on the sky. For a point component this is either zero or one depending on whether the specified pixel contains the point source or not.
The visibility
functions return the Fourier transform of the component at a specified spatial frequency. For a point shape the Fourier transform is a constant value. Hence these functions return one, regardless of the input parameters.
This class also contains functions (toRecord
& fromRecord
) which perform the conversion between Records and PointShape objects. These functions define how a PointShape object is represented in glish. The format of the record that is generated and accepted by these functions is:
c := [type = 'point', direction = [type = 'direction', refer = 'j2000', m0 = [value = 0, unit = 'deg'] m1 = [value = 0, unit = 'deg'] ] ]
The direction field contains a record representation of a direction measure and its format is defined in the Measures module. Its refer field defines the reference frame for the direction and the m0 and m1 fields define the latitude and longitude in that frame.
Suppose I had an image of a region of the sky and we wanted to subtract a point 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 dPointShape.cc
file. Note that it is more accurate to do subtraction of point components in the (u,v) domain
MDirection J1934_dir; { // get the right direction into J1934_dir Quantity J1934_ra; MVAngle::read(J1934_ra, "19:39:"); Quantity J1934_dec; MVAngle::read(J1934_dec, "-63.43."); J1934_dir = MDirection(J1934_ra, J1934_dec, MDirection::J2000); } { // One way to construct the SkyComponent SkyComponent J1934(ComponentType::POINT, ComponentType::CONSTANT_SPECTRUM); J1934.shape().setRefDirection(J1934_dir); J1934.flux() = Flux<Double>(6.28, 0.1, 0.15, 0.01); printShape(J1934.shape()); } { // An alternative way to construct the SkyComponent const Flux<Double> flux(6.28, 0.1, 0.15, 0.01); const PointShape shape(J1934_dir); const ConstantSpectrum spectrum; SkyComponent component(flux, shape, spectrum); printShape(component.shape()); }
Note how the member functions of the PointShape class (the setDirection function) are accessable through the shape function in the SkyComponent class. The printShape function is the example shown for the ComponentShape class.
Definition at line 152 of file PointShape.h.
The default PointShape is at the J2000 North Pole.
casa::PointShape::PointShape | ( | const MDirection & | direction | ) |
Construct a point shape at the specified direction.
casa::PointShape::PointShape | ( | const PointShape & | other | ) |
The copy constructor uses copy semantics.
virtual casa::PointShape::~PointShape | ( | ) | [virtual] |
The destructor does nothing special.
virtual ComponentShape* casa::PointShape::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::ComponentShape.
virtual Bool casa::PointShape::convertUnit | ( | String & | , |
const RecordInterface & | |||
) | [virtual] |
Convert the parameters of the component to the specified units.
As a point component has no parameters this function does nothing and always returns True.
Implements casa::ComponentShape.
Double casa::PointShape::dirIsInPixel | ( | Double | longSize, |
Double | latSize, | ||
Double | nearSize, | ||
const MDirection::MVType & | dirValue, | ||
const MDirection::MVType * | compDirValue | ||
) | const [private] |
FInd out if a direction is located within a pixel.
virtual Vector<Double> casa::PointShape::errors | ( | ) | const [virtual] |
Implements casa::ComponentShape.
virtual Bool casa::PointShape::fromRecord | ( | String & | errorMessage, |
const RecordInterface & | record | ||
) | [virtual] |
This functions convert between a Record and a PointShape.
These functions define how a point shape is represented in glish and this is detailed in the synopsis above. They return False if the supplied Record is malformed and append an error message to the supplied String giving the reason.
Implements casa::ComponentShape.
virtual const ComponentShape* casa::PointShape::getPtr | ( | ) | const [virtual] |
return a pointer to this object.
Implements casa::ComponentShape.
virtual Bool casa::PointShape::isSymmetric | ( | ) | const [virtual] |
A point shape is symmetric so this function always returns True;.
Implements casa::ComponentShape.
virtual uInt casa::PointShape::nParameters | ( | ) | const [virtual] |
return the number of parameters in this shape and set/get them.
As this is a point shape there are none. So calling setParameters
or setErrors
with anything other than a zero length Vector will throw an exception (when compiled in debug mode). The nParameters
will always return zero and the parameters
and errors
functions will always return zero length Vectors.
Implements casa::ComponentShape.
virtual Bool casa::PointShape::ok | ( | ) | const [virtual] |
Function which checks the internal data of this class for consistent values.
Returns True if everything is fine otherwise returns False.
Reimplemented from casa::ComponentShape.
PointShape& casa::PointShape::operator= | ( | const PointShape & | other | ) |
The assignment operator uses copy semantics.
virtual Vector<Double> casa::PointShape::optParameters | ( | ) | const [virtual] |
Implements casa::ComponentShape.
virtual Vector<Double> casa::PointShape::parameters | ( | ) | const [virtual] |
Implements casa::ComponentShape.
virtual Double casa::PointShape::sample | ( | const MDirection & | direction, |
const MVAngle & | pixelLatSize, | ||
const MVAngle & | pixelLongSize | ||
) | const [virtual] |
Calculate the proportion of the flux that is in a pixel of the specified size centered on the specified direction.
Because this is a point shape the returned value is either zero or one. It is one if the specified direction is less than half a pixelSize away from the reference direction.
Implements casa::ComponentShape.
virtual void casa::PointShape::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. This is a customised version.
Implements casa::ComponentShape.
virtual void casa::PointShape::setErrors | ( | const Vector< Double > & | newParms | ) | [virtual] |
Implements casa::ComponentShape.
virtual void casa::PointShape::setOptParameters | ( | const Vector< Double > & | newOptParms | ) | [virtual] |
Implements casa::ComponentShape.
virtual void casa::PointShape::setParameters | ( | const Vector< Double > & | newParms | ) | [virtual] |
Implements casa::ComponentShape.
virtual String casa::PointShape::sizeToString | ( | ) | const [virtual] |
Implements casa::ComponentShape.
virtual Bool casa::PointShape::toRecord | ( | String & | error, |
RecordInterface & | outRecord | ||
) | const [virtual] |
Convert the class to an Record representation.
The input record may already contain fields and these fields may be silently overridden. New fields may be added to the input Record. If the transformation succeeds then the error String is unchanged and the function returns True. Otherwise the function returns False and appends an error message to the supplied String giving the reason why the conversion failed.
Implements casa::ComponentShape.
virtual ComponentType::Shape casa::PointShape::type | ( | ) | const [virtual] |
Return the type of shape.
This function always returns ComponentType::POINT.
Implements casa::ComponentShape.
virtual DComplex casa::PointShape::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. Hence the returned value is always a constant real value of one. The input arguments are ignored except in debug mode where the length of the uvw Vector and sign of the frequency variable are checked.
Implements casa::ComponentShape.
virtual void casa::PointShape::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.
As with the previous function the returned value is always a constant real vector of one. The input arguments are ignored except in debug mode where the shape of the uvw Matrix and the scale Vector are checked as is the sign of the frequency variable.
Implements casa::ComponentShape.
virtual void casa::PointShape::visibility | ( | Matrix< DComplex > & | scale, |
const Matrix< Double > & | uvw, | ||
const Vector< Double > & | frequency | ||
) | const [virtual] |
Same as above except with many frequencies.
Implements casa::ComponentShape.