casacore
MSSummary.h
Go to the documentation of this file.
1 //# MSSummary.h: Helper class for applications listing an image header
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 //#
28 #ifndef MS_MSSUMMARY_H
29 #define MS_MSSUMMARY_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/casa/BasicSL/String.h>
33 #include <casacore/casa/Utilities/PtrHolder.h>
34 #include <casacore/ms/MeasurementSets/MSColumns.h>
35 #include <memory>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 class MeasurementSet;
40 class LogIO;
41 class MSMetaData;
42 
43 // <summary>Provides and lists information about the header of an image</summary>
44 // <use visibility=export>
45 //
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 //
49 // <prerequisite>
50 // <li> <linkto class=MeasurementSet>MeasurementSet</linkto>
51 // <li> <linkto module=Coordinates>Coordinates</linkto>
52 // </prerequisite>
53 //
54 // <etymology>
55 // This class lists the ancilliary or header information from a
56 // MeasurementSet in a Summary format.
57 // </etymology>
58 //
59 // <synopsis>
60 // MSs consist of pixels and descriptive information stored in what
61 // is loosely termed the header. This is information describing the
62 // coordinate system, the image units etc. This class enables you to
63 // retrieve the descriptive header information and/or list it.
64 // </synopsis>
65 //
66 // <example>
67 // <srcBlock>
68 // PagedMS<Float> inMS(fileName);
69 // MSSummary<Float> header(inMS);
70 // LogOrigin or("myClass", "myFunction(...)", WHERE);
71 // LogIO os(or);
72 // header.list(os);
73 // </srcBlock>
74 // A <src>PagedMS</src> object is constructed and then logged to the
75 // supplied <src>LogIO</src> object.
76 // </example>
77 //
78 // <note role=caution>
79 // Note that if the <src>PagedMS</src> goes out of scope, this
80 // class will retrieve rubbish as it just maintains a pointer
81 // to the image.
82 // </note>
83 //
84 // <motivation>
85 // The viewing of the image header is a basic capability that is
86 // commonly required.
87 // </motivation>
88 //
89 // <todo asof="1998/12/09">
90 // There are various placeholders which will need to be activated for
91 // Version 2 of the MeasurementSet definition.
92 // </todo>
93 
94 
95 class MSSummary
96 {
97 public:
98 // Constructor
99 // <group>
100 // <src>maxCacheMB</src> is the maximum cache size in MB to use for the created
101 // MSMetaData object.
102  MSSummary (const MeasurementSet& ms, Float maxCacheMB = 50.0);
103  MSSummary (const MeasurementSet* ms, Float maxCacheMB = 50.0);
104  MSSummary (const MeasurementSet* ms, const String msname, Float maxCacheMB = 50.0);
105 
106 // Destructor
107  ~MSSummary();
108 
109 // Retrieve number of rows
110  Int nrow() const;
111 
112 // Retrieve image name
113  String name() const;
114 
115 // Set a new MS. <src>maxCacheMB</src> is the maximum cache size of the
116 // created MSMetaData tool. If negative, the cache size used when this object
117 // was created is used.
118  Bool setMS (const MeasurementSet& ms, Float maxCacheMB=-1);
119 
120 // List all header information.
121  void list (LogIO& os, Bool verbose=False, Bool oneBased=True) const;
122 //Return some useful info in a record too along with os
123  void list (LogIO& os, Record& outRec, Bool verbose=False,
124  Bool fillRecord=True, Bool oneBased=True) const;
125 
126 // List a title for the Summary.
127  void listTitle (LogIO& os) const;
128 
129 // List convenient groupings of tables: list where MS obtained
130 // (Observation and Array tables)
131  void listWhere (LogIO& os, Bool verbose=False) const;
132 
133 // List what was observed (Field and Main tables)
134  void listWhat (LogIO& os, Bool verbose=False) const;
135  void listWhat (LogIO& os, Record& outRec, Bool verbose=False,
136  Bool fillRecord=True) const;
137 // List how data were obtained (SpectralWindow, Feed, and Antenna tables)
138  void listHow (LogIO& os, Bool verbose=False, Bool oneBased=True) const;
139 
140 // List main table
141  void listMain (LogIO& os, Bool verbose=False) const;
142 //Return some useful info in a record too along with os
143  void listMain (LogIO& os, Record& outRec, Bool verbose=False,
144  Bool fillRecord=True) const;
145  // Return a Record with information derived from the main table
146  void getScanSummary (Record& outRec) const;
147 
148 // List subtables
149 // <group>
150  void listAntenna (LogIO& os, Bool verbose=False) const;
151  void listFeed (LogIO& os, Bool verbose=False, Bool oneBased=True) const;
152  void listField (LogIO& os, Bool verbose=False) const;
153  void listField (LogIO& os, Record& outRec, Bool verbose=False,
154  Bool fillRecord=True) const;
155  void listObservation (LogIO& os, Bool verbose=False) const;
156  void listHistory (LogIO& os) const;
157  void listPolarization (LogIO& os, Bool verbose=False) const;
158  void listSource (LogIO& os, Bool verbose=False) const;
159  void listSpectralWindow (LogIO& os, Bool verbose=False) const;
160  void getSpectralWindowInfo(Record& outRec) const;
161  void listSpectralAndPolInfo (LogIO& os, Bool verbose=False,
162  Bool oneBased=True) const;
163  void listSysCal (LogIO& os, Bool verbose=False) const;
164  void listWeather (LogIO& os, Bool verbose=False) const;
165 // </group>
166 
167 // List table size summary
168  void listTables (LogIO& os, Bool verbose=False) const;
169 
171 
172  // OBSOLETE. No longer does anything, kept for compilation backward compatibility.
174 
175 private:
176 // Pointer to MS
179 
180 // Formatting strings
182 
183 // Clear formatting flags
184  void clearFlags (LogIO& os) const;
185 
186 // For keeping track of the number of vis per field
188 
189  // Name of the MS used in the constructor
191 
193 
195 };
196 
197 
198 } //# NAMESPACE CASACORE - END
199 
200 #endif
void list(LogIO &os, Bool verbose=False, Bool oneBased=True) const
List all header information.
Int nrow() const
Retrieve number of rows.
int Int
Definition: aipstype.h:47
void getSpectralWindowInfo(Record &outRec) const
~MSSummary()
Destructor.
Hold and delete pointers not deleted by object destructors.
Definition: PtrHolder.h:197
void setListUnflaggedRowCount(Bool v)
Definition: MSSummary.h:170
void listSource(LogIO &os, Bool verbose=False) const
Bool setMS(const MeasurementSet &ms, Float maxCacheMB=-1)
Set a new MS.
void listSpectralWindow(LogIO &os, Bool verbose=False) const
void listSpectralAndPolInfo(LogIO &os, Bool verbose=False, Bool oneBased=True) const
void listAntenna(LogIO &os, Bool verbose=False) const
List subtables.
void getScanSummary(Record &outRec) const
Return a Record with information derived from the main table.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
const String dashlin2
Definition: MSSummary.h:181
void setMetaDataCacheSizeInMB(Float)
OBSOLETE.
Definition: MSSummary.h:173
void clearFlags(LogIO &os) const
Clear formatting flags.
void listSysCal(LogIO &os, Bool verbose=False) const
void listWhat(LogIO &os, Bool verbose=False) const
List what was observed (Field and Main tables)
const MeasurementSet * pMS
Pointer to MS.
Definition: MSSummary.h:177
void listHistory(LogIO &os) const
Vector< Int > nVisPerField_
For keeping track of the number of vis per field.
Definition: MSSummary.h:187
void listHow(LogIO &os, Bool verbose=False, Bool oneBased=True) const
List how data were obtained (SpectralWindow, Feed, and Antenna tables)
A hierarchical collection of named fields of various types.
Definition: Record.h:181
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
void listObservation(LogIO &os, Bool verbose=False) const
Bool _listUnflaggedRowCount
Definition: MSSummary.h:192
float Float
Definition: aipstype.h:51
const Bool False
Definition: aipstype.h:41
A Table intended to hold astronomical data (a set of Measurements).
void listPolarization(LogIO &os, Bool verbose=False) const
void listTitle(LogIO &os) const
List a title for the Summary.
String name() const
Retrieve image name.
void listFeed(LogIO &os, Bool verbose=False, Bool oneBased=True) const
void listMain(LogIO &os, Bool verbose=False) const
List main table.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void listTables(LogIO &os, Bool verbose=False) const
List table size summary.
String msname_p
Name of the MS used in the constructor.
Definition: MSSummary.h:190
SPtrHolder< MSMetaData > _msmd
Definition: MSSummary.h:178
void listWeather(LogIO &os, Bool verbose=False) const
const String dashlin1
Formatting strings.
Definition: MSSummary.h:181
MSSummary(const MeasurementSet &ms, Float maxCacheMB=50.0)
Constructor.
const Bool True
Definition: aipstype.h:40
this file contains all the compiler specific defines
Definition: mainpage.dox:28
void listWhere(LogIO &os, Bool verbose=False) const
List convenient groupings of tables: list where MS obtained (Observation and Array tables) ...
Provides and lists information about the header of an image.
Definition: MSSummary.h:95
void listField(LogIO &os, Bool verbose=False) const