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_SOLVABLEVISCAL_H
00029 #define SYNTHESIS_SOLVABLEVISCAL_H
00030
00031 #include <casa/aips.h>
00032 #include <casa/Containers/Record.h>
00033 #include <casa/BasicSL/Complex.h>
00034 #include <casa/BasicSL/Constants.h>
00035 #include <synthesis/MeasurementComponents/VisCal.h>
00036 #include <synthesis/MeasurementComponents/CalCorruptor.h>
00037 #include <synthesis/MeasurementComponents/Mueller.h>
00038 #include <synthesis/MeasurementComponents/Jones.h>
00039 #include <synthesis/MeasurementComponents/VisVector.h>
00040 #include <synthesis/TransformMachines/SynthesisError.h>
00041 #include <synthesis/CalTables/NewCalTable.h>
00042 #include <synthesis/CalTables/CLPatchPanel.h>
00043 #include <synthesis/CalTables/CTPatchedInterp.h>
00044 #include <synthesis/CalTables/CalSetMetaInfo.h>
00045 #include <synthesis/CalTables/VisCalEnum.h>
00046 #include <msvis/MSVis/VisSet.h>
00047 #include <msvis/MSVis/CalVisBuffer.h>
00048 #include <msvis/MSVis/VisBuffGroupAcc.h>
00049
00050 #include <casa/Logging/LogMessage.h>
00051 #include <casa/Logging/LogSink.h>
00052 #include <casa/Logging/LogIO.h>
00053 #include <casa/OS/Timer.h>
00054 #include <casadbus/plotserver/PlotServerProxy.h>
00055 #include <casadbus/utilities/BusAccess.h>
00056 #include <casadbus/session/DBusSession.h>
00057
00058 #include <iostream>
00059 #include <fstream>
00060
00061 namespace casa {
00062
00063
00064
00065
00066
00067
00068
00069 class VisEquation;
00070 class SolveDataBuffer;
00071 class SDBList;
00072
00073 class SolvableVisCal : virtual public VisCal {
00074 public:
00075
00076 typedef struct fluxScaleStruct {
00077 Matrix<Double> fd;
00078 Matrix<Double> fderr;
00079 Matrix<Int> numSol;
00080 Vector<Double> freq;
00081 Matrix<Double> spidx;
00082 Matrix<Double> spidxerr;
00083 Vector<Double> fitfd;
00084 Vector<Double> fitfderr;
00085 Vector<Double> fitreffreq;
00086 } fluxScaleStruct;
00087
00088
00089 SolvableVisCal(VisSet& vs);
00090
00091 SolvableVisCal(String msname,Int MSnAnt,Int MSnSpw);
00092
00093 SolvableVisCal(const MSMetaInfoForCal& msmc);
00094
00095 SolvableVisCal(const Int& nAnt);
00096
00097 virtual ~SolvableVisCal();
00098
00099
00100 inline String& calTableName() { return calTableName_; };
00101 inline String& calTableSelect() { return calTableSelect_; };
00102 inline Bool& append() { return append_; };
00103 inline String& tInterpType() { return tInterpType_; };
00104 inline String& fInterpType() { return fInterpType_; };
00105 inline Vector<Int>& spwMap() { return spwMap_; };
00106 inline Int& refant() { return refantlist()(0); };
00107 inline Vector<Int>& refantlist() { return urefantlist_; };
00108 inline Int& minblperant() { return minblperant_; };
00109 inline String& apmode() { return apmode_; };
00110 inline String& solint() { return solint_; };
00111 inline String& fsolint() { return fsolint_; };
00112 inline Double& preavg() { return preavg_; };
00113 inline Bool& solnorm() { return solnorm_;};
00114 inline Float& minSNR() { return minSNR_; };
00115
00116 inline String& combine() { return combine_; };
00117 inline Bool combspw() { return upcase(combine_).contains("SPW"); };
00118 inline Bool combfld() { return upcase(combine_).contains("FIELD"); };
00119 inline Bool combscan() { return upcase(combine_).contains("SCAN"); };
00120 inline Bool combobs() { return upcase(combine_).contains("OBS"); };
00121
00122
00123
00124 virtual Int nTotalPar()=0;
00125
00126
00127
00128
00129
00130 virtual Bool useGenericGatherForSolve() { return True; };
00131
00132
00133
00134 virtual Bool useGenericSolveOne() { return useGenericGatherForSolve(); };
00135
00136
00137
00138 virtual Int solvePol() { return 0; };
00139
00140
00141
00142 virtual Bool normalizable()=0;
00143
00144
00145 virtual Bool accumulatable() { return False; };
00146
00147
00148 virtual Bool smoothable() { return False; };
00149
00150
00151
00152
00153
00154 virtual Bool phandonly() { return False; }
00155
00156
00157 inline Int& focusChan() { return focusChan_; };
00158
00159
00160 inline Bool isSolved() {return solved_;};
00161
00162
00163 virtual Bool isSolvable() {return True;};
00164
00165
00166 virtual void setApply();
00167 virtual void setApply(const Record& apply);
00168 virtual void setCallib(const Record& callib,const MeasurementSet& selms);
00169
00170 virtual void setModel(const String& )
00171 {throw(SynthesisError("Internal error: setModel() not yet supported for non EPJones type."));};
00172
00173
00174 virtual String applyinfo();
00175
00176
00177 virtual void setSolve();
00178 virtual void setSolve(const Record& solve);
00179
00180
00181 virtual String solveinfo();
00182
00183
00184 virtual void setAccumulate(VisSet& vs,
00185 const String& table,
00186 const String& select,
00187 const Double& t,
00188 const Int& refAnt=-1);
00189
00190
00191 virtual Complex defaultPar() { return Complex(1.0); };
00192 virtual Float defaultRPar() { return Float(0.0); };
00193 virtual Complex defaultCPar() { return Complex(1.0); };
00194
00195
00196 virtual void setSpecify(const Record& specify);
00197
00198
00199 virtual void specify(const Record& specify);
00200
00201
00202 virtual Int sizeUpSolve(VisSet& vs, Vector<Int>& nChunkPerSol);
00203
00204
00205
00206 void inflate(VisSet& vs, const Bool& fillMeta=False);
00207
00208 virtual void inflate(const Vector<Int>& nChanDat,
00209 const Vector<Int>& startChanDat,
00210 const Vector<Int>& nSlot);
00211
00212
00213
00214 virtual void guessPar(VisBuffer& vb)=0;
00215 virtual void guessPar(SDBList&) { throw(AipsError("SVC::guessPar(SDBList&) NYI!!")); };
00216
00217
00218 inline Double solTimeInterval() const { return solTimeInterval_; };
00219
00220
00221 inline Double& fintervalHz() { return fintervalHz_; };
00222 inline Double& fintervalCh() { return fintervalCh_(currSpw()); };
00223 Matrix<Int> chanAveBounds() { return chanAveBounds_(currSpw()); };
00224 Matrix<Int> chanAveBounds(Int spw) { return chanAveBounds_(spw); };
00225
00226
00227 inline virtual Cube<Complex>& solveCPar() {return (*solveCPar_[currSpw()]);};
00228 inline virtual Cube<Float>& solveRPar() {return (*solveRPar_[currSpw()]);};
00229 inline virtual Cube<Bool>& solveParOK() {return (*solveParOK_[currSpw()]);};
00230 inline virtual Cube<Float> & solveParErr() {return (*solveParErr_[currSpw()]);};
00231 inline virtual Cube<Float> & solveParSNR() {return (*solveParSNR_[currSpw()]);};
00232 inline virtual Cube<Complex>& solveAllCPar() {return (*solveAllCPar_[currSpw()]);};
00233 inline virtual Cube<Float>& solveAllRPar() {return (*solveAllRPar_[currSpw()]);};
00234 inline virtual Cube<Bool>& solveAllParOK() {return (*solveAllParOK_[currSpw()]);};
00235 inline virtual Cube<Float> & solveAllParErr() {return (*solveAllParErr_[currSpw()]);};
00236 inline virtual Cube<Float> & solveAllParSNR() {return (*solveAllParSNR_[currSpw()]);};
00237
00238
00239 inline Vector<Complex>& srcPolPar() { return srcPolPar_; };
00240
00241
00242
00243 Bool syncSolveMeta(VisBuffer& vb, const Int& fieldId);
00244 Bool syncSolveMeta(VisBuffGroupAcc& vbga);
00245 void syncSolveMeta(SDBList& sdbs);
00246
00247
00248 void overrideObsScan(Int obs, Int scan);
00249
00250
00251
00252
00253 virtual void enforceAPonData(VisBuffer& vb);
00254
00255
00256 virtual Bool verifyConstraints(VisBuffGroupAcc& vbag);
00257 virtual Bool verifyConstraints(SDBList& sdbs);
00258 virtual Bool verifyForSolve(VisBuffer& vb);
00259
00260
00261
00262
00263 virtual void selfGatherAndSolve(VisSet& vs, VisEquation& ve);
00264 virtual void selfSolveOne(VisBuffGroupAcc& vs);
00265 virtual void selfSolveOne(SDBList&) { throw(AipsError("selfSolveOne for VI2/SDB usage NYI for "+typeName())); };
00266
00267
00268 void setUpForPolSolve(VisBuffer& vb);
00269
00270
00271 virtual void differentiate(CalVisBuffer& cvb)=0;
00272 virtual void differentiate(SolveDataBuffer&) { throw(AipsError("SVC::differentiate(SDB) NYI!")); };
00273 virtual void differentiate(VisBuffer& vb,
00274 Cube<Complex>& V,
00275 Array<Complex>& dV,
00276 Matrix<Bool>& Vflg)=0;
00277 virtual void differentiate(VisBuffer& ,
00278 VisBuffer& ,
00279 VisBuffer& ,
00280 Matrix<Bool>& ){ throw(AipsError("Invalid use of differentiate(vb,dV0,dv1)")); };
00281
00282
00283
00284 virtual void diffSrc(VisBuffer& vb,
00285 Array<Complex>& dV)=0;
00286
00287
00288 virtual void updatePar(const Vector<Complex> dCalPar,const Vector<Complex> dSrcPar);
00289 virtual void updatePar(const Vector<Complex> dCalPar);
00290
00291
00292 virtual void formSolveSNR();
00293
00294
00295 virtual void applySNRThreshold();
00296
00297
00298 virtual void reReference()=0;
00299
00300
00301 virtual Record actionRec();
00302
00303
00304 virtual void accumulate(SolvableVisCal* incr,
00305 const Vector<Int>& fields)=0;
00306
00307 virtual void smooth(Vector<Int>& fields,
00308 const String& smtype,
00309 const Double& smtime);
00310
00311
00312 virtual void reportSolvedQU();
00313
00314
00315
00316 virtual void createMemCalTable();
00317 virtual void keep1(Int ichan);
00318 virtual void keepNCT();
00319 virtual void storeNCT();
00320 void storeNCT(const String& tableName,const Bool& append);
00321
00322 virtual void loadMemCalTable(String ctname,String field="");
00323
00324
00325 virtual Bool spwOK(Int ispw);
00326
00327
00328 virtual void globalPostSolveTinker();
00329
00330
00331 virtual void enforceAPonSoln();
00332
00333
00334 virtual void normalize();
00335
00336
00337 virtual void fluxscale(const String& outfile,
00338 const Vector<Int>& refFieldIn,
00339 const Vector<Int>& tranFieldIn,
00340 const Vector<Int>& inRefSpwMap,
00341 const Vector<String>& fldNames,
00342 const Float& inGainThres,
00343 const String& antSel,
00344 const String& timerangeSel,
00345 const String& scanSel,
00346 fluxScaleStruct& oFluxScaleStruct,
00347 const String& oListFile,
00348 const Bool& incremental,
00349 const Int& fitorder,
00350 const Bool& display)=0;
00351
00352
00353 inline virtual void state() { stateSVC(True); };
00354
00355 virtual VisCalEnum::VCParType setParType(VisCalEnum::VCParType type)
00356 {parType_ = type;return (VisCalEnum::VCParType)parType_;};
00357 virtual void currMetaNote();
00358
00359 virtual void listCal(const Vector<Int> ufldids, const Vector<Int> uantids,
00360 const Matrix<Int> uchanids,
00361 const String& listfile="",const Int& pagerows=50)=0;
00362
00363
00364 inline void setChanMask(PtrBlock<Vector<Bool>*>& chanmask) { chanmask_=&chanmask; };
00365 inline void clearChanMask() { chanmask_=NULL; };
00366 void applyChanMask(VisBuffer& vb);
00367
00368 virtual void printActivity(const Int nSlots, const Int slotNo,
00369 const Int fieldId, const Int spw,
00370 const Int nSolutions);
00371 virtual void markTimer() {timer_p.mark();};
00372
00373
00374
00375
00376 virtual void setSimulate(VisSet& vs, Record& simpar, Vector<Double>& solTimes);
00377
00378
00379 virtual void createCorruptor(const VisIter& vi,const Record& simpar, const int nSim);
00380
00381
00382 inline String& simint() { return simint_; };
00383
00384
00385 virtual String siminfo();
00386
00387
00388 inline Bool isSimulated() {return simulated_;};
00389
00390
00391 CalCorruptor *corruptor_p;
00392
00393
00394 Int sizeUpSim(VisSet& vs, Vector<Int>& nChunkPerSol, Vector<Double>& solTimes);
00395
00396
00397
00398
00399
00400
00401
00402 virtual void setMeta(Int obs, Int scan, Double time,
00403 Int spw, const Vector<Double>& freq,
00404 Int fld);
00405
00406
00407
00408
00409 virtual Int sizeSolveParCurrSpw(Int nVisChan);
00410
00411
00412
00413 virtual void setDefSolveParCurrSpw(Bool sync=False);
00414
00415
00416 void reParseSolintForVI2();
00417
00418
00419
00420 virtual void createMemCalTable2();
00421
00422
00423 virtual void setOrVerifyCTFrequencies(Int spw);
00424
00425
00426 protected:
00427
00428
00429 inline void setSolved(const Bool& flag) {solved_=flag;};
00430
00431
00432 virtual void initSolvePar()=0;
00433
00434
00435 inline virtual void invalidateDiffCalMat()=0;
00436
00437
00438 using VisCal::syncPar;
00439
00440
00441 virtual void setSolveChannelization(VisSet& vs);
00442
00443
00444 virtual void setFracChanAve();
00445
00446
00447
00448 void inflateNCTwithMetaData(VisSet& vs);
00449
00450
00451 void syncSolveCal();
00452
00453
00454 void syncSolvePar();
00455
00456
00457 virtual void calcPar();
00458 virtual void calcParByCLPP();
00459
00460
00461 virtual void syncDiffMat()=0;
00462
00463
00464 virtual void stateSVC(const Bool& doVC);
00465
00466
00467 void normSolnArray(Array<Complex>& sol,
00468 const Array<Bool>& solOK,
00469 const Bool doPhase=False);
00470
00471 virtual Float calcPowerNorm(Array<Float>& amp, const Array<Bool>& ok)=0;
00472
00473
00474 LogIO& logSink() { return logsink_p; };
00475
00476
00477 void verifyCalTable(const String& caltablename);
00478
00479 void sortVisSet(VisSet& vs, const Bool verbose=False);
00480
00481 Int parType_;
00482
00483
00484 NewCalTable *ct_;
00485 CTPatchedInterp *ci_;
00486 CLPatchPanel *cpp_;
00487 Vector<Bool> spwOK_;
00488
00489 Double maxTimePerSolution_p, minTimePerSolution_p, avgTimePerSolution_p;
00490 Float userPrintActivityInterval_p, userPrintActivityFraction_p;
00491 uInt caiRC_p, cafRC_p;
00492 Timer timer_p;
00493
00494
00495 inline void setSimulated(const Bool& flag) {simulated_=flag;};
00496
00497
00498
00499 inline Bool& simOnTheFly() {
00500
00501 return onthefly_; };
00502
00503
00504
00505 private:
00506
00507
00508 SolvableVisCal();
00509
00510
00511 void initSVC();
00512
00513
00514 void deleteSVC();
00515
00516
00517
00518 String calTableName_;
00519 String calTableSelect_;
00520 Bool append_;
00521
00522
00523 String tInterpType_;
00524 String fInterpType_;
00525
00526
00527 Vector<Int> spwMap_;
00528
00529
00530 Vector<Int> urefantlist_;
00531
00532
00533 Int minblperant_;
00534
00535
00536 Bool solved_;
00537
00538
00539 Bool byCallib_;
00540
00541
00542 String apmode_;
00543
00544
00545 String usolint_;
00546
00547
00548 String solint_;
00549
00550
00551 Double solTimeInterval_;
00552
00553
00554 String fsolint_;
00555
00556
00557 Double fintervalHz_;
00558 Vector<Double> fintervalCh_;
00559
00560
00561 Vector<Matrix<Int> > chanAveBounds_;
00562
00563
00564 Double preavg_;
00565
00566
00567 Bool solnorm_;
00568
00569
00570 Float minSNR_;
00571
00572
00573 String combine_;
00574
00575
00576 Int focusChan_;
00577
00578
00579 Double dataInterval_;
00580 Double fitWt_;
00581 Double fit_;
00582
00583
00584
00585 PtrBlock<Cube<Complex>*> solveCPar_;
00586 PtrBlock<Cube<Float>*> solveRPar_;
00587 PtrBlock<Cube<Bool>*> solveParOK_;
00588 PtrBlock<Cube<Float>*> solveParErr_;
00589 PtrBlock<Cube<Float>*> solveParSNR_;
00590
00591 PtrBlock<Cube<Complex>*> solveAllCPar_;
00592 PtrBlock<Cube<Float>*> solveAllRPar_;
00593 PtrBlock<Cube<Bool>*> solveAllParOK_;
00594 PtrBlock<Cube<Float>*> solveAllParErr_;
00595 PtrBlock<Cube<Float>*> solveAllParSNR_;
00596
00597 Vector<Complex> srcPolPar_;
00598
00599
00600 PtrBlock<Vector<Bool>*> *chanmask_;
00601
00602
00603 LogIO logsink_p;
00604
00605
00606 Bool simulated_;
00607
00608
00609 String simint_;
00610
00611 Bool onthefly_;
00612
00613 };
00614
00615
00616
00617
00618
00619
00620
00621 class SolvableVisMueller : public SolvableVisCal, virtual public VisMueller
00622 {
00623
00624 public:
00625
00626 SolvableVisMueller(VisSet& vs);
00627
00628 SolvableVisMueller(String msname,Int MSnAnt,Int MSnSpw);
00629
00630 SolvableVisMueller(const MSMetaInfoForCal& msmc);
00631
00632 SolvableVisMueller(const Int& nAnt);
00633
00634 virtual ~SolvableVisMueller();
00635
00636
00637
00638 virtual Int nTotalPar() { return nPar(); };
00639
00640
00641 virtual Bool normalizable() { return (this->muellerType() < Mueller::General); };
00642
00643
00644 virtual void guessPar(VisBuffer& ) { throw(AipsError("NYI")); };
00645
00646
00647 virtual void differentiate(CalVisBuffer& ) {throw(AipsError("SVM::differentiate(CVB): NYI")); };
00648 virtual void differentiate(SolveDataBuffer& ) {throw(AipsError("SVM::differentiate(SDB): NYI")); };
00649 virtual void differentiate(VisBuffer& ,
00650 Cube<Complex>& ,
00651 Array<Complex>& ,
00652 Matrix<Bool>& ) { throw(AipsError("NYI")); };
00653 using SolvableVisCal::differentiate;
00654
00655
00656 virtual void diffSrc(VisBuffer& ,
00657 Array<Complex>& ) {throw(AipsError("NYI")); };
00658
00659
00660 virtual void reReference() {};
00661
00662
00663 virtual void accumulate(SolvableVisCal* ,
00664 const Vector<Int>& ) { throw(AipsError("NYI")); };
00665
00666
00667 virtual void fluxscale(const String&,
00668 const Vector<Int>& ,
00669 const Vector<Int>& ,
00670 const Vector<Int>& ,
00671 const Vector<String>& ,
00672 const Float& ,
00673 const String& ,
00674 const String& ,
00675 const String& ,
00676 SolvableVisCal::fluxScaleStruct&,
00677 const String&,
00678 const Bool&,
00679 const Int&,
00680 const Bool&)
00681 { throw(AipsError("NYI")); };
00682
00683
00684 virtual void keepNCT();
00685
00686
00687 inline virtual void state() { stateSVM(True); };
00688
00689
00690 virtual void listCal(const Vector<Int> ,
00691 const Vector<Int> ,
00692 const Matrix<Int> ,
00693 const String& ,
00694 const Int& )
00695 { throw(AipsError(String("Calibration listing not supported for "+typeName()))); };
00696
00697 protected:
00698
00699
00700
00701 virtual Int nCalMat() { return isSolved() ? 1 : nBln(); };
00702
00703
00704 virtual Bool trivialDM() { return False; };
00705
00706
00707
00708 virtual void initSolvePar();
00709
00710
00711 inline Mueller& dM() { return *dM_; };
00712
00713
00714 inline Array<Complex>& diffMElem() {return diffMElem_;};
00715
00716
00717 inline virtual void invalidateDiffCalMat() { invalidateM(); invalidateDM(); };
00718
00719
00720 inline void invalidateDM() {DMValid_=False;};
00721 inline void validateDM() {DMValid_=True;};
00722 inline Bool DMValid() {return DMValid_;};
00723
00724
00725 virtual void syncDiffMat();
00726
00727
00728 virtual void syncDiffMueller();
00729
00730
00731 virtual void calcAllDiffMueller();
00732
00733
00734 virtual void calcOneDiffMueller(Matrix<Complex>& mat, const Vector<Complex>& par);
00735
00736
00737 void createDiffMueller();
00738
00739
00740 void setMatByOk() { if (!isSolved()) VisMueller::setMatByOk(); };
00741
00742
00743 virtual void initTrivDM();
00744
00745
00746 virtual void stateSVM(const Bool& doVC);
00747
00748
00749
00750 virtual Float calcPowerNorm(Array<Float>& amp, const Array<Bool>& ok);
00751
00752 private:
00753
00754
00755 SolvableVisMueller();
00756
00757
00758 Mueller *dM_;
00759
00760
00761 Array<Complex> diffMElem_;
00762
00763
00764 Bool DMValid_;
00765
00766
00767 };
00768
00769
00770
00771
00772
00773 class SolvableVisJones : public SolvableVisMueller, public VisJones {
00774
00775 public:
00776
00777 SolvableVisJones(VisSet& vs);
00778
00779 SolvableVisJones(String msname,Int MSnAnt,Int MSnSpw);
00780
00781 SolvableVisJones(const MSMetaInfoForCal& msmc);
00782
00783 SolvableVisJones(const Int& nAnt);
00784
00785 virtual ~SolvableVisJones();
00786
00787
00788
00789 virtual Int nTotalPar() { return nPar()*nAnt(); };
00790
00791
00792 virtual Bool normalizable() { return (this->jonesType() < Jones::GenLinear); };
00793
00794
00795 virtual void differentiate(CalVisBuffer& cvb);
00796 virtual void differentiate(SolveDataBuffer& sdb);
00797 virtual void differentiate(VisBuffer& vb,
00798 Cube<Complex>& V,
00799 Array<Complex>& dV,
00800 Matrix<Bool>& Vflg);
00801 using SolvableVisMueller::differentiate;
00802
00803
00804 virtual void diffSrc(VisBuffer& vb,
00805 Array<Complex>& dV);
00806
00807
00808 virtual void reReference();
00809
00810
00811 virtual void accumulate(SolvableVisCal* incr,
00812 const Vector<Int>& fields);
00813
00814
00815 virtual void globalPostSolveTinker();
00816
00817
00818 virtual void applyRefAnt();
00819
00820
00821 void fluxscale(const String& outfile,
00822 const Vector<Int>& refFieldIn,
00823 const Vector<Int>& tranFieldIn,
00824 const Vector<Int>& inRefSpwMap,
00825 const Vector<String>& fldNames,
00826 const Float& inGainThres,
00827 const String& antSel,
00828 const String& timerangeSel,
00829 const String& scanSel,
00830 SolvableVisCal::fluxScaleStruct& oFluxScaleStruct,
00831 const String& oListFile,
00832 const Bool& incremental=False,
00833 const Int& fitorder=1,
00834 const Bool& display=False);
00835
00836
00837 virtual void keepNCT();
00838
00839
00840 inline virtual void state() { stateSVJ(True); };
00841
00842
00843 virtual void listCal(const Vector<Int> ufldids, const Vector<Int> uantids,
00844 const Matrix<Int> uchanids,
00845 const String& listfile="",const Int& pagerows=50);
00846
00847
00848 int writeHeader(const uInt numAntCols,
00849 const uInt numAnts,
00850 const uInt iElem);
00851
00852 virtual void nearest(const Double , Array<Float>& ) {};
00853 virtual void nearest(const Double , Array<Complex>& ) {};
00854
00855
00856 void setupPlotter();
00857 void plotHistogram(const String& title, const Int index,
00858 const Vector<Double>& data, const Int nbin);
00859
00860 protected:
00861
00862
00863
00864 virtual Int nCalMat() { return nAnt(); };
00865
00866
00867 virtual Bool trivialDM() { return False; };
00868
00869
00870 inline virtual Bool trivialDJ() { return False; };
00871
00872
00873
00874 virtual void initSolvePar();
00875
00876
00877 inline Jones& dJ1() { return *dJ1_; };
00878 inline Jones& dJ2() { return *dJ2_; };
00879
00880
00881 Array<Complex>& diffJElem() { return diffJElem_; };
00882
00883
00884 inline virtual void invalidateDiffCalMat() {
00885 SolvableVisMueller::invalidateDiffCalMat(); invalidateJ(); invalidateDJ(); };
00886
00887
00888 inline void invalidateDJ() {DJValid_=False;};
00889 inline void validateDJ() {DJValid_=True;};
00890 inline Bool DJValid() {return DJValid_;};
00891
00892
00893 virtual void syncDiffMat();
00894
00895
00896 virtual void syncDiffJones();
00897
00898
00899 virtual void calcAllDiffJones();
00900
00901
00902 virtual void calcOneDiffJones(Matrix<Complex>& mat, const Vector<Complex>& par);
00903
00904
00905 void createDiffJones();
00906
00907
00908 void setMatByOk() { if (!isSolved()) VisJones::setMatByOk(); };
00909
00910
00911 virtual void initTrivDJ();
00912
00913 virtual void stateSVJ(const Bool& doVC);
00914
00915
00916
00917 virtual Float calcPowerNorm(Array<Float>& amp, const Array<Bool>& ok);
00918
00919 private:
00920
00921
00922 SolvableVisJones();
00923
00924
00925 Jones *dJ1_;
00926 Jones *dJ2_;
00927
00928
00929 Array<Complex> diffJElem_;
00930
00931
00932 Bool DJValid_;
00933
00934
00935 uInt wTime_p, wField_p, wChan_p, wAmp_p,
00936 wPhase_p, wFlag_p, wPol_p, wAntCol_p,
00937 wTotal_p, wPreAnt_p;
00938
00939
00940 PlotServerProxy* plotter_;
00941 Vector<dbus::variant> panels_id_;
00942
00943 };
00944
00945
00946
00947
00948 String calTableType(const String& tablename);
00949
00950 }
00951
00952 #endif