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$ 00027 //# 00028 #ifndef MS_MSSUMMARY_H 00029 #define MS_MSSUMMARY_H 00030 00031 #include <casacore/casa/aips.h> 00032 #include <casacore/casa/BasicSL/String.h> 00033 #include <casacore/casa/Utilities/PtrHolder.h> 00034 #include <casacore/ms/MeasurementSets/MSColumns.h> 00035 #include <memory> 00036 00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00038 00039 class MeasurementSet; 00040 class LogIO; 00041 class MSMetaData; 00042 00043 // <summary>Provides and lists information about the header of an image</summary> 00044 // <use visibility=export> 00045 // 00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00047 // </reviewed> 00048 // 00049 // <prerequisite> 00050 // <li> <linkto class=MeasurementSet>MeasurementSet</linkto> 00051 // <li> <linkto module=Coordinates>Coordinates</linkto> 00052 // </prerequisite> 00053 // 00054 // <etymology> 00055 // This class lists the ancilliary or header information from a 00056 // MeasurementSet in a Summary format. 00057 // </etymology> 00058 // 00059 // <synopsis> 00060 // MSs consist of pixels and descriptive information stored in what 00061 // is loosely termed the header. This is information describing the 00062 // coordinate system, the image units etc. This class enables you to 00063 // retrieve the descriptive header information and/or list it. 00064 // </synopsis> 00065 // 00066 // <example> 00067 // <srcBlock> 00068 // PagedMS<Float> inMS(fileName); 00069 // MSSummary<Float> header(inMS); 00070 // LogOrigin or("myClass", "myFunction(...)", WHERE); 00071 // LogIO os(or); 00072 // header.list(os); 00073 // </srcBlock> 00074 // A <src>PagedMS</src> object is constructed and then logged to the 00075 // supplied <src>LogIO</src> object. 00076 // </example> 00077 // 00078 // <note role=caution> 00079 // Note that if the <src>PagedMS</src> goes out of scope, this 00080 // class will retrieve rubbish as it just maintains a pointer 00081 // to the image. 00082 // </note> 00083 // 00084 // <motivation> 00085 // The viewing of the image header is a basic capability that is 00086 // commonly required. 00087 // </motivation> 00088 // 00089 // <todo asof="1998/12/09"> 00090 // There are various placeholders which will need to be activated for 00091 // Version 2 of the MeasurementSet definition. 00092 // </todo> 00093 00094 00095 class MSSummary 00096 { 00097 public: 00098 // Constructor 00099 // <group> 00100 // <src>maxCacheMB</src> is the maximum cache size in MB to use for the created 00101 // MSMetaData object. 00102 MSSummary (const MeasurementSet& ms, Float maxCacheMB = 50.0); 00103 MSSummary (const MeasurementSet* ms, Float maxCacheMB = 50.0); 00104 MSSummary (const MeasurementSet* ms, const String msname, Float maxCacheMB = 50.0); 00105 00106 // construct the object using an MSMetaDataObject 00107 MSSummary (SHARED_PTR<MSMetaData> msmd); 00108 00109 // Destructor 00110 ~MSSummary(); 00111 00112 // Retrieve number of rows 00113 Int nrow() const; 00114 00115 // Retrieve image name 00116 String name() const; 00117 00118 // Set a new MS. <src>maxCacheMB</src> is the maximum cache size of the 00119 // created MSMetaData tool. If negative, the cache size used when this object 00120 // was created is used. 00121 Bool setMS (const MeasurementSet& ms, Float maxCacheMB=-1); 00122 00123 // List all header information. 00124 void list (LogIO& os, Bool verbose=False, Bool oneBased=True) const; 00125 //Return some useful info in a record too along with os 00126 void list (LogIO& os, Record& outRec, Bool verbose=False, 00127 Bool fillRecord=True, Bool oneBased=True) const; 00128 00129 // List a title for the Summary. 00130 void listTitle (LogIO& os) const; 00131 00132 // List convenient groupings of tables: list where MS obtained 00133 // (Observation and Array tables) 00134 void listWhere (LogIO& os, Bool verbose=False) const; 00135 00136 // List what was observed (Field and Main tables) 00137 void listWhat (LogIO& os, Bool verbose=False) const; 00138 void listWhat (LogIO& os, Record& outRec, Bool verbose=False, 00139 Bool fillRecord=True) const; 00140 // List how data were obtained (SpectralWindow, Feed, and Antenna tables) 00141 void listHow (LogIO& os, Bool verbose=False, Bool oneBased=True) const; 00142 00143 // List main table 00144 void listMain (LogIO& os, Bool verbose=False) const; 00145 //Return some useful info in a record too along with os 00146 void listMain (LogIO& os, Record& outRec, Bool verbose=False, 00147 Bool fillRecord=True) const; 00148 // Return a Record with information derived from the main table 00149 void getScanSummary (Record& outRec) const; 00150 00151 // List subtables 00152 // <group> 00153 void listAntenna (LogIO& os, Bool verbose=False) const; 00154 void listFeed (LogIO& os, Bool verbose=False, Bool oneBased=True) const; 00155 void listField (LogIO& os, Bool verbose=False) const; 00156 void listField (LogIO& os, Record& outRec, Bool verbose=False, 00157 Bool fillRecord=True) const; 00158 void listObservation (LogIO& os, Bool verbose=False) const; 00159 void listHistory (LogIO& os) const; 00160 void listPolarization (LogIO& os, Bool verbose=False) const; 00161 void listSource (LogIO& os, Bool verbose=False) const; 00162 void listSpectralWindow (LogIO& os, Bool verbose=False) const; 00163 void getSpectralWindowInfo(Record& outRec) const; 00164 void listSpectralAndPolInfo (LogIO& os, Bool verbose=False, 00165 Bool oneBased=True) const; 00166 void listSysCal (LogIO& os, Bool verbose=False) const; 00167 void listWeather (LogIO& os, Bool verbose=False) const; 00168 // </group> 00169 00170 // List table size summary 00171 void listTables (LogIO& os, Bool verbose=False) const; 00172 00173 void setListUnflaggedRowCount(Bool v) { _listUnflaggedRowCount = v; } 00174 00175 // OBSOLETE. No longer does anything, kept for compilation backward compatibility. 00176 void setMetaDataCacheSizeInMB(Float) {} 00177 00178 private: 00179 // Pointer to MS 00180 const MeasurementSet* pMS; 00181 SHARED_PTR<MSMetaData> _msmd; 00182 00183 // Formatting strings 00184 const String dashlin1, dashlin2; 00185 00186 // Clear formatting flags 00187 void clearFlags (LogIO& os) const; 00188 00189 // For keeping track of the number of vis per field 00190 mutable Vector<Int> nVisPerField_; 00191 00192 // Name of the MS used in the constructor 00193 String msname_p; 00194 00195 Bool _listUnflaggedRowCount; 00196 00197 Float _cacheSizeMB; 00198 }; 00199 00200 00201 } //# NAMESPACE CASACORE - END 00202 00203 #endif