casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef MS_MSFITSOUTPUTASTRON_H
27#define MS_MSFITSOUTPUTASTRON_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32
33namespace casacore { //# NAMESPACE CASACORE - BEGIN
34
35//# Forward Declarations
36class String;
37class FitsOutput;
38class MeasurementSet;
39class Table;
40template<class T> class Block;
41
42
43// <summary>
44// Write a MeasurementSet to a random group uvfits file.
45// </summary>
46
48{
49public:
50 // Convert a MeasurementSet to random group UVFITS,
51 // specifying the column to write ("observed", "calibrated", "model") and
52 // whether to write the system calibration table.
53 // <br>If asMultiSource=True a multi-source UVFits file is written.
54 // <br>If combineSpw=True, all spectral-windows of a frequency group
55 // are combined.
56 static Bool writeFitsFile(const String& fitsfile, const MeasurementSet& ms,
57 const String& column, Int startchan=-1,
58 Int nchan=-1, Int stepchan=-1,
59 Bool writeSysCal = False,
60 Bool asMultiSource = False, Bool combineSpw=False,
61 Bool writeStation=False, Double sensitivity = 1.0);
62
63
64private:
65 // Write the main table.
66 static FitsOutput *writeMain(Int& refPixelFreq, Double& refFreq,
67 Double& refFreq1, Double& chanbw,
68 const String& outFITSFile,
69 const MeasurementSet& rawms,
70 const String& column,
71 const Block<Int>& spwidMap,
72 Int nrspw,
73 Int startchan, Int nchan, Int stepchan,
74 const Block<Int>& fieldidMap,
75 Bool asMultiSource,
76 Bool combineSpw);
77
78 // Write the FQ table.
79 // If combineSpw is True, all spectral-windows are written in one
80 // row of the FITS table.
81 static Bool writeFQ(FitsOutput *output, const MeasurementSet& ms,
82 const Block<Int>& spwidMap, Int nrspw,
83 Double refFreq, Int refPixelFreq,
84 Double chanbw, Bool combineSpw);
85
86 // Write the AN table.
87 static Bool writeAN(FitsOutput *output, const MeasurementSet& ms,
88 Double refFreq, Bool writeStation);
89
90 // Write the SU table.
91 static Bool writeSU(FitsOutput *output, const MeasurementSet& ms,
92 const Block<Int>& fieldidMap, Int nrfield,
93 const Block<Int>& spwidMap, Int nrspw);
94
95 // Write the TY table.
96 static Bool writeTY(FitsOutput *output, const MeasurementSet& ms,
97 const Table& syscal, const Block<Int>& spwidMap,
98 uInt nrif, Bool combineSpw);
99
100 // Write the GC table.
101 static Bool writeGC(FitsOutput *output, const MeasurementSet& ms,
102 const Table& syscal, const Block<Int>& spwidMap,
103 uInt nrif, Bool combineSpw, Double sensitivity,
104 Int refPixelFreq, Double refFreq, Double chanbw);
105
106 // Convert time to day and fraction.
107 static void timeToDay(Int& day, Double& dayFraction, Double time);
108
109 // Get the time and hourangle from the MS at the given row.
110 // It uses the field-id and observation-id to calculate the hourangle.
111 static void getStartHA (Double& startTime, Double& startHA,
112 const MeasurementSet& ms, uInt rownr);
113
114 // Handle the SYSCAL table.
115 // It skips the entries not needed and sorts it in the correct order.
117 const Vector<Int>& spwids, Bool isSubset);
118
119 // Determine which ids are selected in the main table
120 // (used for fields and spectral-window).
121 // It fills a block for all possible ids, where -1 tells that the
122 // id is not selected. Furthermore it fills a vector with the
123 // selected id numbers.
124 // The input is a vector containing all ids in the main table.
125 // If isSubset is False the main table is not a selection, but
126 // represents an entire MS. In that case the map and selids are
127 // simply filled with values 0-nrid.
128 static Int makeIdMap (Block<Int>& map, Vector<Int>& selids,
129 const Vector<Int>& allids, Bool isSubset);
130};
131
132
133
134} //# NAMESPACE CASACORE - END
135
136#endif
simple 1-D array
Definition Block.h:198
fixed-length sequential blocked FITS output
Definition fitsio.h:226
static Table handleSysCal(const MeasurementSet &ms, const Vector< Int > &spwids, Bool isSubset)
Handle the SYSCAL 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).
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.
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 writeFQ(FitsOutput *output, const MeasurementSet &ms, const Block< Int > &spwidMap, Int nrspw, Double refFreq, Int refPixelFreq, Double chanbw, Bool combineSpw)
Write the FQ table.
static Bool writeAN(FitsOutput *output, const MeasurementSet &ms, Double refFreq, Bool writeStation)
Write the AN table.
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 ("observed",...
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 void timeToDay(Int &day, Double &dayFraction, Double time)
Convert time to day and fraction.
static Bool writeTY(FitsOutput *output, const MeasurementSet &ms, const Table &syscal, const Block< Int > &spwidMap, uInt nrif, Bool combineSpw)
Write the TY 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:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1584
unsigned int uInt
Definition aipstype.h:49
TableExprNode day(const TableExprNode &node)
Definition ExprNode.h:1527
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53