casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ATCAFiller.h
Go to the documentation of this file.
1 //# ATCAFiller.h: Definition for ATCA filler
2 //# Copyright (C) 2004
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: ATCAFiller.h,v 1.6 2004/12/13 04:44:35 mwiering Exp $
27 
28 #ifndef ATNF_ATCAFILLER_H
29 #define ATNF_ATCAFILLER_H
30 
31 //# Includes
32 #include <casa/aips.h>
33 #include <casa/Arrays/Matrix.h>
34 #include <casa/Logging/LogIO.h>
38 
39 #include <casa/namespace.h>
40 
41 namespace casa { //# NAMESPACE CASA - BEGIN
42 
43 class ATCAFiller {
44 public:
45 
46  // Construct the ATCAFiller
47  ATCAFiller();
48 
49  ~ATCAFiller();
50 
51  // return the ATCA required tabledesc, this is the standard MeasurementSet
52  // plus ATCA specific additions.
54 
55  // make the ATCA specific MeasurementSet
56  static casacore::MeasurementSet makeTable(const casacore::String& tableName, casacore::Bool compress,
57  casacore::Bool cabb);
58 
59  // make the subtables with ATCA specific additions
61 
62  // Open the measurement set and one or more RPFits files.
63  // Opacity correction is not yet implemented - could go
64  // in gencal or here, if gencal scheme doesn't improve
67 
68  // Fill the measurement set
70 
71  // Select a number of fields by name.
73 
74  // Select a range of frequencies, lowFreq=0 => everything below higFreq,
75  // highFreq=0 => everything above lowFreq.
77 
78  // Select frequencies within windowWidth of specified ones.
79  // (This selects on center-frequencies only, not channelfrequencies)
81 
82  // Select a range of scans to read. first=0 or 1 => start at first one,
83  // last=0 => read to end of file.
84  ATCAFiller & scanRange(casacore::Int firstScan, casacore::Int lastScan=0);
85 
86  // Select range of channels, with optional increment.
87  // We may want multiple channel ranges -> use matrix(3,n) for selection?
88  ATCAFiller & chanRange(casacore::Int firstChan, casacore::Int lastChan, casacore::Int ChanInc=1);
89 
90  // casacore::Time range selection.
91  ATCAFiller & timeRange(casacore::Double firstTime, casacore::Double lastTime=0);
92 
93  // Select the Freq (which one of the simult. freqs), 0=> no selection.
94  //
96 
97  // Select on bandwidth of IF 1.
99 
100  // Select on number of channels of IF 1
101  ATCAFiller & numChan1(casacore::Int numchan1);
102 
103  // Set shadowing limit
105 
106  // Deselect antennas.
108 
109  // casacore::Smooth xy-phases with running median and
110  // flag data with discrepant xy-phase.
112 
113  // casacore::Smooth Tsys values with running median and recalibrate the data.
115 
116  // Set percentage of channels to flag at band edges
118 
119  // Calculate zenith opacities using the ASAP/Miriad model given surface weather conditions and
120  // observatory height. Units are: fGHz [GHz], tempK [Kelvin], humi [%], press [hPa], height [m]
123  casacore::Float press,casacore::Float height);
124 
125 private:
126  //# disallow all these
127  ATCAFiller(const ATCAFiller &);
128  ATCAFiller & operator=(const ATCAFiller &);
129 
130  //for constructors
131  void init();
132 
133  // When storing header items skip irrelevant items for the last (empty) scan,
134  // it is just there to capture caobs commands and comments
135  void storeHeader(Bool last=False);
136  void storeATCAHeader(Bool last=False);
137  void storeSysCal();
138 
139  // fill a single input file
140  casacore::Bool fill1(const casacore::String & rpfitsname);
141 
142  // casacore::List the file on cout
143  void list();
144 
145  // Flag data if samplerstats are bad.
146  casacore::Bool samplerFlag(casacore::Int row, casacore::Double posNegTolerance=3.0,
147  casacore::Double zeroTolerance=0.5);
148 
150  void reweight();
151  void storeData();
153  void checkField();
154  void checkObservation();
155  // Fill the feed table (with dummy values)
156  void fillFeedTable();
157  void fillObservationTable();
158  void fillMeasureReferences();
161  casacore::Bool checkCABB(const casacore::String & rpfitsname);
163 
164 
166  void flush();
167  void unlock();
168 
169  void shadow(casacore::Int row, casacore::Bool last=false);
170 
171  // Constants
172  // MaxNPol needs to agree with if_cstok in RPFITS.h
173  enum{MaxNChan=16385, MaxNPol=4};
174  // Data
177 
178  // Filenames
182 
183  // The following should be constant throughout the rpfits file
185 
186  // Number of scans seen; #SpWs, #fields stored sofar
188  // #scanheaders stored, index into casacore::MS SpW and Field Tables for current data
190 
191  // Bools
192  casacore::Bool gotAN_p; //have we got an antenna casacore::Table yet?
201  casacore::Bool birdie_p; // flag birdie channels
202  casacore::Bool reweight_p; // gibbs reweighting
203  casacore::Bool noxycorr_p; // do not apply xy phase correction
204  casacore::Bool noac_p; // Don't load the autocorrelation data
205  casacore::Int obsType_p; // the type of observation: 0= standard, 1= fastmosaic
206  casacore::Bool hires_p; // transform binned data into high time res data
207  casacore::Bool init_p; // Are we initialized yet?
208  casacore::Bool cabb_p; // Are we reading CABB data?
209 
210  // rpfits data
213  casacore::Int baseline, flg, bin, if_no, sourceno; //index into rpfits casacore::Table(not casacore::MS)
215 
216  // storage manager accessor
220 
221  // Column objects to access Tables
222 
223  // colXXX objects are ATCA specific columns in the casacore::MeasurementSet
232  // ATCA_SCAN_INFO columns & table
243 
244  // reference date
246 
247  // variables to keep the state of the sysCal search & binning state
254 
255  // Selection parameters
266 
267  // Track sources
270 
271  // Polarization order
273 
274  // Check for shadowing
280 
281  // Flagging
285 
286  // Logger
288 
289 };
290 
291 } //# NAMESPACE CASA - END
292 
293 
294 #endif
void fillFeedTable()
Fill the feed table (with dummy values)
casacore::ScalarColumn< casacore::Bool > colWeatherSeeMonFlag
Definition: ATCAFiller.h:231
MIRIAD dataset casacore::MeasurementSet filler.
Definition: Importmiriad.h:132
casacore::ArrayColumn< casacore::Int > colScanInfoCoarse
Definition: ATCAFiller.h:235
ATCAFiller & deselectAntenna(casacore::Vector< casacore::Int > antennas)
Deselect antennas.
casacore::Float vis[2 *MaxNPol *MaxNChan]
rpfits data
Definition: ATCAFiller.h:211
void listScan(casacore::Double &mjd, casacore::Int scan, casacore::Double ut)
casacore::Block< casacore::Int > rowCache_p
Definition: ATCAFiller.h:277
casacore::Int lastChan_p
Definition: ATCAFiller.h:261
int Int
Definition: aipstype.h:50
casacore::Int checkSpW(casacore::Int ifNumber, casacore::Bool log=true)
ATCAFiller & edge(casacore::Float edge)
Set percentage of channels to flag at band edges.
LatticeExprNode log(const LatticeExprNode &expr)
casacore::ArrayColumn< casacore::Float > colGTP
Definition: ATCAFiller.h:230
ATCAFiller & bandwidth1(casacore::Int bandwidth1)
Select on bandwidth of IF 1.
casacore::Vector< casacore::String > fieldSelection_p
Selection parameters.
Definition: ATCAFiller.h:256
casacore::MSColumns * msc_p
Definition: ATCAFiller.h:176
casacore::ArrayColumn< casacore::Float > colSamplerStatsPos
Definition: ATCAFiller.h:228
casacore::Float lastWeatherUT_p
Definition: ATCAFiller.h:252
casacore::Bool fill()
Fill the measurement set.
casacore::ScalarColumn< casacore::Int > colScanInfoScanId
Definition: ATCAFiller.h:233
casacore::Int spWId_p
Definition: ATCAFiller.h:189
casacore::Float weight[MaxNPol *MaxNChan]
Definition: ATCAFiller.h:212
casacore::ScalarColumn< casacore::String > colScanInfoPointInfo
Definition: ATCAFiller.h:237
Main interface class to a read/write table.
Definition: Table.h:153
casacore::Float lastUT_p
Definition: ATCAFiller.h:249
casacore::Bool listHeader_p
Definition: ATCAFiller.h:198
casacore::MeasurementSet atms_p
Data.
Definition: ATCAFiller.h:175
ATCAFiller & tsysSmooth(casacore::Int window=9)
casacore::Smooth Tsys values with running median and recalibrate the data.
casacore::Matrix< casacore::Float > pointingCorr_p
Definition: ATCAFiller.h:241
void rfiFlag(casacore::Matrix< casacore::Bool > &flags)
casacore::String atcaPosToStation(casacore::Vector< casacore::Double > &xyz)
ATCAFiller & fields(const casacore::Vector< casacore::String > &fieldList)
Select a number of fields by name.
casacore::Bool gotAN_p
Bools.
Definition: ATCAFiller.h:192
casacore::Vector< casacore::String > rpfitsFiles_p
Filenames.
Definition: ATCAFiller.h:179
casacore::Bool init_p
Definition: ATCAFiller.h:207
casacore::Bool skipData_p
Definition: ATCAFiller.h:196
casacore::Bool selected(casacore::Int ifNum)
casacore::Bool checkCABB(const casacore::String &rpfitsname)
casacore::Double firstTime_p
Definition: ATCAFiller.h:262
casacore::Int scanNo_p
#scanheaders stored, index into casacore::MS SpW and Field Tables for current data ...
Definition: ATCAFiller.h:189
casacore::Float w
Definition: ATCAFiller.h:214
casacore::Int baseline
Definition: ATCAFiller.h:213
casacore::Double prevTime_p
Definition: ATCAFiller.h:279
static casacore::MeasurementSet makeTable(const casacore::String &tableName, casacore::Bool compress, casacore::Bool cabb)
make the ATCA specific MeasurementSet
casacore::Vector< casacore::Int > flagCount_p
Definition: ATCAFiller.h:284
ostream-like interface to creating log messages.
Definition: LogIO.h:167
TableExprNode mjd(const TableExprNode &node)
Definition: ExprNode.h:1464
casacore::Int nField_p
Definition: ATCAFiller.h:187
ATCAFiller & xyPhaseSmooth(casacore::Int window=9, casacore::Double tolerance=10.0)
casacore::Smooth xy-phases with running median and flag data with discrepant xy-phase.
casacore::Int nAnt_p
The following should be constant throughout the rpfits file.
Definition: ATCAFiller.h:184
casacore::Vector< casacore::Int > spws_p
Definition: ATCAFiller.h:263
casacore::Bool samplerFlag(casacore::Int row, casacore::Double posNegTolerance=3.0, casacore::Double zeroTolerance=0.5)
Flag data if samplerstats are bad.
ATCAFiller()
Construct the ATCAFiller.
casacore::ScalarColumn< casacore::String > colScanInfoCoordType
Definition: ATCAFiller.h:237
casacore::TiledDataStManAccessor sigmaAccessor_p
Definition: ATCAFiller.h:217
casacore::Vector< casacore::Double > opacities(casacore::Vector< casacore::Double > fGHz, casacore::Float tempK, casacore::Float humi, casacore::Float press, casacore::Float height)
Calculate zenith opacities using the ASAP/Miriad model given surface weather conditions and observato...
Options options
casacore::Float shadow_p
Check for shadowing.
Definition: ATCAFiller.h:275
casacore::String sources_p
Track sources.
Definition: ATCAFiller.h:268
casacore::Bool autoFlag_p
Flagging.
Definition: ATCAFiller.h:282
static casacore::TableDesc atcaTableDesc(casacore::Bool compress)
return the ATCA required tabledesc, this is the standard MeasurementSet plus ATCA specific additions...
casacore::Double windowWidth_p
Definition: ATCAFiller.h:259
casacore::TiledDataStManAccessor flagAccessor_p
Definition: ATCAFiller.h:217
casacore::Bool noxycorr_p
Definition: ATCAFiller.h:203
casacore::ScalarColumn< casacore::Float > colWeatherSeeMonPhase
Definition: ATCAFiller.h:225
casacore::TiledDataStManAccessor dataAccessor_p
storage manager accessor
Definition: ATCAFiller.h:217
void list()
casacore::List the file on cout
casacore::Float v
Definition: ATCAFiller.h:214
casacore::String currentFile_p
Definition: ATCAFiller.h:181
casacore::Bool birdie_p
Definition: ATCAFiller.h:201
static void makeSubTables(casacore::MS &ms, casacore::Table::TableOption option, casacore::Bool cabb)
make the subtables with ATCA specific additions
casacore::Int nsources_p
Definition: ATCAFiller.h:269
casacore::ScalarColumn< casacore::Bool > colScanInfoLineMode
Definition: ATCAFiller.h:239
casacore::ScalarColumn< casacore::Int > colScanInfoCacal
Definition: ATCAFiller.h:233
casacore::ScalarColumn< casacore::Float > colWeatherSeeMonRMS
Definition: ATCAFiller.h:225
casacore::Int lastSpWId_p
Definition: ATCAFiller.h:250
ATCAFiller & shadow(casacore::Float diam)
Set shadowing limit.
casacore::Int lastScan_p
Definition: ATCAFiller.h:260
void storeHeader(Bool last=False)
When storing header items skip irrelevant items for the last (empty) scan, it is just there to captur...
casacore::Int prev_fieldId_p
Definition: ATCAFiller.h:189
double Double
Definition: aipstype.h:55
casacore::ArrayColumn< casacore::Float > colSamplerStatsZero
Definition: ATCAFiller.h:228
casacore::Int flg
Definition: ATCAFiller.h:213
ATCAFiller & numChan1(casacore::Int numchan1)
Select on number of channels of IF 1.
void fillMeasureReferences()
casacore::Bool open(const casacore::String &msName, const casacore::Vector< casacore::String > &rpfitsFiles, const casacore::Vector< casacore::String > &options, casacore::Int opcor=2)
Open the measurement set and one or more RPFits files.
casacore::Bool skipScan_p
Definition: ATCAFiller.h:195
ATCAFiller & scanRange(casacore::Int firstScan, casacore::Int lastScan=0)
Select a range of scans to read.
casacore::Int nRowCache_p
Definition: ATCAFiller.h:278
casacore::Bool hires_p
Definition: ATCAFiller.h:206
casacore::ArrayColumn< casacore::Float > colSamplerStatsNeg
Definition: ATCAFiller.h:228
casacore::Table msScanInfo_p
Definition: ATCAFiller.h:240
ATCAFiller & timeRange(casacore::Double firstTime, casacore::Double lastTime=0)
casacore::Time range selection.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Bool reweight_p
Definition: ATCAFiller.h:202
casacore::Bool firstHeader_p
Definition: ATCAFiller.h:197
casacore::Double lowFreq_p
Definition: ATCAFiller.h:257
casacore::Bool appendMode_p
Definition: ATCAFiller.h:193
casacore::ScalarColumn< casacore::Int > colScanInfoSpWId
Definition: ATCAFiller.h:233
casacore::ScalarColumn< casacore::Float > colXYAmplitude
Definition: ATCAFiller.h:225
void checkObservation()
casacore::Bool cabb_p
Definition: ATCAFiller.h:208
casacore::ArrayColumn< casacore::Float > colScanInfoSubreflector
Definition: ATCAFiller.h:236
casacore::Int nSpW_p
Definition: ATCAFiller.h:187
casacore::Int numChan1_p
Definition: ATCAFiller.h:264
casacore::Bool eof_p
Definition: ATCAFiller.h:200
ATCAFiller & operator=(const ATCAFiller &)
casacore::Bool gotSysCalId_p
Definition: ATCAFiller.h:251
casacore::Int fieldId_p
Definition: ATCAFiller.h:189
float Float
Definition: aipstype.h:54
casacore::Vector< casacore::Int > antennas_p
Definition: ATCAFiller.h:265
Give access to some TiledDataStMan functions.
const Bool False
Definition: aipstype.h:44
casacore::LogIO os_p
Logger.
Definition: ATCAFiller.h:287
casacore::ScalarColumn< casacore::String > colScanInfoCorrConfig
Definition: ATCAFiller.h:237
casacore::Double highFreq_p
Definition: ATCAFiller.h:257
casacore::Int bin
Definition: ATCAFiller.h:213
A Table intended to hold astronomical data (a set of Measurements).
casacore::Vector< casacore::Int > baselines_p
Definition: ATCAFiller.h:265
void storeATCAHeader(Bool last=False)
casacore::Bool flagScanType_p
Definition: ATCAFiller.h:282
casacore::Bool storedHeader_p
Definition: ATCAFiller.h:194
casacore::Double lastTime_p
Definition: ATCAFiller.h:262
casacore::Int firstChan_p
Definition: ATCAFiller.h:261
ATCAFiller & frequencies(casacore::Vector< casacore::Double > freqs, casacore::Double windowWidth=1e6)
Select frequencies within windowWidth of specified ones.
casacore::Int obsType_p
Definition: ATCAFiller.h:205
casacore::Int if_no
Definition: ATCAFiller.h:213
casacore::ScalarColumn< casacore::Float > colTrackErrMax
Definition: ATCAFiller.h:225
casacore::Double mjd0_p
reference date
Definition: ATCAFiller.h:245
casacore::TiledDataStManAccessor corrDataAccessor_p
Definition: ATCAFiller.h:219
casacore::ArrayColumn< casacore::Float > colSDO
Definition: ATCAFiller.h:230
casacore::TiledDataStManAccessor flagCatAccessor_p
Definition: ATCAFiller.h:217
void init()
for constructors
casacore::ScalarColumn< casacore::Int > colSamplerBits
Definition: ATCAFiller.h:227
casacore::Bool fill1(const casacore::String &rpfitsname)
fill a single input file
casacore::Float ut
Definition: ATCAFiller.h:214
casacore::uInt fileSize_p
Definition: ATCAFiller.h:199
A class to provide easy read-write access to MeasurementSet columns.
Definition: MSColumns.h:221
casacore::ScalarColumn< casacore::Int > colSysCalIdAnt2
Definition: ATCAFiller.h:224
casacore::Int firstScan_p
Definition: ATCAFiller.h:260
casacore::TiledDataStManAccessor imWtAccessor_p
Definition: ATCAFiller.h:219
casacore::Vector< casacore::Double > freqs_p
Definition: ATCAFiller.h:258
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Int bandWidth1_p
Definition: ATCAFiller.h:264
void fillObservationTable()
casacore::Int birdChan(casacore::Double refFreq, casacore::Int refChan, casacore::Double chanSpac)
Define the structure of a Casacore table.
Definition: TableDesc.h:187
casacore::Int obsId_p
Definition: ATCAFiller.h:189
casacore::ScalarColumn< casacore::Float > colWeatherRainGauge
Definition: ATCAFiller.h:225
casacore::TiledDataStManAccessor modelDataAccessor_p
Definition: ATCAFiller.h:219
casacore::Float u
Definition: ATCAFiller.h:214
casacore::Bool newPointingCorr_p
Definition: ATCAFiller.h:242
casacore::ScalarColumn< casacore::String > colScanInfoScanType
Definition: ATCAFiller.h:237
casacore::Int sourceno
Definition: ATCAFiller.h:213
casacore::Int errCount_p
Definition: ATCAFiller.h:253
ATCAFiller & freqRange(casacore::Double lowFreq, casacore::Double highFreq=0)
Select a range of frequencies, lowFreq=0 =&gt; everything below higFreq, highFreq=0 =&gt; everything above ...
casacore::ScalarColumn< casacore::Int > colScanInfoAntId
ATCA_SCAN_INFO columns &amp; table.
Definition: ATCAFiller.h:233
casacore::Float edge_p
Definition: ATCAFiller.h:276
ATCAFiller & freqSel(const casacore::Vector< casacore::Int > &spws)
Select the Freq (which one of the simult.
casacore::ScalarColumn< casacore::Int > colSysCalIdAnt1
Column objects to access Tables.
Definition: ATCAFiller.h:224
casacore::ArrayColumn< casacore::Int > colScanInfoFine
Definition: ATCAFiller.h:235
casacore::ArrayColumn< casacore::Int > colScanInfommAtt
Definition: ATCAFiller.h:235
ATCAFiller & chanRange(casacore::Int firstChan, casacore::Int lastChan, casacore::Int ChanInc=1)
Select range of channels, with optional increment.
casacore::Int nScan_p
Number of scans seen; #SpWs, #fields stored sofar.
Definition: ATCAFiller.h:187
casacore::Matrix< casacore::Int > corrIndex_p
Polarization order.
Definition: ATCAFiller.h:272
casacore::Vector< casacore::Int > sysCalId_p
variables to keep the state of the sysCal search &amp; binning state
Definition: ATCAFiller.h:248
casacore::Bool noac_p
Definition: ATCAFiller.h:204
casacore::ArrayColumn< casacore::Float > colCalJy
Definition: ATCAFiller.h:230
unsigned int uInt
Definition: aipstype.h:51
casacore::ScalarColumn< casacore::Float > colTrackErrRMS
Definition: ATCAFiller.h:225
TableOption
Define the possible options how a table can be opened.
Definition: Table.h:168
casacore::Int opcor_p
Definition: ATCAFiller.h:180