00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef CALIBRATION_NEWCALTABLE_H
00030 #define CALIBRATION_NEWCALTABLE_H
00031
00032 #include <casa/aips.h>
00033 #include <tables/Tables/Table.h>
00034 #include <tables/TaQL/ExprNode.h>
00035 #include <casa/Containers/Record.h>
00036 #include <casa/OS/Path.h>
00037 #include <casa/Utilities/Sort.h>
00038 #include <ms/MeasurementSets/MSObservation.h>
00039 #include <ms/MeasurementSets/MSAntenna.h>
00040 #include <ms/MeasurementSets/MSField.h>
00041 #include <ms/MeasurementSets/MSSpectralWindow.h>
00042 #include <ms/MeasurementSets/MSHistory.h>
00043 #include <ms/MeasurementSets/MSObsColumns.h>
00044 #include <ms/MeasurementSets/MSAntennaColumns.h>
00045 #include <ms/MeasurementSets/MSFieldColumns.h>
00046 #include <ms/MeasurementSets/MSSpWindowColumns.h>
00047 #include <ms/MeasurementSets/MSHistoryColumns.h>
00048 #include <synthesis/CalTables/CTDesc.h>
00049 #include <synthesis/CalTables/CTMainRecord.h>
00050 #include <synthesis/CalTables/CTMainColumns.h>
00051 #include <synthesis/CalTables/VisCalEnum.h>
00052
00053 namespace casa {
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 typedef MSField CTField;
00094 typedef MSObservation CTObservation;
00095 typedef MSAntenna CTAntenna;
00096 typedef MSSpectralWindow CTSpectralWindow;
00097 typedef MSHistory CTHistory;
00098 typedef MSFieldColumns CTFieldColumns;
00099 typedef MSObservationColumns CTObservationColumns;
00100 typedef MSAntennaColumns CTAntennaColumns;
00101 typedef MSSpWindowColumns CTSpWindowColumns;
00102 typedef MSHistoryColumns CTHistoryColumns;
00103 typedef ROMSFieldColumns ROCTFieldColumns;
00104 typedef ROMSObservationColumns ROCTObservationColumns;
00105 typedef ROMSAntennaColumns ROCTAntennaColumns;
00106 typedef ROMSSpWindowColumns ROCTSpWindowColumns;
00107 typedef ROMSHistoryColumns ROCTHistoryColumns;
00108
00109 class NewCalTable : public Table
00110 {
00111
00112 friend class SolvableVisCal;
00113
00114 public:
00115
00116 NewCalTable();
00117 virtual ~NewCalTable();
00118
00119
00120
00121 NewCalTable (const String& tableName, CTDesc& ctableDesc,
00122 Table::TableOption access = Table::New,
00123 Table::TableType ttype = Table::Plain);
00124
00125
00126 NewCalTable (SetupNewTable& newTab, uInt nrow = 0, Bool initialize = False);
00127
00128
00129 NewCalTable(String tableName,VisCalEnum::VCParType parType,
00130 String typeName,String msName,Bool doSingleChan);
00131
00132
00133
00134 NewCalTable (const String& tableName,
00135 Table::TableOption access = Table::Old,
00136 Table::TableType ttype = Table::Memory);
00137
00138 static NewCalTable createCT(const String& tableName,
00139 Table::TableOption access,
00140 Table::TableType ttype,
00141 Bool doBackCompat=True);
00142
00143 static NewCalTable* createCTptr(const String& tableName,
00144 Table::TableOption access,
00145 Table::TableType ttype,
00146 Bool doBackCompat=True);
00147
00148
00149
00150
00151 NewCalTable (const Table& table);
00152
00153
00154 NewCalTable (const NewCalTable& other);
00155
00156
00157
00158 NewCalTable(String tableName,String CorF,
00159 Int nObs=1, Int nScanPerObs=1,Int nTimePerScan=1,
00160 Int nAnt=1, Int nSpw=1, Vector<Int> nChan=Vector<Int>(1,1),
00161 Int nFld=1,
00162 Double rTime=0.0, Double tint=0.0,
00163 Bool disk=False, Bool verbose=False);
00164
00165
00166 NewCalTable& operator= (const NewCalTable& other);
00167
00168
00169 static Bool CTBackCompat(const String& caltable);
00170
00171
00172 void setTableInfo();
00173
00174
00175 void createSubTables();
00176 void attachSubTables();
00177 void clearSubtables();
00178
00179 void copyMemCalSubtables(const NewCalTable& other);
00180 void copyMemCalSubtable(const Table& otherSubtable, Table& subTable);
00181
00182
00183 Bool isComplex();
00184
00185
00186 String polBasis();
00187
00188
00189 Record getRowMain (const Int& jrow);
00190
00191
00192 void putRowMain (const Int& jrow, CTMainRecord& tableRec);
00193
00194
00195
00196
00197
00198 void setMetaInfo (const String& msName);
00199
00200
00201 static Bool conformant(const TableDesc& tabDesc);
00202
00203
00204 void writeToDisk(const String& tableName);
00205
00206 CTObservation& observation() {return observation_p;}
00207 CTAntenna& antenna() {return antenna_p;}
00208 CTField& field() {return field_p;}
00209 CTSpectralWindow& spectralWindow() {return spectralWindow_p;}
00210 CTHistory& history() {return history_p;}
00211 const CTObservation& observation() const {return observation_p;}
00212 const CTAntenna& antenna() const {return antenna_p;}
00213 const CTField& field() const {return field_p;}
00214 const CTSpectralWindow& spectralWindow() const {return spectralWindow_p;}
00215 const CTHistory& history() const {return history_p;}
00216
00217
00218
00219
00220 static Complex NCTtestvalueC(Int iant,Int ispw,Double ich,Double time,Double refTime,Double tint);
00221 static Float NCTtestvalueF(Int iant,Int ispw,Double ich,Double time,Double refTime,Double tint);
00222
00223
00224
00225 void fillAntBasedMainRows(uInt nrows,
00226 Double time,Double interval,
00227 Int fieldId,uInt spwId,Int scanNo,
00228 const Vector<Int>& ant1list, Int refant,
00229 const Cube<Complex>& cparam,
00230 const Cube<Bool>& flag,
00231 const Cube<Float>& paramErr,
00232 const Cube<Float>& snr);
00233 void fillAntBasedMainRows(uInt nrows,
00234 Double time,Double interval,
00235 Int fieldId,uInt spwId,Int obsId,Int scanNo,
00236 const Vector<Int>& ant1list, Int refant,
00237 const Cube<Complex>& cparam,
00238 const Cube<Bool>& flag,
00239 const Cube<Float>& paramErr,
00240 const Cube<Float>& snr);
00241
00242
00243 void setSpwFreqs(Int spw, const Vector<Double>& freq,
00244 const Vector<Double>& chanwidth=Vector<Double>());
00245
00246
00247 void flagAbsentSpws();
00248
00249
00250 void mergeSpwMetaInfo(const NewCalTable& other);
00251
00252
00253 void addHistoryMessage(String app="",String message="none");
00254
00255 private:
00256
00257
00258
00259 void fillGenericContents(Int nObs=1, Int nScanPerObs=1, Int nTimePerScan=1,
00260 Int nAnt=1, Int nSpw=1, Vector<Int> nChan=Vector<Int>(1,1),
00261 Int nFld=1,
00262 Double rTime=0.0, Double tint=0.0,
00263 Bool verbose=False);
00264 void fillGenericObs(Int nObs);
00265 void fillGenericField(Int nFld);
00266 void fillGenericAntenna(Int nAnt);
00267 void fillGenericSpw(Int nSpw,Vector<Int>& nChan);
00268
00269
00270
00271 void makeSpwSingleChan();
00272
00273
00274
00275 void addPhoneyObs();
00276
00277
00278 void handleEphObj(const MSField& msfldtab,const String& msName);
00279
00280
00281
00282 CTObservation observation_p;
00283 CTAntenna antenna_p;
00284 CTField field_p;
00285 CTSpectralWindow spectralWindow_p;
00286 CTHistory history_p;
00287
00288 };
00289
00290 }
00291
00292 #endif