likelihood_optimal_gain_correction_visibility_amplitude Class Reference

Defines a likelihood that non-linearly optimizes over gain corrections with a Gaussian prior. More...

#include "likelihood/likelihood_optimal_gain_correction_visibility_amplitude.h"

Inheritance diagram for likelihood_optimal_gain_correction_visibility_amplitude:
Collaboration diagram for likelihood_optimal_gain_correction_visibility_amplitude:

Public Member Functions

 likelihood_optimal_gain_correction_visibility_amplitude (data_visibility_amplitude &data, model_visibility_amplitude &model, std::vector< std::string > station_codes, std::vector< double > sigma_g)
 Construct to do scan-by-scan correction by default.
 
 likelihood_optimal_gain_correction_visibility_amplitude (data_visibility_amplitude &data, model_visibility_amplitude &model, std::vector< std::string > station_codes, std::vector< double > sigma_g, std::vector< double > t_ge)
 Specify the times of the gain-correction epochs by hand.
 
 likelihood_optimal_gain_correction_visibility_amplitude (data_visibility_amplitude &data, model_visibility_amplitude &model, std::vector< std::string > station_codes, std::vector< double > sigma_g, std::vector< double > t_ge, std::vector< double > max_g)
 Specify the times of the gain-correction epochs by hand.
 
virtual double operator() (std::vector< double > &x)
 Returns the log-likelihood of a vector of parameters \( \mathbf{x} \).
 
virtual double chi_squared (std::vector< double > &x)
 Returns the \( \chi^2 \) of a vector of parameters \( \mathbf{x} \).
 
std::vector< double > get_gain_correction_times ()
 Returns the start time of each gain-correction epoch.
 
std::vector< std::vector< double > > get_gain_corrections ()
 Returns the set of gain corrections for each epoch.
 
void output_gain_corrections (std::ostream &out)
 Outputs the set of gain corrections in a structure fashion to an output stream.
 
void output_gain_corrections (std::string outname)
 Outputs the set of gain corrections in a structure fashion to a file.
 
virtual void set_mpi_communicator (MPI_Comm comm)
 Defines a set of processors provided to the model for parallel computation via an MPI communicator. Only facilates code parallelization if the model computation is parallelized via MPI.
 
size_t number_of_independent_gains ()
 Returns the number of independent gains, which is generally less than product of the number of stations and number of epochs.
 
void read_gain_file (std::string gain_file_name)
 Reads gain file.
 
void solve_for_gains ()
 Turns on gain solver (default is on)
 
void fix_gains ()
 Fixes the gains to last value.
 
void assume_smoothly_varying_gains ()
 Assume that the gain corrections are correlated, yielding an approximate solution for subsequent times (default).
 
void assume_independently_varying_gains ()
 Assume that the gain corrections are not correlated.
 
- Public Member Functions inherited from likelihood_base
virtual std::vector< double > gradient (std::vector< double > &x, prior &Pr)
 
void output_model_data_comparison (std::ostream &out)
 
void output_model_data_comparison (std::string filename)
 

Protected Member Functions

virtual void output (std::ostream &out)
 

Private Member Functions

void check_station_codes ()
 
void allocate_memory ()
 
void organize_data_lists ()
 
double optimal_gain_corrections (std::vector< double > &y, std::vector< double > &yb, std::vector< size_t > &is1, std::vector< size_t > &is2, std::vector< double > &gest)
 
double matrix_determinant (double **a)
 
void ludcmp (double **a, int n, int *indx, double &d)
 
void gain_optimization_likelihood (size_t i, const double g[], double *y, double dydg[]) const
 
void covsrt (double **covar, int ma, int mfit)
 
void gaussj (double **a, int n, double **b, int m)
 
void mrqcof (double y[], int ndata, double a[], int ma, double **alpha, double beta[], double *chisq)
 
void mrqmin (double y[], int ndata, double a[], int ma, double **covar, double **alpha, double *chisq, double *alamda)
 

Private Attributes

data_visibility_amplitude_data
 
model_visibility_amplitude_model
 
std::vector< std::string > _station_codes
 
std::vector< double > _sigma_g
 
std::vector< double > _max_g
 
std::vector< double > _tge
 
std::vector< std::vector< double > > _g
 
std::vector< double > _sqrt_detC
 
std::vector< double > _x
 
bool _smoothly_varying_gains
 
bool _solve_for_gains
 
std::vector< std::vector< size_t > > _datum_index_list
 
std::vector< std::vector< double > > _y_list
 
std::vector< std::vector< size_t > > _is1_list
 
std::vector< std::vector< size_t > > _is2_list
 
double * _ogc_y
 
double * _ogc_yb
 
size_t * _ogc_is1
 
size_t * _ogc_is2
 
double _mrq_ochisq
 
double * _mrq_atry
 
double * _mrq_beta
 
double * _mrq_da
 
double ** _mrq_oneda
 

Additional Inherited Members

- Protected Attributes inherited from likelihood_base
MPI_Comm _comm
 

Detailed Description

This class takes a visibility amplitude data object and a visibility amplitude model object, and then returns the log likelihood after minimalization of the log-likelihood within the gain-correction sub-space. That is, it sets the model to \( V_{AB}(g_A,g_B;p) = (1+g_A)(1+g_B) \bar{V}_{AB}(p) \), and numerically maximizes the likelihood independently for each observation epoch, assuming Gaussian priors on the \(g_A\) and Gaussian errors. An approximation of the marginalized likelihood is generated using the covariance of the likelihood, though this makes little difference in practice. Gain-reconstruction epochs may be specified explicitly; by default the corrections will be performed by scan.

Warning
Note that this fails if low-SNR points are included in the analysis, which drives erroneous gain reconstructions. Typically, a minimum SNR or 2 is sufficient, which is required for the visibility amplitude error distribution to be well approximated by a Gaussian.

Member Function Documentation

double optimal_gain_corrections ( std::vector< double > &  y,
std::vector< double > &  yb,
std::vector< size_t > &  is1,
std::vector< size_t > &  is2,
std::vector< double > &  gest 
)
private

_sigma_g.size();

Here is the caller graph for this function:

void output ( std::ostream &  out)
protectedvirtual

Outputs the data and model, as modified by the likelihood appropriately, to the specified output stream. Useful for comparison later.

Reimplemented from likelihood_base.

Here is the call graph for this function:


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