casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSSummary.h
Go to the documentation of this file.
00001 //# MSSummary.h: Helper class for applications listing an image header
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: MSSummary.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $
00027 //#
00028 #ifndef MS_MSSUMMARY_H
00029 #define MS_MSSUMMARY_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/BasicSL/String.h>
00033 #include <ms/MeasurementSets/MSColumns.h>
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 class MeasurementSet;
00037 class LogIO;
00038 class MSMetaData;
00039 
00040 // <summary>Provides and lists information about the header of an image</summary>
00041 // <use visibility=export>
00042 // 
00043 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00044 // </reviewed>
00045 // 
00046 // <prerequisite>
00047 //   <li> <linkto class=MeasurementSet>MeasurementSet</linkto>
00048 //   <li> <linkto module=Coordinates>Coordinates</linkto> 
00049 // </prerequisite>
00050 //
00051 // <etymology>
00052 // This class lists the ancilliary or header information from a
00053 // MeasurementSet in a Summary format.
00054 // </etymology>
00055 //
00056 // <synopsis>
00057 // MSs consist of pixels and descriptive information stored in what
00058 // is loosely termed the header. This is information describing the
00059 // coordinate system, the image units etc.  This class enables you to
00060 // retrieve the descriptive header information and/or list it.
00061 // </synopsis>
00062 //
00063 // <example>
00064 // <srcBlock>
00065 //     PagedMS<Float> inMS(fileName);
00066 //     MSSummary<Float> header(inMS);
00067 //     LogOrigin or("myClass", "myFunction(...)", WHERE);
00068 //     LogIO os(or);
00069 //     header.list(os);
00070 // </srcBlock>
00071 // A <src>PagedMS</src> object is constructed and then logged to the 
00072 // supplied <src>LogIO</src> object.
00073 // </example>
00074 //
00075 // <note role=caution>
00076 // Note that if the <src>PagedMS</src> goes out of scope, this
00077 // class will retrieve rubbish as it just maintains a pointer
00078 // to the image.
00079 // </note>
00080 //
00081 // <motivation>
00082 // The viewing of the image header is a basic capability that is
00083 // commonly required.
00084 // </motivation>
00085 //
00086 // <todo asof="1998/12/09">
00087 //  There are various placeholders which will need to be activated for
00088 //  Version 2 of the MeasurementSet definition.
00089 // </todo>
00090  
00091 
00092 class MSSummary
00093 {
00094 public:
00095 // Constructor
00096    MSSummary (const MeasurementSet&);
00097    MSSummary (const MeasurementSet*);
00098    MSSummary (const MeasurementSet* ms, const String msname);
00099 
00100 // Destructor
00101   ~MSSummary();
00102 
00103 // Retrieve number of rows
00104    Int nrow() const;
00105  
00106 // Retrieve image name
00107    String name() const;
00108 
00109 // Set a new MS
00110    Bool setMS (const MeasurementSet& ms);
00111 
00112 // List all header information.
00113    void list (LogIO& os, Bool verbose=False) const;
00114 //Return some useful info in a record too along with os
00115    void list (LogIO& os, Record& outRec,  Bool verbose=False, Bool fillRecord=True) const;
00116 
00117 // List a title for the Summary.
00118    void listTitle (LogIO& os) const;
00119 
00120 // List convenient groupings of tables: list where MS obtained
00121 // (Observation and Array tables)
00122    void listWhere (LogIO& os, Bool verbose=False) const;
00123 
00124 // List what was observed (Field and Main tables)
00125    void listWhat (LogIO& os, Bool verbose=False) const;
00126    void listWhat (LogIO& os, Record& outRec,  Bool verbose=False, Bool fillRecord=True) const;
00127 // List how data were obtained (SpectralWindow, Feed, and Antenna tables)
00128    void listHow (LogIO& os, Bool verbose=False) const;
00129 
00130 // List main table
00131    void listMain (LogIO& os, Bool verbose=False) const;
00132 //Return some useful info in a record too along with os
00133    void listMain (LogIO& os, Record& outRec, Bool verbose=False, Bool fillRecord=True) const;
00134    // Return a Record with information derived from the main table
00135    void getScanSummary (Record& outRec) const;
00136 
00137 // List subtables
00138 // <group>
00139    void listAntenna (LogIO& os, Bool verbose=False) const;
00140    void listFeed (LogIO& os, Bool verbose=False) const;
00141    void listField (LogIO& os, Bool verbose=False) const;
00142    void listField (LogIO& os, Record& outRec, Bool verbose=False,
00143                    Bool fillRecord=True) const;
00144    void listObservation (LogIO& os, Bool verbose=False) const;
00145    void listHistory (LogIO& os) const;
00146    void listPolarization (LogIO& os, Bool verbose=False) const;
00147    void listSource (LogIO& os, Bool verbose=False) const;
00148    void listSpectralWindow (LogIO& os, Bool verbose=False) const;
00149    void getSpectralWindowInfo(Record& outRec) const;
00150    void listSpectralAndPolInfo (LogIO& os, Bool verbose=False) const;
00151    void listSysCal (LogIO& os, Bool verbose=False) const;
00152    void listWeather (LogIO& os, Bool verbose=False) const;
00153 // </group>
00154 
00155 // List table size summary
00156    void listTables (LogIO& os, Bool verbose=False) const;
00157 
00158    void setListUnflaggedRowCount(Bool v) { _listUnflaggedRowCount = v; }
00159 
00160    // set the cache size, in MB, for the MSMetaData object.
00161    void setMetaDataCacheSizeInMB(Float cacheSize) { _cacheSizeMB = cacheSize; }
00162 private:
00163 // Pointer to MS
00164    const MeasurementSet* pMS;
00165    std::auto_ptr<MSMetaData> _msmd;
00166 
00167 // Formatting strings
00168    const String dashlin1, dashlin2;
00169 
00170 // Clear formatting flags
00171    void clearFlags (LogIO& os) const;
00172 
00173 // For keeping track of the number of vis per field
00174    mutable Vector<Int> nVisPerField_;
00175 
00176    // Name of the MS used in the constructor
00177    String msname_p;
00178 
00179    Bool _listUnflaggedRowCount;
00180 
00181    Float _cacheSizeMB;
00182 
00183 
00184 };
00185 
00186 
00187 } //# NAMESPACE CASA - END
00188 
00189 #endif