CalSet.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 #ifndef CALTABLES_CALSET_H
00029 #define CALTABLES_CALSET_H
00030 #include <casa/aips.h>
00031 #include <casa/BasicSL/Constants.h>
00032 #include <casa/BasicSL/Complex.h>
00033 #include <casa/Arrays.h>
00034 #include <casa/OS/File.h>
00035 #include <casa/Logging/LogMessage.h>
00036 #include <casa/Logging/LogSink.h>
00037 #include <synthesis/CalTables/CalTableDesc2.h>
00038 #include <synthesis/CalTables/CalTable2.h>
00039 #include <synthesis/CalTables/SolvableCalSetMCol.h>
00040 #include <synthesis/CalTables/VisCalEnum.h>
00041
00042
00043
00044
00045
00046 namespace casa {
00047
00048
00049 template<class T>
00050 class CalSet
00051 {
00052 public:
00053
00054
00055 CalSet() {};
00056
00057
00058
00059 CalSet(const Int& nSpw);
00060
00061
00062 CalSet(const Int& nSpw,
00063 const Int& nPar,
00064 const Vector<Int>& nChan,
00065 const Int& nElem,
00066 const Vector<Int>& nTime);
00067
00068
00069
00070
00071
00072 CalSet(const String& calTableName,
00073 const String& select,
00074 const Int& nSpw,
00075 const Int& nPar,
00076 const Int& nElem);
00077
00078
00079 CalSet(const CalSet& other);
00080
00081
00082
00083
00084
00085 virtual ~CalSet();
00086
00087
00088 void resize(const Int& nPar,
00089 const Vector<Int>& nChan,
00090 const Int& nElem,
00091 const Vector<Int>& nTime);
00092
00093
00094 Int& nSpw() { return nSpw_; };
00095 Int& nPar() { return nPar_; };
00096 Vector<Int>& nChan() { return nChan_; };
00097 Int& nChan(const Int& spw) { return nChan_(spw); };
00098 Int& nElem() { return nElem_; };
00099 Vector<Int>& nTime() { return nTime_; };
00100 Int& nTime(const Int& spw) { return nTime_(spw); };
00101
00102
00103 IPosition shape(const Int& spw) { return IPosition(4,nPar_,nChan_(spw),nElem_,nTime_(spw)); };
00104
00105
00106 inline void setSpwOK() { spwOK_ = (nTime()!=0); };
00107
00108
00109 Vector<Bool> spwOK() { return spwOK_; };
00110
00111
00112 Vector<Double>& frequencies(const Int& spw) { return *freq_[spw]; };
00113
00114
00115 void setStartChan(const Vector<Int>& startChan) {startChan_ = startChan;};
00116 Vector<Int>& startChan() {return startChan_;};
00117
00118
00119 Vector<Double>& startTime(const Int& spw) { return *MJDStart_[spw]; };
00120 Vector<Double>& stopTime(const Int& spw) { return *MJDStop_[spw]; };
00121 Vector<Double>& time(const Int& spw) { return *MJDTimeStamp_[spw]; };
00122 Vector<Int>& fieldId(const Int& spw) { return *fieldId_[spw]; };
00123 Vector<String>& fieldName(const Int& spw) { return *fieldName_[spw]; };
00124 Vector<String>& sourceName(const Int& spw) { return *sourceName_[spw]; };
00125 Array<T>& par(const Int& spw) { return *par_[spw]; };
00126 Array<Bool>& parOK(const Int& spw) { return *parOK_[spw]; };
00127 Array<Float>& parErr(const Int& spw) { return *parErr_[spw]; };
00128 Array<Float>& parSNR(const Int& spw) { return *parSNR_[spw]; };
00129
00130
00131
00132 Matrix<Float>& iFit(const Int& spw) { return *iFit_[spw]; };
00133 Matrix<Float>& iFitwt(const Int& spw) { return *iFitwt_[spw]; };
00134 Vector<Bool>& solutionOK(const Int& spw) { return *solutionOK_[spw]; };
00135 Vector<Float>& fit(const Int& spw) { return *fit_[spw]; };
00136 Vector<Float>& fitwt(const Int& spw) { return *fitwt_[spw]; };
00137
00138
00139
00140 virtual void initCalTableDesc(const String& type, const Int& parType);
00141 virtual void attach();
00142 virtual void store(const String& file, const String& type, const Bool& append,
00143 const String& msname="");
00144
00145
00146 virtual void load(const String& file, const String& select);
00147
00148 protected:
00149
00150
00151 private:
00152
00153
00154 void inflate();
00155 void deflate();
00156
00157
00158
00159 String calTableName_;
00160
00161
00162 Int nSpw_;
00163
00164
00165 Int nPar_;
00166
00167
00168 Vector<Int> nChan_;
00169
00170
00171 Int nElem_;
00172
00173
00174 Vector<Int> nTime_;
00175
00176
00177 Vector<Bool> spwOK_;
00178
00179
00180 Vector<Int> startChan_;
00181 PtrBlock<Vector<Double>*> freq_;
00182
00183
00184 PtrBlock<Vector<Double>*> MJDStart_;
00185 PtrBlock<Vector<Double>*> MJDStop_;
00186 PtrBlock<Vector<Double>*> MJDTimeStamp_;
00187 PtrBlock<Vector<Int>*> fieldId_;
00188 PtrBlock<Vector<String>*> fieldName_;
00189 PtrBlock<Vector<String>*> sourceName_;
00190
00191
00192 PtrBlock<Array<T>*> par_;
00193 PtrBlock<Array<Bool>*> parOK_;
00194 PtrBlock<Array<Float>*> parErr_;
00195 PtrBlock<Array<Float>*> parSNR_;
00196
00197
00198
00199 PtrBlock<Matrix<Float>*> iFit_;
00200 PtrBlock<Matrix<Float>*> iFitwt_;
00201
00202 PtrBlock<Vector<Bool>*> solutionOK_;
00203 PtrBlock<Vector<Float>*> fit_;
00204 PtrBlock<Vector<Float>*> fitwt_;
00205
00206 LogSink logSink_p;
00207 LogSink& logSink() {return logSink_p;};
00208
00209 CalTableDesc2 *calTabDesc_;
00210 CalTable2 *calTab_;
00211 SolvableCalSetMCol<T> *svjmcol_;
00212
00213 };
00214
00215
00216
00217
00218 void smooth(CalSet<Complex>& cs,
00219 const String& smtype,
00220 const Double& smtime,
00221 Vector<Int> selfields);
00222
00223 }
00224
00225 #ifndef AIPS_NO_TEMPLATE_SRC
00226 #include <synthesis/CalTables/CalSet.tcc>
00227 #endif
00228
00229 #endif