Line data Source code
1 : //# FringeJones.h: Declaration of fringe-fitting VisCal 2 : //# Copyright (C) 1996,1997,2000,2001,2002,2003,2011,2016 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be adressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# 27 : 28 : #ifndef SYNTHESIS_FRINGEJONES_H 29 : #define SYNTHESIS_FRINGEJONES_H 30 : 31 : #include <casacore/casa/aips.h> 32 : #include <synthesis/MeasurementComponents/StandardVisCal.h> 33 : #include <synthesis/MeasurementComponents/DelayRateFFT.h> 34 : #include <synthesis/CalTables/CTTimeInterp1.h> 35 : 36 : 37 : namespace casa { //# NAMESPACE CASA - BEGIN 38 : 39 : // Rate-aware time interpolation engine 40 : class CTRateAwareTimeInterp1 : public CTTimeInterp1 { 41 : 42 : public: 43 : 44 : // From NewCalTable 45 : CTRateAwareTimeInterp1(NewCalTable& ct, 46 : const casacore::String& timetype, 47 : casacore::Array<casacore::Float>& result, 48 : casacore::Array<casacore::Bool>& rflag); 49 : 50 : // Destructor 51 : virtual ~CTRateAwareTimeInterp1(); 52 : 53 : // Interpolate, given timestamp; returns T if new result 54 : virtual casacore::Bool interpolate(casacore::Double time); 55 : 56 : // static factory method to make CTRateAwareTimeInterp1 57 : // NB: returns pointer to a _generic_ CTTimeInterp1 58 0 : static CTTimeInterp1* factory(NewCalTable& ct, 59 : const casacore::String& timetype, 60 : casacore::Array<casacore::Float>& result, 61 : casacore::Array<casacore::Bool>& rflag) { 62 0 : return new casa::CTRateAwareTimeInterp1(ct,timetype,result,rflag); } 63 : 64 : private: 65 : 66 : // Refine time-dep phase with rate info 67 : void applyPhaseRate(casacore::Bool single); 68 : 69 : // Default ctor is unusable 70 : // CTRateAwareTimeInterp1(); 71 : 72 : }; 73 : 74 : 75 : // Fringe-fitting (parametrized phase) VisCal 76 : class FringeJones : public GJones { 77 : public: 78 : // Constructor 79 : // TBD: MSMetaInfoForCal-aware version; deprecate older ones 80 : FringeJones(VisSet& vs); 81 : FringeJones(casacore::String msname,casacore::Int MSnAnt,casacore::Int MSnSpw); 82 : FringeJones(const MSMetaInfoForCal& msmc); 83 : FringeJones(casacore::Int nAnt); 84 : 85 : virtual ~FringeJones(); 86 : 87 : // We have casacore::Float parameters 88 0 : virtual VisCalEnum::VCParType parType() { return VisCalEnum::REAL; }; 89 : 90 : // Return the type enum 91 0 : virtual Type type() { return VisCal::K; }; 92 : 93 : // Return type name as string 94 0 : virtual casacore::String typeName() { return "Fringe Jones"; }; 95 0 : virtual casacore::String longTypeName() { return "Fringe Jones (parametrized phase)"; }; 96 : 97 : // Type of Jones matrix according to nPar() 98 0 : virtual Jones::JonesType jonesType() { return Jones::Diagonal; }; 99 : 100 0 : virtual bool timeDepMat() { return true; }; 101 : 102 : // Freq dependence (delays) 103 0 : virtual casacore::Bool freqDepPar() { return false; }; 104 : // If the following is false frequency spectrum is squashed to one point. 105 0 : virtual casacore::Bool freqDepMat() { return true; }; 106 : 107 : // Local setApply to enforce calWt=F for delays 108 : virtual void setApply(const casacore::Record& apply); 109 : virtual void setApply(); 110 : using GJones::setApply; 111 : virtual void setCallib(const casacore::Record& callib, 112 : const casacore::MeasurementSet& selms); 113 : 114 : // Local setSolve (traps lack of refant) 115 : virtual void setSolve(const casacore::Record& solve); 116 : using GJones::setSolve; 117 : 118 : // Default parameter value 119 0 : virtual casacore::Complex defaultPar() { return casacore::Complex(0.0); }; 120 : 121 : // FIXME: was omitted 122 : virtual void specify(const casacore::Record& specify); 123 : 124 : // This type is not yet accumulatable 125 0 : virtual casacore::Bool accumulatable() { return false; }; 126 : 127 : // This type is smoothable 128 0 : virtual casacore::Bool smoothable() { return true; }; 129 : 130 : // Delay to phase calculator 131 : virtual void calcAllJones(); 132 : 133 : // Hazard a guess at parameters (unneeded here) 134 : // TBD? Needed? 135 0 : virtual void guessPar(VisBuffer& ) {}; 136 : 137 : // FringeJones uses generic gather, but solves for itself per solution 138 0 : virtual casacore::Bool useGenericGatherForSolve() { return true; }; 139 0 : virtual casacore::Bool useGenericSolveOne() { return false; } 140 : 141 : // Post solve tinkering 142 : virtual void globalPostSolveTinker(); 143 : 144 : // Local implementation of selfSolveOne (generalized signature) 145 : // virtual void selfSolveOne(VisBuffGroupAcc& vbga); 146 : virtual void selfSolveOne(SDBList&); 147 : 148 : virtual void solveOneVB(const VisBuffer&); 149 : 150 : // SolveDataBuffer is being phased out; we no longer support it. 151 : // virtual void solveOneSDB(const SolveDataBuffer&); 152 : 153 0 : virtual casacore::Bool& zeroRates() { return zeroRates_; } 154 0 : virtual casacore::Bool& globalSolve() { return globalSolve_; } 155 0 : virtual casacore::Int& maxits() { return maxits_; } 156 0 : virtual casacore::Array<casacore::Double>& delayWindow() { return delayWindow_; } 157 0 : virtual casacore::Array<casacore::Double>& rateWindow() { return rateWindow_; } 158 0 : virtual casacore::Array<casacore::Bool>& paramActive() { return paramActive_; } 159 0 : virtual casacore::Bool& concatSPWs() { return concatspws_; } 160 : 161 : // Apply reference antenna 162 : virtual void applyRefAnt(); 163 : 164 0 : virtual casacore::Int& refant() { return refant_; } 165 : 166 : protected: 167 : 168 : // phase, delay, rate 169 : // TBD: Need to cater for parameter opt-out (e.g., no rate solve, etc.) 170 0 : virtual casacore::Int nPar() { return 8; }; 171 : 172 : // Jones matrix elements are NOT trivial 173 0 : virtual casacore::Bool trivialJonesElem() { return false; }; 174 : 175 : // dJ/dp are trivial 176 : // TBD: make this default in SVC? 177 0 : virtual casacore::Bool trivialDJ() { return false; }; 178 : 179 : // Initialize trivial dJs 180 : // TBD: make this default in SVC? 181 0 : virtual void initTrivDJ() {}; 182 : 183 : // Reference frequencies 184 : casacore::Vector<casacore::Double> KrefFreqs_; 185 : 186 : 187 : 188 : private: 189 : 190 : // Pointer to CTRateAwareTimeInterp1 factory method 191 : // This ensures the rates are incorporated into the time-dep interpolation 192 0 : virtual CTTIFactoryPtr cttifactoryptr() { return &CTRateAwareTimeInterp1::factory; }; 193 : void calculateSNR(casacore::Int, casa::DelayRateFFT&); 194 : 195 : casacore::Int refant_; // Override 196 : casacore::Bool zeroRates_; 197 : casacore::Bool globalSolve_; 198 : casacore::Array<casacore::Double> delayWindow_; 199 : casacore::Array<casacore::Double> rateWindow_; 200 : casacore::Array<casacore::Bool> paramActive_; 201 : casacore::Int maxits_; 202 : casacore::Bool concatspws_; 203 : }; 204 : 205 : 206 : } //# NAMESPACE CASA - END 207 : 208 : #endif