casa  $Rev:20696$
Statistics.h
Go to the documentation of this file.
00001 #ifndef CASA_STATISTICS_H
00002 #define CASA_STATISTICS_H
00003 
00004 //
00005 // Get statistics on table/ms columns
00006 //
00007 
00008 #include <casa/Containers/Record.h>
00009 #include <casa/Arrays/Matrix.h>
00010 #include <casa/Arrays/Array.h>
00011 #include <casa/aipstype.h>
00012 
00013 namespace casac {
00014 
00015 template <class T>
00016 class Statistics {
00017    public :
00018 
00019    /*
00020      Converts data to Float, computes statistics
00021      
00022      v:           data
00023      flags:       flagged data is not used, shape must be
00024                   compatible with v's shape
00025      column:      column name
00026      supported:   set to true if column type is supported
00027 
00028      return: output dictionary
00029 
00030    */
00031    static casa::Record
00032      get_stats(const casa::Vector<T> v,
00033                const casa::Vector<casa::Bool> flags,
00034                const std::string &column,
00035                bool &supported);
00036 
00037    /*
00038      As above, but all values are considered unflagged
00039     */
00040    static casa::Record
00041      get_stats(const casa::Vector<T> v,
00042                const std::string &column,
00043                bool &supported);
00044 
00045    /*
00046      As get_stats().
00047      
00048      The conversion from complex to Float depends on the parameter
00049      complex_value. Eg complex_value="imag" picks out the imaginary part.
00050    */
00051    static casa::Record
00052      get_stats_complex(const casa::Vector<casa::Complex> v,
00053                        const casa::Vector<casa::Bool> flags,
00054                        const std::string &column,
00055                        bool &supported,
00056                        const std::string complex_value);
00057 
00058    /*
00059      As above, but all values are considered unflagged
00060     */
00061    static casa::Record
00062      get_stats_complex(const casa::Vector<casa::Complex> v,
00063                        const std::string &column,
00064                        bool &supported,
00065                        const std::string complex_value);  
00066 
00067    /*
00068      Converts data to Float, computes statistics
00069      
00070      v:           data
00071      flags:       indicating which data is flagged
00072      column:      column whose values are 1d arrays of length N
00073      supported:   set to true if column type is supported
00074 
00075      return: output dictionary, which will contain
00076              N sets of statistical information, one for each index in the array
00077    */
00078 
00079    static casa::Record
00080      get_stats_array(const casa::Matrix<T> v,
00081                      const casa::Vector<casa::Bool> flags,
00082                      const std::string &column,
00083                      bool &supported);
00084 
00085 
00086      /* 
00087         Compute statistics on table column
00088         table:         table
00089         column:        column name
00090         complex_value: see get_stats_complex()
00091         itsLog:        where to send log messages
00092      */
00093      static casa::Record
00094      get_statistics(const casa::Table &table,
00095                     const std::string &column,
00096                     const std::string &complex_value,
00097                     casa::LogIO *itsLog);
00098 
00099 
00100 
00101 };
00102 
00103 }
00104 
00105 #ifndef AIPS_NO_TEMPLATE_SRC
00106 #include <xmlcasa/ms/Statistics.tcc>
00107 #endif //# AIPS_NO_TEMPLATE_SRC
00108 
00109 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines