//# UVMod.h: Definitions of interface for UV-modelling in calibrater //# Copyright (C) 1996,1997,2000,2001,2002,2003 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be adressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# //# #ifndef SYNTHESIS_UVMOD_H #define SYNTHESIS_UVMOD_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace casa { //# NAMESPACE CASA - BEGIN // // VisCal: Model multiplicative errors for the VisEquation // // // // //
  • MeasurementComponents module //
  • VisSet module //
  • VisEquation module // // // // VisCal describes an interface for multiplicative errors to be used in // the VisEquation. It is an Abstract Base Class: most methods // must be defined in derived classes. // // // // // See VisEquation for definition of the // Visibility Measurement Equation. // // The following examples illustrate how an VisCal can be // used: //
      //
    • Simulation: random multiplicative gains of a certain scaling // can be applied: SimVisCal //
    • casacore::Time variable multiplicative errors: TimeVarVisCal //
    • Solvable time variable multiplicatiove errors: SolvableVisCal //
    //
    // // // // // Read the VisSet from disk // VisSet vs("3c84.MS"); // // VisEquation ve(vs); // // // Make an VisCal // PhaseScreenVisCal coac(vs); // // // Correct the visset // ve.correct(); // // // // // The properties of an multiplicative component must be described // for the VisEquation. // // // // // ********************************************************** // VisCal // class UVMod { public: UVMod(VisSet& vs); virtual ~UVMod(); inline casacore::Int& nPar() { return nPar_; }; void setModel(const ComponentType::Shape type, const casacore::Vector inpar, const casacore::Vector invary); casacore::Bool modelfit(const casacore::Int& maxiter, const casacore::String file); inline casacore::Vector& par() { return par_; }; protected: // Initial solving data void initSolve(); // Calculate residuals (incl. diff'd) and chi2 virtual void residual(); void chiSquare(); // Internal solving methods void accGradHess(); void solveGradHess(const casacore::Bool& doCovar=false); casacore::Bool updPar(); casacore::Bool setCompPar(); void printPar(const casacore::Int& iter); // Access to VisSet inline VisSet& vs() { return *vs_; }; // Access to ComponentList inline ComponentList& cl() { return *cl_; }; // Access to SkyComponents by id inline SkyComponent& skycomp(const casacore::uInt id) { return cl_->component(id); }; // Access to current VisBuffer inline VisBuffer& svb() { return *svb_; }; // Access to fieldId we are fitting for inline casacore::Int& fitfld() { return fitfld_; }; inline casacore::MDirection& pc() { return pc_; }; // Accessors to current svb's (differentiated) Residuals inline casacore::Cube& R() { return R_; }; inline casacore::Array& dR() { return dR_; }; // Access to chi2 inline casacore::Double& chiSq() { return chiSq_; }; inline casacore::Double& lastChiSq() { return lastChiSq_; }; inline casacore::Double& sumWt() { return sumWt_; }; inline casacore::Int& nWt() { return nWt_; }; inline casacore::Vector& polWt() { return polWt_; }; // Access to parameters, & grad,hess,dp inline casacore::Double& lamb() { return lamb_; }; inline casacore::Vector& lastPar() { return lastPar_; }; inline casacore::Vector& grad() { return grad_; }; inline casacore::Vector& lastGrad() { return lastGrad_; }; inline casacore::Matrix& hess() { return hess_; }; inline casacore::Matrix& lastHess() { return lastHess_; }; inline casacore::Vector& dpar() { return dpar_; }; inline casacore::Vector& vary() { return vary_; }; inline casacore::Int& nVary() { return nVary_; }; private: // Associated VisSet (LOCAL) VisSet* vs_; // ComponentList (LOCAL) ComponentList* cl_; // VisBuffer (from outside) VisBuffer* svb_; // FieldId in fit casacore::Int fitfld_; // Phase center w.r.t. which modelfitting is done casacore::MDirection pc_; // Total Number of parameters casacore::Int nPar_; // Residual/Differentiation caches casacore::Cube R_; casacore::Array dR_; // Chi2, sum wts casacore::Double chiSq_; casacore::Double lastChiSq_; casacore::Double sumWt_; casacore::Int nWt_; casacore::Vector polWt_; // Parameter storage casacore::Vector par_; casacore::Vector lastPar_; // Gradient, Hessian, par update casacore::Double lamb_; casacore::Vector grad_; casacore::Vector lastGrad_; casacore::Matrix hess_; casacore::Matrix lastHess_; casacore::Vector dpar_; casacore::Vector vary_; casacore::Int nVary_; }; } #endif