PointShape.h

Classes

PointShape -- A shape where emission comes from only one direction (full description)

class PointShape: public ComponentShape

Interface

Public Members
PointShape()
PointShape(const MDirection& direction)
PointShape(const PointShape& other)
virtual ~PointShape()
PointShape& operator=(const PointShape& other)
virtual ComponentType::Shape type() const
virtual Double sample(const MDirection& direction, const MVAngle& pixelLatSize, const MVAngle& pixelLongSize) const
virtual void sample(Vector<Double>& scale, const Vector<MDirection::MVType>& directions, const MDirection::Ref& refFrame, const Ref& pixelLatSize, const Ref& pixelLongSize) const
virtual DComplex visibility(const Vector<Double>& uvw, const Double& frequency) const
virtual void visibility(Vector<DComplex>& scale, const Matrix<Double>& uvw, const Double& frequency) const
virtual Bool isSymmetric() const
virtual ComponentShape* clone() const
virtual uInt nParameters() const
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 Bool fromRecord(String& errorMessage, const RecordInterface& record)
virtual Bool toRecord(String& errorMessage, RecordInterface& record) const
virtual Bool convertUnit(String&, const RecordInterface&)
virtual Bool ok() const
See Also
DiskShape - a uniform brightness disk shape.
GaussianShape - a Gaussian variation in the sky brightness

Description

Review Status

Date Reviewed:
yyyy/mm/dd
Programs:
Demos:
Tests:

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
  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.

To Do

Member Description

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. This function always returns ComponentType::POINT.

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. 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.

virtual void sample(Vector<Double>& scale, const Vector<MDirection::MVType>& directions, const MDirection::Ref& refFrame, const Ref& pixelLatSize, const Ref& pixelLongSize) const

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.

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. 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.

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. 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.

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. The class that uses this function is responsible for deleting the pointer. This is used to implement a virtual copy constructor.

virtual uInt nParameters() const
virtual void setParameters(const Vector<Double>& newParms)
virtual Vector<Double> parameters() const
virtual void setErrors(const Vector<Double>& newParms)
virtual Vector<Double> errors() const

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.

virtual Bool fromRecord(String& errorMessage, const RecordInterface& record)
virtual Bool toRecord(String& errorMessage, RecordInterface& record) const

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.

virtual Bool convertUnit(String&, const RecordInterface&)

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.

virtual Bool ok() const

Function which checks the internal data of this class for consistent values. Returns True if everything is fine otherwise returns False.