LJJones.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 SYNTHESIS_LJJONES_H
00029 #define SYNTHESIS_LJJONES_H
00030
00031 #include <casa/aips.h>
00032 #include <casa/Containers/Record.h>
00033 #include <casa/BasicSL/Complex.h>
00034 #include <synthesis/MeasurementComponents/SolvableVisCal.h>
00035
00036 #include <synthesis/TransformMachines/GridFT.h>
00037 #include <ms/MeasurementSets/MeasurementSet.h>
00038 #include <images/Images/PagedImage.h>
00039 #include <images/Images/ImageInterface.h>
00040 #include <images/Images/ImageInfo.h>
00041 #include <synthesis/TransformMachines/StokesImageUtil.h>
00042 #include <msvis/MSVis/VisSet.h>
00043 #include <synthesis/CalTables/CalSet.h>
00044 #include <casa/OS/Timer.h>
00045 #include <msvis/MSVis/VisBuffAccumulator.h>
00046 namespace casa {
00047
00048
00049 class VisEquation;
00050 class nPBWProjectFT;
00051
00052
00053
00054
00055
00056 class LJJones : public SolvableVisJones {
00057 public:
00058
00059
00060 LJJones(VisSet& vs);
00061
00062 LJJones(VisSet& vs, MeasurementSet& ms);
00063
00064
00065 virtual ~LJJones();
00066
00067
00068 virtual Type type() { return VisCal::E; };
00069
00070
00071 virtual String typeName() { return "LJ Jones"; };
00072 virtual String longTypeName() { return "LeakyJ Jones"; };
00073
00074 virtual Bool freqDepPar() { return False; };
00075
00076
00077 Jones::JonesType jonesType() { return Jones::General; };
00078
00079 virtual VisCalEnum::VCParType parType() { return setParType(VisCalEnum::COMPLEX);};
00080
00081
00082 Cube<Complex>& loadPar();
00083
00084 virtual void setModel(const String& modelImage);
00085
00086 virtual void setSolve();
00087 virtual void setSolve(const Record& solve);
00088 virtual void setNiter(const Int& niter) {niter_p=niter;}
00089 virtual void setTolerance(const Float& tol) {tolerance_p = tol;}
00090 virtual void setGain(const Float& gain) {gain_p = gain;}
00091
00092
00093 using SolvableVisCal::setApply;
00094 virtual void setApply(const Record& applypar);
00095
00096
00097 virtual void applyCal(VisBuffer& vb,
00098 Cube<Complex>& Mout);
00099
00100
00101
00102
00103
00104
00105 virtual void differentiate(VisBuffer& vb,
00106 Cube<Complex>& Mout,
00107 Array<Complex>& dMout,
00108 Matrix<Bool>& Mflg);
00109
00110 virtual void differentiate(VisBuffer& vb,
00111 VisBuffer& dvb0,
00112 VisBuffer& dvb1,
00113 Matrix<Bool>& Mflg);
00114
00115
00116
00117 virtual void diffResiduals(VisIter& vi, VisEquation& ve,
00118 VisBuffer& residuals,
00119 VisBuffer& dVr1,
00120 VisBuffer& dVr2,
00121 Matrix<Bool>& flags);
00122
00123 virtual void guessPar(VisBuffer& vb);
00124 virtual void guessPar() {pointPar_=0;}
00125
00126 virtual Cube<Complex>& solvePar() {return pointPar_;}
00127 virtual void setRPar(Cube<Complex>& val) {pointPar_.resize(val.shape());pointPar_=val;}
00128 virtual void setRPar(Double val) {pointPar_=val;}
00129
00130
00131
00132 virtual Bool normalizable() { return False; };
00133
00134
00135 virtual void keep(const Int& slot);
00136
00137 inline virtual CalSet<Complex>& cs() {return *cs_;};
00138
00139 virtual void inflate(const Vector<Int>& nChan,
00140 const Vector<Int>& startChan,
00141 const Vector<Int>& nSlot);
00142 void initSolve(VisSet& vs);
00143 void initSolvePar();
00144 void store();
00145 void store(const String& table,const Bool& append);
00146 Bool verifyForSolve(VisBuffer& vb);
00147 virtual void postSolveMassage(const VisBuffer&);
00148 virtual void selfGatherAndSolve(VisSet& vs,VisEquation& ve);
00149 virtual Bool useGenericGatherForSolve() { return False; };
00150 virtual Float printFraction(const Int& ) {return 0.1;};
00151 Array<Complex> getOffsets(const Int& spw) {return cs().par(spw);}
00152 Array<Double> getTime(const Int& spw) {return cs().time(spw);}
00153 void nearest(const Double time, Array<Complex>& vals);
00154 void printRPar();
00155
00156 void setByPassMode(Int& b) {byPass_p = b;}
00157 void getAvgVB(VisIter& vi, VisEquation& ve, VisBuffer& vb);
00158 protected:
00159
00160
00161 virtual Int nPar() { return 4; };
00162
00163
00164 virtual Bool trivialJonesElem() { return False; };
00165
00166
00167
00168 virtual void makeComplexGrid(TempImage<Complex>& Grid,
00169 PagedImage<Float>& ModelImage,
00170 VisBuffer& vb);
00171 void printActivity(const Int slotNo, const Int fieldId, const Int spw, const Int nSolutions);
00172
00173
00174 void reformVisibilities(const VisBuffer& vb, const Int whichChan, const Int whichPol,
00175 Array<Complex>& visArray, Array<Float>& visWts);
00176
00177 Int getRefAnt(const Array<Float>& visWts);
00178 private:
00179
00180
00181 Cube<Complex> pointPar_;
00182 GridFT *pbwp_p;
00183 MeasurementSet *ms_p;
00184 VisSet *vs_p;
00185
00186 TempImage<Complex> targetVisModel_;
00187 CalSet<Complex> *cs_;
00188 Double maxTimePerSolution, minTimePerSolution, avgTimePerSolution;
00189 Timer timer;
00190 Vector<Int> polMap_p;
00191 Float tolerance_p, gain_p;
00192 Int niter_p,byPass_p;
00193 String modelImageName_p;
00194 };
00195
00196
00197
00198
00199
00200 }
00201
00202 #endif
00203