casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | List of all members
casa::PointShape Class Reference

A shape where emission comes from only one direction. More...

#include <PointShape.h>

Inheritance diagram for casa::PointShape:
casa::ComponentShape casacore::RecordTransformable

Public Member Functions

 PointShape ()
 The default PointShape is at the J2000 North Pole. More...
 
 PointShape (const casacore::MDirection &direction)
 Construct a point shape at the specified direction. More...
 
 PointShape (const PointShape &other)
 The copy constructor uses copy semantics. More...
 
virtual ~PointShape ()
 The destructor does nothing special. More...
 
PointShapeoperator= (const PointShape &other)
 The assignment operator uses copy semantics. More...
 
virtual ComponentType::Shape type () const
 Return the type of shape. More...
 
virtual casacore::Double sample (const casacore::MDirection &direction, const casacore::MVAngle &pixelLatSize, const casacore::MVAngle &pixelLongSize) const
 Calculate the proportion of the flux that is in a pixel of the specified size centered on 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
 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
 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
 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
 Same as above except with many frequencies. More...
 
virtual casacore::Bool isSymmetric () const
 A point shape is symmetric so this function always returns true;. More...
 
virtual ComponentShapeclone () const
 Return a pointer to a copy of this object upcast to a ComponentShape object. More...
 
virtual casacore::uInt nParameters () const
 return the number of parameters in this shape and set/get them. 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 PointShape. 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 &, const casacore::RecordInterface &)
 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 consistent values. More...
 
virtual const ComponentShapegetPtr () const
 return a pointer to this object. More...
 
virtual casacore::String sizeToString () const
 
- Public Member Functions inherited from casa::ComponentShape
virtual ~ComponentShape ()
 
virtual const casacore::Stringident () const
 Specify the identification of the record (e.g. More...
 
void setRefDirection (const casacore::MDirection &newRefDir)
 
const casacore::MDirectionrefDirection () 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 casacore::Vector
< casacore::Double
toPixel (const casacore::DirectionCoordinate &dirCoord) const
 
virtual casacore::Bool fromPixel (const casacore::Vector< casacore::Double > &parameters, const casacore::DirectionCoordinate &dirCoord)
 
- 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...
 

Private Member Functions

casacore::Double dirIsInPixel (casacore::Double longSize, casacore::Double latSize, casacore::Double nearSize, const casacore::MDirection::MVType &dirValue, const casacore::MDirection::MVType *compDirValue) const
 FInd out if a direction is located within a pixel. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from casa::ComponentShape
static ComponentType::Shape getType (casacore::String &errorMessage, const casacore::RecordInterface &record)
 
- Protected Member Functions inherited from casa::ComponentShape
 ComponentShape ()
 
 ComponentShape (const casacore::MDirection &direction)
 
 ComponentShape (const ComponentShape &other)
 
ComponentShapeoperator= (const ComponentShape &other)
 
- 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)
 

Detailed Description

A shape where emission comes from only one direction.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd
Test programs:
tPointShape
Demo programs:
dPointShape

Prerequisite

Synopsis

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.

Example

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

{ // get the right direction into J1934_dir
casacore::Quantity J1934_ra; casacore::MVAngle::read(J1934_ra, "19:39:");
casacore::Quantity J1934_dec; casacore::MVAngle::read(J1934_dec, "-63.43.");
J1934_dir = casacore::MDirection(J1934_ra, J1934_dec, casacore::MDirection::J2000);
}
{ // One way to construct the SkyComponent
J1934.shape().setRefDirection(J1934_dir);
J1934.flux() = Flux<casacore::Double>(6.28, 0.1, 0.15, 0.01);
printShape(J1934.shape());
}
{ // An alternative way to construct the SkyComponent
const Flux<casacore::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.

To Do

Definition at line 156 of file PointShape.h.

Constructor & Destructor Documentation

casa::PointShape::PointShape ( )

The default PointShape is at the J2000 North Pole.

casa::PointShape::PointShape ( const casacore::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.

Member Function Documentation

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 casacore::Bool casa::PointShape::convertUnit ( casacore::String ,
const casacore::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.

casacore::Double casa::PointShape::dirIsInPixel ( casacore::Double  longSize,
casacore::Double  latSize,
casacore::Double  nearSize,
const casacore::MDirection::MVType dirValue,
const casacore::MDirection::MVType compDirValue 
) const
private

FInd out if a direction is located within a pixel.

virtual casacore::Vector<casacore::Double> casa::PointShape::errors ( ) const
virtual

Implements casa::ComponentShape.

virtual casacore::Bool casa::PointShape::fromRecord ( casacore::String errorMessage,
const casacore::RecordInterface record 
)
virtual

This functions convert between a casacore::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 casacore::Record is malformed and append an error message to the supplied casacore::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 casacore::Bool casa::PointShape::isSymmetric ( ) const
virtual

A point shape is symmetric so this function always returns true;.

Implements casa::ComponentShape.

virtual casacore::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 casacore::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 casacore::Bool casa::PointShape::ok ( ) const
virtual

casacore::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 casacore::Vector<casacore::Double> casa::PointShape::optParameters ( ) const
virtual

Implements casa::ComponentShape.

virtual casacore::Vector<casacore::Double> casa::PointShape::parameters ( ) const
virtual

Implements casa::ComponentShape.

virtual casacore::Double casa::PointShape::sample ( const casacore::MDirection direction,
const casacore::MVAngle pixelLatSize,
const casacore::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 ( 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
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 casacore::Vector< casacore::Double > &  newParms)
virtual

Implements casa::ComponentShape.

virtual void casa::PointShape::setOptParameters ( const casacore::Vector< casacore::Double > &  newOptParms)
virtual

Implements casa::ComponentShape.

virtual void casa::PointShape::setParameters ( const casacore::Vector< casacore::Double > &  newParms)
virtual

Implements casa::ComponentShape.

virtual casacore::String casa::PointShape::sizeToString ( ) const
virtual

Implements casa::ComponentShape.

virtual casacore::Bool casa::PointShape::toRecord ( casacore::String error,
casacore::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 casacore::DComplex casa::PointShape::visibility ( const casacore::Vector< casacore::Double > &  uvw,
const casacore::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 casacore::Vector and sign of the frequency variable are checked.

Implements casa::ComponentShape.

virtual void casa::PointShape::visibility ( casacore::Vector< casacore::DComplex > &  scale,
const casacore::Matrix< casacore::Double > &  uvw,
const casacore::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 casacore::Matrix and the scale casacore::Vector are checked as is the sign of the frequency variable.

Implements casa::ComponentShape.

virtual void casa::PointShape::visibility ( casacore::Matrix< casacore::DComplex > &  scale,
const casacore::Matrix< casacore::Double > &  uvw,
const casacore::Vector< casacore::Double > &  frequency 
) const
virtual

Same as above except with many frequencies.

Implements casa::ComponentShape.


The documentation for this class was generated from the following file: