MSConcat.h
Go to the documentation of this file.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 MS_MSCONCAT_H
00030 #define MS_MSCONCAT_H
00031
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/ms/MeasurementSets/MSColumns.h>
00034 #include <casacore/ms/MeasurementSets/MeasurementSet.h>
00035 #include <casacore/casa/Arrays/IPosition.h>
00036
00037 namespace casacore {
00038
00039 class TableDesc;
00040 class ROMSMainColumns;
00041 class ROMSDataDescColumns;
00042 class ROMSSpWindowColumns;
00043 class ROMSPolarizationColumns;
00044 class MSAntenna;
00045 class MSDataDescription;
00046 class MSFeed;
00047 class MSField;
00048 class MSPolarization;
00049 class MSSpectralWindow;
00050 template <class T> class Block;
00051
00052
00053
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 class MSConcat: public MSColumns
00094 {
00095 public:
00096 MSConcat(MeasurementSet& ms);
00097
00098 void virtualconcat(MeasurementSet& otherMS,
00099 const Bool checkShapeAndCateg=True,
00100 const String& obsidAndScanTableName="");
00101
00102 void concatenate(const MeasurementSet& otherMS,
00103 const uInt handling=0,
00104
00105
00106
00107 const String& destMSName="");
00108
00109 void setTolerance(Quantum<Double>& freqTol, Quantum<Double>& dirTol);
00110 void setWeightScale(const Float weightScale);
00111 void setRespectForFieldName(const Bool respectFieldName);
00112
00113
00114 private:
00115 MSConcat();
00116 static IPosition isFixedShape(const TableDesc& td);
00117 static IPosition getShape(const ROMSDataDescColumns& ddCols,
00118 const ROMSSpWindowColumns& spwCols,
00119 const ROMSPolarizationColumns& polCols,
00120 uInt whichShape);
00121 void checkShape(const IPosition& otherShape) const;
00122 void checkCategories(const ROMSMainColumns& otherCols) const;
00123 Bool checkEphIdInField(const ROMSFieldColumns& otherFldCol) const;
00124 Bool copyPointing(const MSPointing& otherPoint, const Block<uInt>& newAntIndices);
00125 Bool copyPointingB(MSPointing& otherPoint, const Block<uInt>& newAntIndices);
00126 Int copyObservation(const MSObservation& otherObs, const Bool remRedunObsId=True);
00127
00128 Block<uInt> copyAntennaAndFeed(const MSAntenna& otherAnt,
00129 const MSFeed& otherFeed);
00130 Block<uInt> copyState(const MSState& otherState);
00131 Block<uInt> copyField(const MeasurementSet& otherms);
00132 Block<uInt> copySpwAndPol(const MSSpectralWindow& otherSpw,
00133 const MSPolarization& otherPol,
00134 const MSDataDescription& otherDD);
00135 Bool copySource(const MeasurementSet& otherms);
00136 Bool updateSource();
00137 Bool updateSource2();
00138 Bool sourceRowsEquivalent(const MSSourceColumns& sourceCol,
00139 const uInt& rowi, const uInt& rowj,
00140 const Bool dontTestDirection=False,
00141 const Bool dontTestTransAndRest=False);
00142
00143 Bool obsRowsEquivalent(const MSObservationColumns& obsCol,
00144 const uInt& rowi, const uInt& rowj);
00145
00146
00147 void updateModelDataKeywords(MeasurementSet& ms);
00148
00149 MeasurementSet itsMS;
00150 IPosition itsFixedShape;
00151 Quantum<Double> itsFreqTol;
00152 Quantum<Double> itsDirTol;
00153 Float itsWeightScale;
00154 Bool itsRespectForFieldName;
00155 Vector<Bool> itsChanReversed;
00156 SimpleOrderedMap <Int, Int> newSourceIndex_p;
00157 SimpleOrderedMap <Int, Int> newSourceIndex2_p;
00158 SimpleOrderedMap <Int, Int> newSPWIndex_p;
00159 SimpleOrderedMap <Int, Int> newObsIndexA_p;
00160 SimpleOrderedMap <Int, Int> newObsIndexB_p;
00161 SimpleOrderedMap <Int, Int> otherObsIdsWithCounterpart_p;
00162 SimpleOrderedMap <Int, Int> solSystObjects_p;
00163
00164 Bool doSource_p;
00165 Bool doSource2_p;
00166 Bool doSPW_p;
00167 Bool doObsA_p;
00168 Bool doObsB_p;
00169
00170 };
00171
00172 template<class T>
00173 Bool areEQ(const ROScalarColumn<T>& col, uInt row_i, uInt row_j)
00174 {
00175 T value_i, value_j;
00176 col.get(row_i, value_i);
00177 col.get(row_j, value_j);
00178 return (value_i == value_j);
00179 }
00180
00181 template<class T>
00182 Bool areEQ(const ROArrayColumn<T>& col, uInt row_i, uInt row_j)
00183 {
00184 Bool rval(False);
00185 Array<T> arr_i;
00186 Array<T> arr_j;
00187
00188 col.get(row_i, arr_i, True);
00189 col.get(row_j, arr_j, True);
00190 Int ni = arr_i.nelements();
00191 Int nj = arr_j.nelements();
00192 if( (ni==0 && nj==0) ||
00193 allEQ(arr_i, arr_j)){
00194 rval = True;
00195 }
00196 return rval;
00197 }
00198
00199
00200
00201 }
00202
00203 #endif
00204
00205
00206