casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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  // construct the object using an MSMetaDataObject
107  MSSummary (std::shared_ptr<MSMetaData> msmd);
108 
109 // Destructor
110  ~MSSummary();
111 
112 // Retrieve number of rows
113  Int64 nrow() const;
114 
115 // Retrieve image name
116  String name() const;
117 
118 // Set a new MS. <src>maxCacheMB</src> is the maximum cache size of the
119 // created MSMetaData tool. If negative, the cache size used when this object
120 // was created is used.
121  Bool setMS (const MeasurementSet& ms, Float maxCacheMB=-1);
122 
123 // List all header information.
124  void list (LogIO& os, Bool verbose=False, Bool oneBased=True) const;
125 //Return some useful info in a record too along with os
126  void list (LogIO& os, Record& outRec, Bool verbose=False,
127  Bool fillRecord=True, Bool oneBased=True) const;
128 
129 // List a title for the Summary.
130  void listTitle (LogIO& os) const;
131 
132 // List convenient groupings of tables: list where MS obtained
133 // (Observation and Array tables)
134  void listWhere (LogIO& os, Bool verbose=False) const;
135 
136 // List what was observed (Field and Main tables)
137  void listWhat (LogIO& os, Bool verbose=False) const;
138  void listWhat (LogIO& os, Record& outRec, Bool verbose=False,
139  Bool fillRecord=True) const;
140 // List how data were obtained (SpectralWindow, Feed, and Antenna tables)
141  void listHow (LogIO& os, Bool verbose=False, Bool oneBased=True) const;
142 
143 // List main table
144  void listMain (LogIO& os, Bool verbose=False) const;
145 //Return some useful info in a record too along with os
146  void listMain (LogIO& os, Record& outRec, Bool verbose=False,
147  Bool fillRecord=True) const;
148  // Return a Record with information derived from the main table
149  void getScanSummary (Record& outRec) const;
150 
151 // List subtables
152 // <group>
153  void listAntenna (LogIO& os, Bool verbose=False) const;
154  void listFeed (LogIO& os, Bool verbose=False, Bool oneBased=True) const;
155  void listField (LogIO& os, Bool verbose=False) const;
156  void listField (LogIO& os, Record& outRec, Bool verbose=False,
157  Bool fillRecord=True) const;
158  void listObservation (LogIO& os, Bool verbose=False) const;
159  void listHistory (LogIO& os) const;
160  void listPolarization (LogIO& os, Bool verbose=False) const;
161  void listSource (LogIO& os, Bool verbose=False) const;
162  void listSpectralWindow (LogIO& os, Bool verbose=False) const;
163  void getSpectralWindowInfo(Record& outRec) const;
164  void listSpectralAndPolInfo (LogIO& os, Bool verbose=False,
165  Bool oneBased=True) const;
166  void listSysCal (LogIO& os, Bool verbose=False) const;
167  void listWeather (LogIO& os, Bool verbose=False) const;
168 // </group>
169 
170 // List table size summary
171  void listTables (LogIO& os, Bool verbose=False) const;
172 
174 
175  // OBSOLETE. No longer does anything, kept for compilation backward compatibility.
177 
178 private:
179 // Pointer to MS
181  std::shared_ptr<MSMetaData> _msmd;
182 
183 // Formatting strings
185 
186 // Clear formatting flags
187  void clearFlags (LogIO& os) const;
188 
189 // For keeping track of the number of vis per field
191 
192  // Name of the MS used in the constructor
194 
196 
198 };
199 
200 
201 } //# NAMESPACE CASACORE - END
202 
203 #endif
void list(LogIO &os, Bool verbose=False, Bool oneBased=True) const
List all header information.
void listObservation(LogIO &os, Bool verbose=False) const
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
void listPolarization(LogIO &os, Bool verbose=False) const
std::shared_ptr< MSMetaData > _msmd
Definition: MSSummary.h:181
void getScanSummary(Record &outRec) const
Return a Record with information derived from the main table.
~MSSummary()
Destructor.
void setListUnflaggedRowCount(Bool v)
Definition: MSSummary.h:173
Bool setMS(const MeasurementSet &ms, Float maxCacheMB=-1)
Set a new MS.
void listTitle(LogIO &os) const
List a title for the Summary.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
const String dashlin2
Definition: MSSummary.h:184
void setMetaDataCacheSizeInMB(Float)
OBSOLETE.
Definition: MSSummary.h:176
void listHow(LogIO &os, Bool verbose=False, Bool oneBased=True) const
List how data were obtained (SpectralWindow, Feed, and Antenna tables)
const MeasurementSet * pMS
Pointer to MS.
Definition: MSSummary.h:180
void listAntenna(LogIO &os, Bool verbose=False) const
List subtables.
Vector< Int > nVisPerField_
For keeping track of the number of vis per field.
Definition: MSSummary.h:190
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void listWeather(LogIO &os, Bool verbose=False) const
void listHistory(LogIO &os) const
void listMain(LogIO &os, Bool verbose=False) const
List main table.
Bool _listUnflaggedRowCount
Definition: MSSummary.h:195
Int64 nrow() const
Retrieve number of rows.
float Float
Definition: aipstype.h:54
String name() const
Retrieve image name.
const Bool False
Definition: aipstype.h:44
void getSpectralWindowInfo(Record &outRec) const
void listSpectralAndPolInfo(LogIO &os, Bool verbose=False, Bool oneBased=True) const
A Table intended to hold astronomical data (a set of Measurements).
void listField(LogIO &os, Bool verbose=False) const
void listSpectralWindow(LogIO &os, Bool verbose=False) const
void listWhere(LogIO &os, Bool verbose=False) const
List convenient groupings of tables: list where MS obtained (Observation and Array tables) ...
void listSource(LogIO &os, Bool verbose=False) const
String: the storage and methods of handling collections of characters.
Definition: String.h:225
void listFeed(LogIO &os, Bool verbose=False, Bool oneBased=True) const
void clearFlags(LogIO &os) const
Clear formatting flags.
void listWhat(LogIO &os, Bool verbose=False) const
List what was observed (Field and Main tables)
String msname_p
Name of the MS used in the constructor.
Definition: MSSummary.h:193
void listTables(LogIO &os, Bool verbose=False) const
List table size summary.
void listSysCal(LogIO &os, Bool verbose=False) const
const String dashlin1
Formatting strings.
Definition: MSSummary.h:184
MSSummary(const MeasurementSet &ms, Float maxCacheMB=50.0)
Constructor.
const Bool True
Definition: aipstype.h:43
Provides and lists information about the header of an image.
Definition: MSSummary.h:95