casa
5.7.0-16
|
Base class for component shapes with two sides. More...
#include <TwoSidedShape.h>
Public Member Functions | |
virtual | ~TwoSidedShape () |
a virtual destructor is needed so that the actual destructor in the derived class will be used. More... | |
virtual ComponentType::Shape | type () const =0 |
return the actual component type. More... | |
void | setWidth (const casacore::Quantum< casacore::Double > &majorAxis, const casacore::Quantum< casacore::Double > &minorAxis, const casacore::Quantum< casacore::Double > &positionAngle) |
set/get the width and orientation of the Shape. More... | |
void | setWidth (const casacore::Quantum< casacore::Double > &majorAxis, const casacore::Double axialRatio, const casacore::Quantum< casacore::Double > &positionAngle) |
casacore::Quantum < casacore::Double > | majorAxis () const |
casacore::Quantum < casacore::Double > | minorAxis () const |
casacore::Quantum < casacore::Double > | positionAngle () const |
casacore::Double | axialRatio () const |
void | setErrors (const casacore::Quantum< casacore::Double > &majorAxisError, const casacore::Quantum< casacore::Double > &minorAxisError, const casacore::Quantum< casacore::Double > &positionAngleError) |
set/get the errors on the shape parameters. More... | |
const casacore::Quantum < casacore::Double > & | majorAxisError () const |
const casacore::Quantum < casacore::Double > & | minorAxisError () const |
const casacore::Quantum < casacore::Double > & | positionAngleError () const |
casacore::Double | axialRatioError () const |
virtual void | setWidthInRad (const casacore::Double majorAxis, const casacore::Double minorAxis, const casacore::Double positionAngle)=0 |
set/get the width and orientation of the Shape. More... | |
virtual casacore::Double | majorAxisInRad () const =0 |
virtual casacore::Double | minorAxisInRad () const =0 |
virtual casacore::Double | positionAngleInRad () const =0 |
virtual casacore::Double | sample (const casacore::MDirection &direction, const casacore::MVAngle &pixelLatSize, const casacore::MVAngle &pixelLongSize) const =0 |
Calculate the proportion of the flux that is in a pixel of specified size centered in the specified direction. More... | |
virtual void | sample (casacore::Vector< casacore::Double > &scale, const casacore::Vector< casacore::MDirection::MVType > &directions, const casacore::MDirection::Ref &refFrame, const casacore::MVAngle &pixelLatSize, const casacore::MVAngle &pixelLongSize) const =0 |
Same as the previous function except that many directions can be sampled at once. More... | |
virtual casacore::DComplex | visibility (const casacore::Vector< casacore::Double > &uvw, const casacore::Double &frequency) const =0 |
Return the Fourier transform of the component at the specified point in the spatial frequency domain. More... | |
virtual void | visibility (casacore::Vector< casacore::DComplex > &scale, const casacore::Matrix< casacore::Double > &uvw, const casacore::Double &frequency) const =0 |
Same as the previous function except that many (u,v,w) points can be sampled at once. More... | |
virtual void | visibility (casacore::Matrix< casacore::DComplex > &scale, const casacore::Matrix< casacore::Double > &uvw, const casacore::Vector< casacore::Double > &frequency) const =0 |
same as above but with many frequencies More... | |
virtual casacore::Bool | isSymmetric () const |
determine whether the shape is symmetric or not. More... | |
virtual ComponentShape * | clone () const =0 |
Return a pointer to a copy of this object upcast to a ComponentShape object. More... | |
virtual casacore::uInt | nParameters () const |
set/get the shape parameters associated with this shape. More... | |
virtual void | setParameters (const casacore::Vector< casacore::Double > &newParms) |
virtual casacore::Vector < casacore::Double > | parameters () const |
virtual void | setErrors (const casacore::Vector< casacore::Double > &newParms) |
virtual casacore::Vector < casacore::Double > | errors () const |
virtual casacore::Vector < casacore::Double > | optParameters () const |
virtual void | setOptParameters (const casacore::Vector< casacore::Double > &newOptParms) |
virtual casacore::Bool | fromRecord (casacore::String &errorMessage, const casacore::RecordInterface &record) |
This functions convert between a casacore::Record and a shape derived from this class. More... | |
virtual casacore::Bool | toRecord (casacore::String &errorMessage, casacore::RecordInterface &record) const |
Convert the class to an Record representation. More... | |
virtual casacore::Bool | convertUnit (casacore::String &errorMessage, const casacore::RecordInterface &record) |
Convert the parameters of the component to the specified units. More... | |
virtual casacore::Bool | ok () const |
casacore::Function which checks the internal data of this class for correct dimensionality and consistent values. More... | |
virtual casacore::Vector < casacore::Double > | toPixel (const casacore::DirectionCoordinate &dirCoord) const |
Convert component shape to absolute pixels (longitude, latitude, major axis, minor axis, position angle [positive +x -> +y ; rad]) More... | |
virtual casacore::Bool | fromPixel (const casacore::Vector< casacore::Double > ¶meters, const casacore::DirectionCoordinate &dirCoord) |
Fill the shape from the vector (longitude, latitude, major axis, minor axis, position angle [positive +x -> +y ; rad]). More... | |
virtual casacore::String | sizeToString () const =0 |
Get the string containing the various size quantities of a component. More... | |
Public Member Functions inherited from casa::ComponentShape | |
virtual | ~ComponentShape () |
virtual const casacore::String & | ident () const |
Specify the identification of the record (e.g. More... | |
void | setRefDirection (const casacore::MDirection &newRefDir) |
const casacore::MDirection & | refDirection () const |
void | setRefDirectionError (const casacore::Quantum< casacore::Double > &newRefDirErrLat, const casacore::Quantum< casacore::Double > &newRefDirErrLong) |
const casacore::Quantum < casacore::Double > & | refDirectionErrorLat () const |
const casacore::Quantum < casacore::Double > & | refDirectionErrorLong () const |
void | copyDirectionInfo (const ComponentShape &that) |
virtual const ComponentShape * | getPtr () const =0 |
Public Member Functions inherited from casacore::RecordTransformable | |
virtual | ~RecordTransformable () |
The destructor must be virtual so that the destructor of derived classes is actually used. More... | |
virtual Bool | fromString (String &error, const String &inString) |
Initialise the class from a String representation. More... | |
Static Public Member Functions | |
static casacore::String | sizeToString (casacore::Quantity major, casacore::Quantity minor, casacore::Quantity posangle, casacore::Bool includeUncertainties=true, casacore::Quantity majorErr=0, casacore::Quantity minorErr=0, casacore::Quantity posanErr=0) |
casacore::Format the string containing the various size quantities of a component. More... | |
Static Public Member Functions inherited from casa::ComponentShape | |
static ComponentType::Shape | getType (casacore::String &errorMessage, const casacore::RecordInterface &record) |
Protected Member Functions | |
TwoSidedShape () | |
The constructors and assignment operator are protected as only derived classes should use them. More... | |
TwoSidedShape (const casacore::MDirection &direction, const casacore::Unit &majorAxisUnit, const casacore::Unit &minorAxisUnit, const casacore::Unit &paUnit) | |
TwoSidedShape (const TwoSidedShape &other) | |
TwoSidedShape & | operator= (const TwoSidedShape &other) |
Protected Member Functions inherited from casa::ComponentShape | |
ComponentShape () | |
ComponentShape (const casacore::MDirection &direction) | |
ComponentShape (const ComponentShape &other) | |
ComponentShape & | operator= (const ComponentShape &other) |
Private Member Functions | |
casacore::Vector < casacore::Double > | widthToCartesian (const casacore::Quantum< casacore::Double > &width, const casacore::Quantum< casacore::Double > &pa, const casacore::MDirection &dirRef, const casacore::DirectionCoordinate &dirCoord, const casacore::Vector< casacore::Double > &pixelCen) const |
casacore::MDirection | directionFromCartesian (casacore::Double width, casacore::Double pa, const casacore::DirectionCoordinate &dirCoord, const casacore::Vector< casacore::Double > &pixelCen) const |
Additional Inherited Members | |
Static Protected Member Functions inherited from casa::ComponentShape | |
static casacore::Bool | differentRefs (const casacore::MeasRef< casacore::MDirection > &ref1, const casacore::MeasRef< casacore::MDirection > &ref2) |
static casacore::Bool | badError (const casacore::Quantum< casacore::Double > &quantum) |
static casacore::Bool | fromAngQRecord (casacore::Quantum< casacore::Double > &returnValue, casacore::String &errorMessage, const casacore::String &fieldString, const casacore::RecordInterface &record) |
Base class for component shapes with two sides.
Public interface
This base class adds a common interface for component shapes that have two sides. These shapes can be parameterised as having a major-axis width, minor-axis width and a position angle (as well as the reference direction). Currently there are two shapes which use this parameterisation, the Gaussian shape and the disk shape. Shapes which do not have this parameterisation, such as the point shape, are derived directly from the ComponentShape class.
Functions in this class implement a more convenient way of setting the parameters associated with two-sided shapes than the very flexible, but clumsy, parameters
functions. The width parameters can be set using the setWidth
functions. These functions enforce the rule that the major-axis width must not be smaller than the minor-axis width. Hence the axial ratio, which is the minor-axis width divided by the major-axis width, must always be greater than zero and less than or equal to one.
The functions in this class also free derived classes from the having to deal with units. Any angular unit can be used to specify the width of the shape. The widths returned by the majoraxis, minoraxis & the positionAngle functions are in the same units as they where specified in, unless the convertUnit function has been used to specify another unit.
For maximum speed the *InRad
functions are provided. These functions bypass all the computation involving units.
The toRecord and fromRecord functions in this class standardise the record representation of classes derived from this one. In addition to the type and direction fields all records, discussed in the ComponentShape class, there are three more mandatory fields called; majoraxis, minoraxis & positionangle. These fields are record representation of casacore::Quantum<casacore::Double> objects and hence contain a value and unit. eg., A typical record for any of the shapes derived from this class might be:
Because this is an abstract base class, an actual instance of this class cannot be constructed. However the interface it defines can be used inside a function. This allows functions which have TwoSidedShapes as arguments to work for any derived class. Hence the printShape function shown below will work for GaussianShapes and DiskShapes but not for PointShapes.
In this example the printShape function prints out the type of model it is working with, the reference direction of that model, the major-axis width, minor-axis width and the position angle. This example is also available in the dTwoSidedShape.cc
file.
This base class was created to allow the reuse of a number of common functions by all derived classes.
Definition at line 156 of file TwoSidedShape.h.
|
virtual |
a virtual destructor is needed so that the actual destructor in the derived class will be used.
|
protected |
The constructors and assignment operator are protected as only derived classes should use them.
|
protected |
|
protected |
casacore::Double casa::TwoSidedShape::axialRatio | ( | ) | const |
casacore::Double casa::TwoSidedShape::axialRatioError | ( | ) | const |
|
pure 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.
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
virtual |
Convert the parameters of the component to the specified units.
The supplied record must have three fields, namely 'majoraxis', 'minoraxis' & 'positionangle'. These fields must contains strings that are angular units and this function will convert the corresponding parameters to the specified units. This will have no effect on the shape of this class but will affect the format of the record returned by the toRecord function, and the units used in the the Quanta returned by the majoraxis, minoraxis & positionangle functions.
Implements casa::ComponentShape.
|
private |
|
virtual |
Implements casa::ComponentShape.
|
virtual |
Fill the shape from the vector (longitude, latitude, major axis, minor axis, position angle [positive +x -> +y ; rad]).
The return is true if the input major axis (in pixels) became the minor axis (in world coordinates), else false.
Reimplemented from casa::ComponentShape.
|
virtual |
This functions convert between a casacore::Record and a shape derived from this class.
These functions define how the object is represented in glish and this is detailed in the synopsis above. They return false if the record is malformed and append an error message to the supplied string giving the reason.
Implements casa::ComponentShape.
|
virtual |
determine whether the shape is symmetric or not.
Always returns true.
Implements casa::ComponentShape.
casacore::Quantum<casacore::Double> casa::TwoSidedShape::majorAxis | ( | ) | const |
const casacore::Quantum<casacore::Double>& casa::TwoSidedShape::majorAxisError | ( | ) | const |
|
pure virtual |
Implemented in casa::GaussianShape, casa::DiskShape, and casa::LimbDarkenedDiskShape.
casacore::Quantum<casacore::Double> casa::TwoSidedShape::minorAxis | ( | ) | const |
const casacore::Quantum<casacore::Double>& casa::TwoSidedShape::minorAxisError | ( | ) | const |
|
pure virtual |
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
virtual |
set/get the shape parameters associated with this shape.
There are always three these being in order: the major-axis, the minor-axis and the position angle. All these angular quantities are specified and returned in radians. The casacore::Vector supplied to the setParameters
and setErrors
functions must have three elements and the Vector returned by the parameters
and errors
functions will have three elements. The errors are nominally 1-sigma in an implicit Gaussian distribution.
Implements casa::ComponentShape.
|
virtual |
casacore::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::ComponentShape.
Reimplemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
protected |
|
virtual |
Implements casa::ComponentShape.
Reimplemented in casa::LimbDarkenedDiskShape.
|
virtual |
Implements casa::ComponentShape.
casacore::Quantum<casacore::Double> casa::TwoSidedShape::positionAngle | ( | ) | const |
const casacore::Quantum<casacore::Double>& casa::TwoSidedShape::positionAngleError | ( | ) | const |
|
pure virtual |
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
pure 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::ComponentShape.
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
pure 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. A default implementation of this function is available that uses the single pixel sample function described above. However customised versions of this function will be more efficient as intermediate values only need to be computed once.
Implements casa::ComponentShape.
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
void casa::TwoSidedShape::setErrors | ( | const casacore::Quantum< casacore::Double > & | majorAxisError, |
const casacore::Quantum< casacore::Double > & | minorAxisError, | ||
const casacore::Quantum< casacore::Double > & | positionAngleError | ||
) |
set/get the errors on the shape parameters.
|
virtual |
Implements casa::ComponentShape.
|
virtual |
Implements casa::ComponentShape.
Reimplemented in casa::LimbDarkenedDiskShape.
|
virtual |
Implements casa::ComponentShape.
void casa::TwoSidedShape::setWidth | ( | const casacore::Quantum< casacore::Double > & | majorAxis, |
const casacore::Quantum< casacore::Double > & | minorAxis, | ||
const casacore::Quantum< casacore::Double > & | positionAngle | ||
) |
set/get the width and orientation of the Shape.
The width of the major must be larger than the width of the minor axes. The position angle is measured North through East ie a position angle of zero degrees means that the major axis is North-South and a position angle of 10 degrees moves the Northern edge to the East. The axial ratio is the ratio of the minor to major axes widths. Hence it is always between zero and one.
void casa::TwoSidedShape::setWidth | ( | const casacore::Quantum< casacore::Double > & | majorAxis, |
const casacore::Double | axialRatio, | ||
const casacore::Quantum< casacore::Double > & | positionAngle | ||
) |
|
pure virtual |
set/get the width and orientation of the Shape.
These are the same as the above functions except that all widths are in radians.
Implemented in casa::GaussianShape, casa::DiskShape, and casa::LimbDarkenedDiskShape.
|
pure virtual |
Get the string containing the various size quantities of a component.
Implements casa::ComponentShape.
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
static |
casacore::Format the string containing the various size quantities of a component.
|
virtual |
Convert component shape to absolute pixels (longitude, latitude, major axis, minor axis, position angle [positive +x -> +y ; rad])
Reimplemented from casa::ComponentShape.
|
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.
|
pure virtual |
return the actual component type.
Implements casa::ComponentShape.
Implemented in casa::GaussianShape, casa::DiskShape, and casa::LimbDarkenedDiskShape.
|
pure 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 scale factor returned by this function can be used to scale the flux at the origin of the Fourier plane in order to determine the visibility at the specified point.
The "origin" of the transform is the reference direction of the component. This means for symmetric components, where the reference direction is at the centre, that the Fourier transform will always be real.
Implements casa::ComponentShape.
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
pure virtual |
Same as the previous function except that many (u,v,w) points can be sampled at once.
The observation frequency is the same for all the specified points. The uvw casacore::Matrix must have first dimension of three and the second dimension must match the length of the scale vector. A default implementation of this function is available that uses the single point visibility function described above. However customised versions of this function may be more efficient as intermediate values only need to be computed once.
Implements casa::ComponentShape.
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
pure virtual |
same as above but with many frequencies
Implements casa::ComponentShape.
Implemented in casa::DiskShape, casa::GaussianShape, and casa::LimbDarkenedDiskShape.
|
private |
|
private |
Definition at line 355 of file TwoSidedShape.h.
|
private |
Definition at line 352 of file TwoSidedShape.h.
|
private |
Definition at line 356 of file TwoSidedShape.h.
|
private |
Definition at line 353 of file TwoSidedShape.h.
|
private |
Definition at line 357 of file TwoSidedShape.h.
|
private |
Definition at line 354 of file TwoSidedShape.h.