This file is indexed.

/usr/include/casacore/msfits/MSFits/MSFitsOutput.h is in casacore-dev 2.2.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
//# MSFitsOutput.h:  Write a MeasurementSet to a random group uvfits file
//# Copyright (C) 1996,1997,1998,1999,2000,2001,2003
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This program is free software; you can redistribute it and/or modify
//# it under the terms of the GNU General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or
//# (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//# GNU General Public License for more details.
//# 
//# You should have received a copy of the GNU General Public License
//# along with this program; if not, write to the Free Software
//# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//#        Internet email: aips2-request@nrao.edu.
//#        Postal address: AIPS++ Project Office
//#                        National Radio Astronomy Observatory
//#                        520 Edgemont Road
//#                        Charlottesville, VA 22903-2475 USA
//#
//# $Id: MSFitsOutput.h 21521 2014-12-10 08:06:42Z gervandiepen $

#ifndef MS_MSFITSOUTPUT_H
#define MS_MSFITSOUTPUT_H

#include <casacore/casa/BasicSL/String.h>
#include <casacore/casa/Quanta/Quantum.h>
#include <casacore/ms/MeasurementSets/MeasurementSet.h>

#include <casacore/casa/aips.h>

namespace casacore {

//# Forward Declarations
class FitsOutput;
template<class T> class ScalarColumn;
class Table;
template<class T> class Block;
template<class T> class Vector;

// <summary>
// Write a MeasurementSet to a random group uvfits file.
// </summary>

class MSFitsOutput {
public:
    //  @param fitsfile      Output filename
    //  @param ms            input
    //  @param column        specifies which "data" column to write
    //                       ("observed", "calibrated", "model")
    MSFitsOutput(
        const String& fitsfile, const MeasurementSet& ms,
        const String& column
    );

    //  @param startchan     1st channel
    //  @param nchan         # of channels
    //  @param stepchan      # of channels to stride by
    //  @param avgchan       average every N channels
    void setChannelInfo(
        Int startChan, Int nchan, Int stepChan, Int avgChan
    );

    //  @param writeSysCal   whether to write the system calibration table
    void setWriteSysCal(Bool writeSysCal);

    //  @param asMultiSource If true a multi-source UVFits file is written.
    void setAsMultiSource(Bool asMultiSource);

    //  @param combineSpw    If true it attempts to write the spectral windows as
    //                       IFs.  This is necessary for many aips tasks, and
    //                       for difmap.
    void setCombineSpw(Bool combineSpw);

    //  @param writeStation  If true uses pad instead of antenna names.
    void setWriteStation(Bool writeStation);

    void setSensitivity(Double sensitivity);

    //  @param padWithFlags  If true and combineSpw==true, fill spws with flags
    //                       as needed to fit the IF structure.  Does not yet
    //                       support spws with different shapes.
    void setPadWitFlags(Bool padWithFlags);

    void setFieldNumber(uInt fieldNumber);

    //  @param overwrite     overwrite existing file?
    void setOverwrite(Bool overwrite);

    // write the uvfits file.
    void write() const;

    // Convert a MeasurementSet to random group UVFITS.
    //  @param fitsfile      Output filename
    //  @param ms            input
    //  @param column        specifies which "data" column to write
    //                       ("observed", "calibrated", "model")
    //  @param startchan     1st channel
    //  @param nchan         # of channels
    //  @param stepchan      # of channels to stride by
    //  @param writeSysCal   whether to write the system calibration table
    //  @param asMultiSource If true a multi-source UVFits file is written.
    //  @param combineSpw    If true it attempts to write the spectral windows as
    //                       IFs.  This is necessary for many aips tasks, and
    //                       for difmap.
    //  @param writeStation  If true uses pad instead of antenna names.
    //  @param sensitivity
    //  @param padWithFlags  If true and combineSpw==true, fill spws with flags
    //                       as needed to fit the IF structure.  Does not yet
    //                       support spws with different shapes.
    //  @param avgchan       average every N channels
    //  @param overwrite     overwrite existing file?
    static Bool writeFitsFile(
        const String& fitsfile, const MeasurementSet& ms,
        const String& column, Int startchan=0,
        Int nchan=1, Int stepchan=1,
        Bool writeSysCal = False,
        Bool asMultiSource = False, Bool combineSpw=False,
        Bool writeStation=False, Double sensitivity=1.0,
        const Bool padWithFlags=false, Int avgchan=1,
        uInt fieldNumber=0, Bool overwrite=False
    );

private:
    const String _fitsfile, _column;
    const MeasurementSet _ms;
    Int _startChan, _nchan, _stepChan, _avgChan;
    Bool _writeSysCal, _asMultiSource, _combineSpw,
        _writeStation, _padWithFlags, _overwrite;
    Double _sensitivity;
    uInt _fieldNumber;


    // Write the main table.
    //    @param refPixelFreq
    //    @param refFreq
    //    @param chanbw
    //    @param outFITSFile
    //    @param rawms
    //    @param column         data column to write
    //    @param spwidMap       spwidMap[inp_spw] = output_spw, if inp_spw is selected
    //                                              -1 otherwise.
    //    @param nrspw          # of selected spws.
    //    @param startchan      First channel
    //    @param nchan          # of channels
    //    @param stepchan       channel stride
    //    @param fieldidMap     fieldidMap[inp_fld] = output_fld, if inp_fld is selected
    //                                                -1 otherwise.
    //    @param asMultiSource  If true, write a multisource UVFITS file.
    //    @param combineSpw     If true, export the spectral window(s) as IF(s).
    //    @param padWithFlags   If true && combineSpw==true, pad the spws with
    //                          flags as necessary to fit the IF structure.
    //    @param avgchan        average every N channels
    FitsOutput* _writeMain(
        Int& refPixelFreq, Double& refFreq,
        Double& chanbw, const String& outFITSFile,
        const Block<Int>& spwidMap, Int nrspw,
        const Block<Int>& fieldidMap,
        Bool asMultiSource
    ) const;

    // Write the FQ table.
    // If combineSpw is True, all spectral-windows are written in one
    // row of the FITS table.
    static Bool writeFQ(FitsOutput *output, const MeasurementSet& ms,
        const Block<Int>& spwidMap, Int nrspw,
        Double refFreq, Int refPixelFreq,
        Double chanbw, Bool combineSpw,
        Int chanstart = 0, Int nchan = -1, Int chanstep = 1,
        Int avgchan = 1
    );

    // Write the AN table.
    static Bool writeAN(
        FitsOutput *output, const MeasurementSet& ms,
        Double refFreq, Bool writeStation
    );

    // Write the SU table.
    static Bool writeSU(
        FitsOutput *output, const MeasurementSet& ms,
        const Block<Int>& fieldidMap, Int nrfield,
		const Block<Int>& spwidMap, Int nrspw
    );

    // Write the TY table.
    static Bool writeTY(
        FitsOutput *output, const MeasurementSet& ms,
        const Table& syscal, const Block<Int>& spwidMap,
        uInt nrif, Bool combineSpw
    );

    // Write the GC 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 WX table.
    static Bool writeWX(FitsOutput *output, const MeasurementSet& ms);

    // Convert time to day and fraction.
    static void timeToDay(Int& day, Double& dayFraction, Double time);

    // Get the time and hourangle from the MS at the given row.
    // It uses the field-id and observation-id to calculate the hourangle.
    static void getStartHA (
        Double& startTime, Double& startHA,
        const MeasurementSet& ms, uInt rownr
    );

    // Discern the antenna numbers that go into UVFITS
    static void handleAntNumbers(const MeasurementSet& ms,Vector<Int>& antnumbers);

    // Handle the SYSCAL table.
    // It skips the entries not needed and sorts it in the correct order.
    static Table handleSysCal (
        const MeasurementSet& ms,
        const Vector<Int>& spwids, Bool isSubset
    );

    // Determine which ids are selected in the main table
    // (used for fields and spectral-window).
    //    @param map    (Really an output here, not an input.)
    //                  spwidMap[inp_id] = output_id, if inp_id is selected
    //                                     -1 otherwise.
    //    @param selids (Really an output here, not an input.)
    //                  A list of the selected input IDs.
    //    @param allids (Really is an input, not an output!)
    //                  IDs to consider.
    //    @return number of selected IDs in allids

    static Int _makeIdMap(
        Block<Int>& map, Vector<Int>& selids,
        const Vector<Int>& allids
    );

    // Find the end of a group of rows with the same
    // time(_centroid) (within 0.25 * ininterval(rownr)),
    // baseline #,
    // and, if asMultiSource, field ID.
    //    @param rownr          Row # to start from.
    //    @param nrow           # of rows in the columns.
    //    @param nif            # of IFs
    //    @param timec          time(_centroid) col
    //    @param ininterval     used to set tolerance on changes in timec.
    //    @param ant1           ID of baseline's antenna 1.
    //    @param ant2           ID of baseline's antenna 2.
    //    @param asMultiSource  If false, treat fieldid as unattached + prone to segfault
    //    @param fieldid
    //    @return Last row # with the same time, baseline, and apparent field as rownr.
    //    @warning Assumes that the columns are sorted by time(_centroid), ant1,
    //             ant2 (, field, DDID).
    static uInt get_tbf_end(
        const uInt rownr, const uInt nrow, const uInt nif,
        const ScalarColumn<Double>& timec,
        const ScalarColumn<Double>& ininterval,
        const ScalarColumn<Int>& ant1,
        const ScalarColumn<Int>& ant2,
        const Bool asMultiSource,
        const ScalarColumn<Int>& fieldid
    );

    static void _checkReceptorAngles(
        const Vector<Quantity>& ra0, Vector<Quantity>& ra1, Int antnum
    );
};

} //# NAMESPACE CASACORE - END

#endif