casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSFitsOutputAstron.h
Go to the documentation of this file.
1 //# MSFitsOutputAstron.h: Write a MeasurementSet to a random group uvfits file
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This program is free software; you can redistribute it and/or modify
6 //# it under the terms of the GNU General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or
8 //# (at your option) any later version.
9 //#
10 //# This program is distributed in the hope that it will be useful,
11 //# but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 //# GNU General Public License for more details.
14 //#
15 //# You should have received a copy of the GNU General Public License
16 //# along with this program; if not, write to the Free Software
17 //# Foundation, Inc., 675 Mass 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_MSFITSOUTPUTASTRON_H
29 #define MS_MSFITSOUTPUTASTRON_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 //# Forward Declarations
38 class String;
39 class FitsOutput;
40 class MeasurementSet;
41 class Table;
42 template<class T> class Block;
43 
44 
45 // <summary>
46 // Write a MeasurementSet to a random group uvfits file.
47 // </summary>
48 
50 {
51 public:
52  // Convert a MeasurementSet to random group UVFITS,
53  // specifying the column to write ("observed", "calibrated", "model") and
54  // whether to write the system calibration table.
55  // <br>If asMultiSource=True a multi-source UVFits file is written.
56  // <br>If combineSpw=True, all spectral-windows of a frequency group
57  // are combined.
58  static Bool writeFitsFile(const String& fitsfile, const MeasurementSet& ms,
59  const String& column, Int startchan=-1,
60  Int nchan=-1, Int stepchan=-1,
61  Bool writeSysCal = False,
62  Bool asMultiSource = False, Bool combineSpw=False,
63  Bool writeStation=False, Double sensitivity = 1.0);
64 
65 
66 private:
67  // Write the main table.
68  static FitsOutput *writeMain(Int& refPixelFreq, Double& refFreq,
69  Double& refFreq1, Double& chanbw,
70  const String& outFITSFile,
71  const MeasurementSet& rawms,
72  const String& column,
73  const Block<Int>& spwidMap,
74  Int nrspw,
75  Int startchan, Int nchan, Int stepchan,
76  const Block<Int>& fieldidMap,
77  Bool asMultiSource,
78  Bool combineSpw);
79 
80  // Write the FQ table.
81  // If combineSpw is True, all spectral-windows are written in one
82  // row of the FITS table.
83  static Bool writeFQ(FitsOutput *output, const MeasurementSet& ms,
84  const Block<Int>& spwidMap, Int nrspw,
85  Double refFreq, Int refPixelFreq,
86  Double chanbw, Bool combineSpw);
87 
88  // Write the AN table.
89  static Bool writeAN(FitsOutput *output, const MeasurementSet& ms,
90  Double refFreq, Bool writeStation);
91 
92  // Write the SU table.
93  static Bool writeSU(FitsOutput *output, const MeasurementSet& ms,
94  const Block<Int>& fieldidMap, Int nrfield,
95  const Block<Int>& spwidMap, Int nrspw);
96 
97  // Write the TY table.
98  static Bool writeTY(FitsOutput *output, const MeasurementSet& ms,
99  const Table& syscal, const Block<Int>& spwidMap,
100  uInt nrif, Bool combineSpw);
101 
102  // Write the GC table.
103  static Bool writeGC(FitsOutput *output, const MeasurementSet& ms,
104  const Table& syscal, const Block<Int>& spwidMap,
105  uInt nrif, Bool combineSpw, Double sensitivity,
106  Int refPixelFreq, Double refFreq, Double chanbw);
107 
108  // Convert time to day and fraction.
109  static void timeToDay(Int& day, Double& dayFraction, Double time);
110 
111  // Get the time and hourangle from the MS at the given row.
112  // It uses the field-id and observation-id to calculate the hourangle.
113  static void getStartHA (Double& startTime, Double& startHA,
114  const MeasurementSet& ms, uInt rownr);
115 
116  // Handle the SYSCAL table.
117  // It skips the entries not needed and sorts it in the correct order.
118  static Table handleSysCal (const MeasurementSet& ms,
119  const Vector<Int>& spwids, Bool isSubset);
120 
121  // Determine which ids are selected in the main table
122  // (used for fields and spectral-window).
123  // It fills a block for all possible ids, where -1 tells that the
124  // id is not selected. Furthermore it fills a vector with the
125  // selected id numbers.
126  // The input is a vector containing all ids in the main table.
127  // If isSubset is False the main table is not a selection, but
128  // represents an entire MS. In that case the map and selids are
129  // simply filled with values 0-nrid.
130  static Int makeIdMap (Block<Int>& map, Vector<Int>& selids,
131  const Vector<Int>& allids, Bool isSubset);
132 };
133 
134 
135 
136 } //# NAMESPACE CASACORE - END
137 
138 #endif
int Int
Definition: aipstype.h:50
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1580
static Bool writeFQ(FitsOutput *output, const MeasurementSet &ms, const Block< Int > &spwidMap, Int nrspw, Double refFreq, Int refPixelFreq, Double chanbw, Bool combineSpw)
Write the FQ table.
Main interface class to a read/write table.
Definition: Table.h:157
Write a MeasurementSet to a random group uvfits file.
static Bool writeSU(FitsOutput *output, const MeasurementSet &ms, const Block< Int > &fieldidMap, Int nrfield, const Block< Int > &spwidMap, Int nrspw)
Write the SU table.
static Bool writeAN(FitsOutput *output, const MeasurementSet &ms, Double refFreq, Bool writeStation)
Write the AN table.
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
static Bool writeTY(FitsOutput *output, const MeasurementSet &ms, const Table &syscal, const Block< Int > &spwidMap, uInt nrif, Bool combineSpw)
Write the TY table.
A Table intended to hold astronomical data (a set of Measurements).
static Table handleSysCal(const MeasurementSet &ms, const Vector< Int > &spwids, Bool isSubset)
Handle the SYSCAL table.
static Bool writeGC(FitsOutput *output, const MeasurementSet &ms, const Table &syscal, const Block< Int > &spwidMap, uInt nrif, Bool combineSpw, Double sensitivity, Int refPixelFreq, Double refFreq, Double chanbw)
Write the GC table.
static Int makeIdMap(Block< Int > &map, Vector< Int > &selids, const Vector< Int > &allids, Bool isSubset)
Determine which ids are selected in the main table (used for fields and spectral-window).
fixed-length sequential blocked FITS output
Definition: fitsio.h:228
TableExprNode day(const TableExprNode &node)
Definition: ExprNode.h:1523
static Bool writeFitsFile(const String &fitsfile, const MeasurementSet &ms, const String &column, Int startchan=-1, Int nchan=-1, Int stepchan=-1, Bool writeSysCal=False, Bool asMultiSource=False, Bool combineSpw=False, Bool writeStation=False, Double sensitivity=1.0)
Convert a MeasurementSet to random group UVFITS, specifying the column to write (&quot;observed&quot;, &quot;calibrated&quot;, &quot;model&quot;) and whether to write the system calibration table.
static void getStartHA(Double &startTime, Double &startHA, const MeasurementSet &ms, uInt rownr)
Get the time and hourangle from the MS at the given row.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
static void timeToDay(Int &day, Double &dayFraction, Double time)
Convert time to day and fraction.
static FitsOutput * writeMain(Int &refPixelFreq, Double &refFreq, Double &refFreq1, Double &chanbw, const String &outFITSFile, const MeasurementSet &rawms, const String &column, const Block< Int > &spwidMap, Int nrspw, Int startchan, Int nchan, Int stepchan, const Block< Int > &fieldidMap, Bool asMultiSource, Bool combineSpw)
Write the main table.
unsigned int uInt
Definition: aipstype.h:51