casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes | Friends
casa::MSMoments< T > Class Template Reference

This class generates moments from a spectral data. More...

#include <MSMoments.h>

Inheritance diagram for casa::MSMoments< T >:
casa::MomentsBase< T >

List of all members.

Public Member Functions

 MSMoments (MeasurementSet &ms, LogIO &os, Bool overwriteOutput, Bool showProgress)
 construct from an MS, the MS will supply the range of the various parameters that can be selected on.
 MSMoments (const MSMoments< T > &other)
 Copy constructor, this will initialize the MS with other's MS.
 ~MSMoments ()
 Destructor.
MSMoments< T > & operator= (const MSMoments< T > &other)
 Assignment operator.
Bool setNewMS (MeasurementSet &ms)
 Change or Set the MS this MSMoments refers to.
Bool setMomentAxis (const Int &momentAxis)
 Set the moment axis (0 relative).
Bool setSmoothMethod (const Vector< Int > &smoothAxes, const Vector< Int > &kernelTypes, const Vector< Quantum< Double > > &kernelWidths)
 This function invokes smoothing of the input MS.
Bool createMoments (PtrBlock< MeasurementSet * > &data, Bool doTemp, const String &outFileName)
 This is the function that does all the computational work.
CoordinateSystem coordinates ()
 Get CoordinateSystem.
IPosition getShape ()
 Get shape.

Private Member Functions

Bool smoothData (PtrHolder< MeasurementSet > &pSmoothedMS, String &smoothName)
 Smooth data.
Bool whatIsTheNoise (T &noise, MeasurementSet &ms)
 Determine noise level.

Private Attributes

MeasurementSetms_p
 Data.
MeasurementSetmsSel_p
 Internal Selected Data.
CoordinateSystem cSys_
 CoordinateSystem.
Int spwId_
 Spectral Window ID.
Int dataDescId_
 Data Description ID.

Friends

class MomentCalcBase< T >
 Note that if I don't put MomentCalcBase as a forward declaration and use instead "friend class MomentCalcBase<T>" The gnu compiler fails with a typedef problem.

Detailed Description

template<class T>
class casa::MSMoments< T >

This class generates moments from a spectral data.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This class computes moments from spectral data.

Synopsis

The primary goal of this class is to help spectral-line astronomers analyze their spectral data by generating moments of a specified axis. MSMoments is defined by analogy with ImageMoments to satisfy a requirement that expects a functionality to generate moments from spectral data in the form of MeasurementSet. Differences between ImageMoments and MSMoments are the following two things: 1)a form of input data and 2)allowed axis type to generate moments. The output file names are constructed by a prefix plus some internally generated suffixes. The prefix is provided from the user (ourFileName) or determined from the input file name.

The input for MSMoments class is spectral data in the form of MeasurementSet in contrast to ImageMoments that takes an image (ImageInterface) as input. As in the ImageMoments, MSMoments only accepts spectral data of type Float and Double. Effectively, it means that MSMoments only accepts MeasurementSet with FLOAT_DATA column, i.e. autocorrelation data.


Caution: Although MeasurementSet is able to store spectral data with different frequency setting, i;e; multiple SPECTRAL_WINDOW_ID, MSMoments does not take care about that; More specifically, MSMoments applies a certain single SPECTRAL_WINDOW_ID for all spectral data that may have different ones; Because of this limitation, input MeasurementSet must be selected at least by DATA_DESCRIPTION_ID using MSSelection or iterating MSIter;

In general, moments can be generated with respect to any moment axes. In fact, ImageMoments allows to generate moments along any axes (spectral axis, direction axes such as RA and DEC, and polarization axis). However, MSMoments only allows to generate moments along spectral axis so far. Implementation of generating moments along other axis is future work.

Smoothing the data and making plots are not implemented so far.

Example

   // Set state function argument values
   
         Vector<Int> moments(2);
         moments(0) = ImageMoments<Float>::AVERAGE;
         moments(1) = ImageMoments<Float>::WEIGHTED_MEAN_COORDINATE;
         Vector<int> methods(2);
         methods(0) = ImageMoments<Float>::WINDOW;
         methods(1) = ImageMoments<Float>::INTERACTIVE;
         Vector<Int> nxy(2);
         nxy(0) = 3;
         nxy(1) = 3;
   
   // Open MS
        
         MeasurementSet inMS(inName);  
   // Construct moment helper object
   
         LogOrigin or("myClass", "myFunction(...)", WHERE);
         LogIO os(or);
         ImageMoments<Float> moment(inMS, os);
   
   // Specify state via control functions
   
         if (!moment.setMoments(moments)) return 1;
   
   // Create the moments
   
         if (!moment.createMoments()) return 1;

In this example, we generate two moments (average intensity and intensity weighted mean coordinate -- usually the velocity field). The moment axis is automatically set to spectral axis. The output file names are constructed by the class from the input file name plus '.moments'.

Motivation

MSMoments is defined to enable to generate moments from single-dish spectral data in the form of MeasurementSet.

To Do

Definition at line 158 of file MSMoments.h.


Constructor & Destructor Documentation

template<class T>
casa::MSMoments< T >::MSMoments ( MeasurementSet ms,
LogIO os,
Bool  overwriteOutput,
Bool  showProgress 
)

construct from an MS, the MS will supply the range of the various parameters that can be selected on.

template<class T>
casa::MSMoments< T >::MSMoments ( const MSMoments< T > &  other)

Copy constructor, this will initialize the MS with other's MS.

template<class T>
casa::MSMoments< T >::~MSMoments ( )

Destructor.


Member Function Documentation

template<class T>
CoordinateSystem casa::MSMoments< T >::coordinates ( ) [virtual]

Get CoordinateSystem.

Reimplemented from casa::MomentsBase< T >.

template<class T>
Bool casa::MSMoments< T >::createMoments ( PtrBlock< MeasurementSet * > &  data,
Bool  doTemp,
const String outFileName 
)

This is the function that does all the computational work.

It should be called after the set functions. A return value of False indicates that additional checking of the combined methods that you have requested has shown that you have not given consistent state to the class. The output PtrBlock will hold a pointer to output MeasurementSet. It is your responsibility to delete the pointers. The doTemp does no effect so far.

If you specify outFileName, it is the root name for the output files. Suffixes will be made up internally to append to this root. If you only ask for one moment, this will be the actual name of the output file. If you don't set this variable, the default state of the class is to set the output name root to the name of the input file.

template<class T>
IPosition casa::MSMoments< T >::getShape ( ) [virtual]

Get shape.

Reimplemented from casa::MomentsBase< T >.

template<class T>
MSMoments<T>& casa::MSMoments< T >::operator= ( const MSMoments< T > &  other)

Assignment operator.

template<class T>
Bool casa::MSMoments< T >::setMomentAxis ( const Int momentAxis) [virtual]

Set the moment axis (0 relative).

This returns False if specified axis is not a spectral axis. If you don't call this function, the default state of the class is to set the moment axis to the spectral axis if it can find one. Otherwise an error will result.

Reimplemented from casa::MomentsBase< T >.

template<class T>
Bool casa::MSMoments< T >::setNewMS ( MeasurementSet ms)

Change or Set the MS this MSMoments refers to.

template<class T>
Bool casa::MSMoments< T >::setSmoothMethod ( const Vector< Int > &  smoothAxes,
const Vector< Int > &  kernelTypes,
const Vector< Quantum< Double > > &  kernelWidths 
) [virtual]

This function invokes smoothing of the input MS.

Not implemented.

Reimplemented from casa::MomentsBase< T >.

template<class T>
Bool casa::MSMoments< T >::smoothData ( PtrHolder< MeasurementSet > &  pSmoothedMS,
String smoothName 
) [private]

Smooth data.

template<class T>
Bool casa::MSMoments< T >::whatIsTheNoise ( T &  noise,
MeasurementSet ms 
) [private]

Determine noise level.

Not implemented.


Friends And Related Function Documentation

template<class T>
friend class MomentCalcBase< T > [friend]

Note that if I don't put MomentCalcBase as a forward declaration and use instead "friend class MomentCalcBase<T>" The gnu compiler fails with a typedef problem.

But I can't solve it with say typedef MomentCalcBase<T> gpp_type; because you can only do a typedef with an actual type, not a T !

Reimplemented from casa::MomentsBase< T >.

Definition at line 162 of file MSMoments.h.


Member Data Documentation

template<class T>
CoordinateSystem casa::MSMoments< T >::cSys_ [private]

CoordinateSystem.

Definition at line 237 of file MSMoments.h.

template<class T>
Int casa::MSMoments< T >::dataDescId_ [private]

Data Description ID.

Definition at line 243 of file MSMoments.h.

template<class T>
MeasurementSet* casa::MSMoments< T >::ms_p [private]

Data.

Definition at line 231 of file MSMoments.h.

template<class T>
MeasurementSet* casa::MSMoments< T >::msSel_p [private]

Internal Selected Data.

Definition at line 234 of file MSMoments.h.

template<class T>
Int casa::MSMoments< T >::spwId_ [private]

Spectral Window ID.

Definition at line 240 of file MSMoments.h.


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