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>
41class Block;
42
43// <summary>
44// Write a MeasurementSet to a random group uvfits file.
45// </summary>
46
48 public:
49 // Convert a MeasurementSet to random group UVFITS,
50 // specifying the column to write ("observed", "calibrated", "model") and
51 // whether to write the system calibration table.
52 // <br>If asMultiSource=True a multi-source UVFits file is written.
53 // <br>If combineSpw=True, all spectral-windows of a frequency group
54 // are combined.
55 static Bool writeFitsFile(const String& fitsfile, const MeasurementSet& ms, const String& column,
56 Int startchan = -1, Int nchan = -1, Int stepchan = -1,
57 Bool writeSysCal = False, Bool asMultiSource = False,
58 Bool combineSpw = False, Bool writeStation = False,
59 Double sensitivity = 1.0);
60
61 private:
62 // Write the main table.
63 static FitsOutput* writeMain(Int& refPixelFreq, Double& refFreq, Double& refFreq1, Double& chanbw,
64 const String& outFITSFile, const MeasurementSet& rawms,
65 const String& column, const Block<Int>& spwidMap, Int nrspw,
66 Int startchan, Int nchan, Int stepchan, const Block<Int>& fieldidMap,
67 Bool asMultiSource, Bool combineSpw);
68
69 // Write the FQ table.
70 // If combineSpw is True, all spectral-windows are written in one
71 // row of the FITS table.
72 static Bool writeFQ(FitsOutput* output, const MeasurementSet& ms, const Block<Int>& spwidMap,
73 Int nrspw, Double refFreq, Int refPixelFreq, Double chanbw, Bool combineSpw);
74
75 // Write the AN table.
76 static Bool writeAN(FitsOutput* output, const MeasurementSet& ms, Double refFreq,
77 Bool writeStation);
78
79 // Write the SU table.
80 static Bool writeSU(FitsOutput* output, const MeasurementSet& ms, const Block<Int>& fieldidMap,
81 Int nrfield, const Block<Int>& spwidMap, Int nrspw);
82
83 // Write the TY table.
84 static Bool writeTY(FitsOutput* output, const MeasurementSet& ms, const Table& syscal,
85 const Block<Int>& spwidMap, uInt nrif, Bool combineSpw);
86
87 // Write the GC table.
88 static Bool writeGC(FitsOutput* output, const MeasurementSet& ms, const Table& syscal,
89 const Block<Int>& spwidMap, uInt nrif, Bool combineSpw, Double sensitivity,
90 Int refPixelFreq, Double refFreq, Double chanbw);
91
92 // Convert time to day and fraction.
93 static void timeToDay(Int& day, Double& dayFraction, Double time);
94
95 // Get the time and hourangle from the MS at the given row.
96 // It uses the field-id and observation-id to calculate the hourangle.
97 static void getStartHA(Double& startTime, Double& startHA, const MeasurementSet& ms, uInt rownr);
98
99 // Handle the SYSCAL table.
100 // It skips the entries not needed and sorts it in the correct order.
101 static Table handleSysCal(const MeasurementSet& ms, const Vector<Int>& spwids, Bool isSubset);
102
103 // Determine which ids are selected in the main table
104 // (used for fields and spectral-window).
105 // It fills a block for all possible ids, where -1 tells that the
106 // id is not selected. Furthermore it fills a vector with the
107 // selected id numbers.
108 // The input is a vector containing all ids in the main table.
109 // If isSubset is False the main table is not a selection, but
110 // represents an entire MS. In that case the map and selids are
111 // simply filled with values 0-nrid.
112 static Int makeIdMap(Block<Int>& map, Vector<Int>& selids, const Vector<Int>& allids,
113 Bool isSubset);
114};
115
116} // namespace casacore
117
118#endif
fixed-length sequential blocked FITS output
Definition fitsio.h:242
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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1368
unsigned int uInt
Definition aipstype.h:49
TableExprNode day(const TableExprNode &node)
Definition ExprNode.h:1329
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