CARMA C++
carma::services::Selfcal Class Reference

Computes an amplitude or phase selfcal solution on a set of visibilities. More...

#include <carma/services/Selfcal.h>

Public Member Functions

double getIter (void) const
 get the number of iterations it took to get a solution More...
 
double getMaxAnt (void) const
 get the maximum numbers of antennae. More...
 
double getRefAnt (void) const
 get the reference antenna. More...
 
double getRMSAmp (void) const
 get amplitude RMS error of the current solution More...
 
double getRMSPhase (void) const
 get phase RMS error of the current solution More...
 
std::vector< ComplexgetVis (bool useAmp=true)
 Return antenna based visibilities (gains really) The returned array will have a length that contains the maximum antenna number, but visibilities for antennae that were missing in the input visibilities are set to 0 on output. More...
 
std::vector< ComplexgetVisErrors (void)
 Return visibility errors for all inputs. More...
 
 Selfcal ()
 Constructor. More...
 
void setDebug (int debug=0)
 set a debug level (0=nothing, 1=a bit, 2=more) More...
 
void setEps (double epsi1=1.0e-8, double epsi2=1.0e-4)
 set the relative accuracy levels that need to be achieved in the jacobi iteration. More...
 
void setMaxAnt (int maxAnt=0)
 set the maximum number of antennae. More...
 
void setMaxIter (int maxIter=100)
 set the maximum number of iterations. More...
 
void setPlanetDiskModel (double flux, double bmaj=0, double bmin=0, double bpa=0)
 set the flux and size of a (uniform disk) planet. More...
 
void setPointSourceModel (double flux)
 set the flux of a point source model More...
 
void setReferenceAntenna (int refAnt=0)
 set the reference antenna. More...
 
void setSourceName (std::string &sourceName)
 set sourcename More...
 
void setVis (int ant1, int ant2, const Complex &vis, double weight=1)
 accumulate visibilities. More...
 
void zero (void)
 reset the accumulators for a new solution More...
 

Detailed Description

Computes an amplitude or phase selfcal solution on a set of visibilities.

It also computes some statistics to determine a goodness-of-fit. The code - at least at its inception - produced identical results to the MIRIAD equivalent routines in selfcal.for.

Definition at line 40 of file Selfcal.h.

Constructor & Destructor Documentation

carma::services::Selfcal::Selfcal ( )

Constructor.

Member Function Documentation

double carma::services::Selfcal::getIter ( void  ) const

get the number of iterations it took to get a solution

Returns
number of iterations

Definition at line 177 of file Selfcal.h.

double carma::services::Selfcal::getMaxAnt ( void  ) const

get the maximum numbers of antennae.

Useful when it was left at 0 to find the largest one. It is also equal to the length of the returned gains in getGains()

Returns
maximum antenna number (1 or larger)

Definition at line 198 of file Selfcal.h.

double carma::services::Selfcal::getRefAnt ( void  ) const

get the reference antenna.

Useful when it was left at 0 to find the one with the greatest weight.

Returns
reference antenna, in the range 1..maxAnt

Definition at line 187 of file Selfcal.h.

double carma::services::Selfcal::getRMSAmp ( void  ) const

get amplitude RMS error of the current solution

Returns
RMS error in whatever units amplitudes were given

Definition at line 168 of file Selfcal.h.

double carma::services::Selfcal::getRMSPhase ( void  ) const

get phase RMS error of the current solution

Returns
RMS error in degrees

Definition at line 159 of file Selfcal.h.

std::vector<Complex> carma::services::Selfcal::getVis ( bool  useAmp = true)

Return antenna based visibilities (gains really) The returned array will have a length that contains the maximum antenna number, but visibilities for antennae that were missing in the input visibilities are set to 0 on output.

It is also possible to use setMaxAnt() and always get a predictable length. If convergence failed, the vector will be of length 0. Visibilities are defined such that |g_i * g_j - V_ij| is minimized

Parameters
useAmpif true, return an amplitude selfcal, else phase only.
std::vector<Complex> carma::services::Selfcal::getVisErrors ( void  )

Return visibility errors for all inputs.

If getVisErrors() is called before getVis(), unpredictable things can happen. Also note that errors will be arbitrarely seto to 1 for those antennae that were missing.

void carma::services::Selfcal::setDebug ( int  debug = 0)

set a debug level (0=nothing, 1=a bit, 2=more)

Parameters
debug
void carma::services::Selfcal::setEps ( double  epsi1 = 1.0e-8,
double  epsi2 = 1.0e-4 
)

set the relative accuracy levels that need to be achieved in the jacobi iteration.

Parameters
epsi1phase loop.
epsi2amplitude loop
void carma::services::Selfcal::setMaxAnt ( int  maxAnt = 0)

set the maximum number of antennae.

If you set this, the array of gains will always be of this length, instead of a length of the largest found antenna in the input visibilities that were entered via setVis() The default value (0) will cause it to be determined automatically.

Parameters
maxAntthe max number of ants requested in returns gain
void carma::services::Selfcal::setMaxIter ( int  maxIter = 100)

set the maximum number of iterations.

Code default is 100.

Parameters
maxIter
void carma::services::Selfcal::setPlanetDiskModel ( double  flux,
double  bmaj = 0,
double  bmin = 0,
double  bpa = 0 
)

set the flux and size of a (uniform disk) planet.

The code has no slots for antenna coordinates, and would need this. Note this routine has not been implemented.

void carma::services::Selfcal::setPointSourceModel ( double  flux)

set the flux of a point source model

Parameters
flux
void carma::services::Selfcal::setReferenceAntenna ( int  refAnt = 0)

set the reference antenna.

The default (0) signifies that the one with the greatest weight is taken. A valid refAnt needs to be a 1..maxAnt.

Parameters
refAnt
void carma::services::Selfcal::setSourceName ( std::string &  sourceName)

set sourcename

Parameters
sourceName
void carma::services::Selfcal::setVis ( int  ant1,
int  ant2,
const Complex vis,
double  weight = 1 
)

accumulate visibilities.

It will automatically reject those whose antennae number is above maxAnt (if set via setMaxAnt).

Parameters
ant1antennae number (1..maxAnt)
ant2antennae number (1..maxAnt)
viscomplex visbility
weightweight (as a 1/sigma^2 factor)
void carma::services::Selfcal::zero ( void  )

reset the accumulators for a new solution


The documentation for this class was generated from the following file: