casacore
Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
casacore::VanVleck Class Reference

More...

#include <VanVleck.h>

Static Public Member Functions

static void size (uInt npts)
 Set the interpolation table size. More...
 
static uInt getsize ()
 get the current size. More...
 
static void setQuantization (const Matrix< Double > &qx, const Matrix< Double > &qy)
 Set the x and y quantization functions. More...
 
static Bool setEquiSpaced (Double xlev, Double ylev, Double xmean, Double ymean, Int n)
 Set the x and y quantization levels for the case of equi-spaced levels with a possible non-zero offset. More...
 
static void getTable (Vector< Double > &rs, Vector< Double > &rhos)
 Get the data used in setting up the interpolation. More...
 
static Double r (const Double rho)
 Given a rho return the corresponding corrected r Returns 0.0 if no quantization has been set yet. More...
 
static Double thresh (Int n, Double zerolag)
 Given a measured zero-lag autocorrelation and number of levels (n>=3) return the first positive quantizer input threshold level. More...
 
static Double predict (Int n, Double threshhold)
 Predict a given zero-lag given n and a threshold. More...
 
static Bool dcoff (Double &dcoffset, Double &threshold, Int n, Double zerolag, Double bias)
 Compute an approximation to the mean signal level (DC offset) and quantizer threshold setting (both in terms of the r.m.s. More...
 

Static Private Member Functions

static Double drbydrho (Double *rho)
 The fortran numerical integration function will call this. More...
 
static Double rinc (Double &rhoi, Double &rhof)
 For a given rhoi, rhof, this produces a high-accuracy numerical approximation to the integral of drbydrho over the range rhoi to rhof. More...
 
static void initInterpolator ()
 initialize the interpolator More...
 
static Double threshNgt3 (Int n, Double zerolag)
 compute first threshhold for a given zerolag for n>3 More...
 
static Double threshN3 (Double zerolag)
 compute first threshhold for a given zerolag for n==3 More...
 
static Double invErf (Double x)
 inverse err fn - used by invErfc More...
 
static Double invErfc (Double x)
 inverse complementary err fn - used by threshN3 More...
 
static Double predictNgt3 (Int n, Double threshhold)
 Predict a zero-lag value given the indicated first threshold level for n>3. More...
 
static Double predictN3 (Double threshhold)
 Predict a zero-lag value given the indicated first threshold level for n=3. More...
 
static Bool dcoff3 (Double &dcoffset, Double &threshold, Double zerolag, Double bias)
 implementation of dcoff for the 3-level case More...
 

Static Private Attributes

static uInt itsSize
 the number of points to use in setting up the interpolator More...
 
static uInt itsNx
 
static uInt itsNy
 
static Bool itsEquiSpaced
 
static Double itsXlev
 
static Double itsYlev
 
static Double itsXmean
 
static Double itsYmean
 
static Interpolate1D< Double, Double > * itsInterp
 The interpolator. More...
 
static Vector< DoubleitsQx0
 the quantization functions More...
 
static Vector< DoubleitsQx1
 
static Vector< DoubleitsQy0
 
static Vector< DoubleitsQy1
 
static Vector< DoubleitsQx0Qx0
 Useful combinations of the above - to speed up drbydrho these are -1/2*(Qx0*Qx0) and -1/2*(Qy0*Qy0) These are only used for i up to (itsQx0.nelements() and for j up to (itsQy0.nelements()). More...
 
static Vector< DoubleitsQy0Qy0
 
static Matrix< DoubleitsQx0Qy0
 This is Qx0[i]*Qy0[j]. More...
 
static Matrix< DoubleitsQx1Qy1diffs
 This is (Qx1[i+1]-Qx1[i])*(Qy1[j+1]*Qy1[j]) More...
 
static std::mutex theirMutex
 The mutex to make the functions thread-safe. More...
 

Detailed Description

A class of static functions to aid with vanVleck corrections of lag data.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This provides the functions necessary to determine the van Vleck correction for a general n-level by m-level correlator.

Synopsis

This provides the functions necessary to determine the van Vleck correction for a general n-level by m-level correlator.

Example

Motivation

The GBT spectrometer provides the measured auto-correlation and cross-correlation lags. The gbt MeasurementSet filler (gbtmsfiller) needs to convert those lags to the spectral domain. These functions allow the filler to calculate the van Vleck correction appropriate for each measured set of lags. They are of general and hence are not specific to the GBT spectrometer.

The functions here are static because of the nature of the underlying numerical quadrature fortran code used to integrate the drbyrho function.

Thrown Exceptions

To Do

Definition at line 94 of file VanVleck.h.

Member Function Documentation

◆ dcoff()

static Bool casacore::VanVleck::dcoff ( Double dcoffset,
Double threshold,
Int  n,
Double  zerolag,
Double  bias 
)
static

Compute an approximation to the mean signal level (DC offset) and quantizer threshold setting (both in terms of the r.m.s.

signal input level) given the observed positive bias (the asymptotic limit of the measured autocorrelation at large lags) and the zero-lag autocorrelation. dcoffset is the mean signal level, threshold is the quantizer setting, n is the number of levels, zerolag is the zero-lag value and bias is the asymptotic bias. Currently, this is only available for the n==3 level case, all other cases set the returned dcoffset to 0 and use thresh() to set the returned value of threshold. A return value of F indicates that the zerolag and bias values are inconsistent and the dcoffset can not be determined. In that case, the returned dcoffset is 0 and thresh() is used to set the threshold level.

◆ dcoff3()

static Bool casacore::VanVleck::dcoff3 ( Double dcoffset,
Double threshold,
Double  zerolag,
Double  bias 
)
staticprivate

implementation of dcoff for the 3-level case

◆ drbydrho()

static Double casacore::VanVleck::drbydrho ( Double rho)
staticprivate

The fortran numerical integration function will call this.

For a given rho and quantization functions, this computes, via Price's theorem, the value dr/drho of the derivative, with respect to rho, of the expected value of the correlator output.

◆ getsize()

static uInt casacore::VanVleck::getsize ( )
static

get the current size.

◆ getTable()

static void casacore::VanVleck::getTable ( Vector< Double > &  rs,
Vector< Double > &  rhos 
)
static

Get the data used in setting up the interpolation.

◆ initInterpolator()

static void casacore::VanVleck::initInterpolator ( )
staticprivate

initialize the interpolator

◆ invErf()

static Double casacore::VanVleck::invErf ( Double  x)
staticprivate

inverse err fn - used by invErfc

◆ invErfc()

static Double casacore::VanVleck::invErfc ( Double  x)
staticprivate

inverse complementary err fn - used by threshN3

Referenced by threshN3().

◆ predict()

static Double casacore::VanVleck::predict ( Int  n,
Double  threshhold 
)
inlinestatic

Predict a given zero-lag given n and a threshold.

This is included here to be used as a check against the output of thresh.

Definition at line 145 of file VanVleck.h.

References predictN3(), and predictNgt3().

◆ predictN3()

static Double casacore::VanVleck::predictN3 ( Double  threshhold)
inlinestaticprivate

Predict a zero-lag value given the indicated first threshold level for n=3.

Definition at line 229 of file VanVleck.h.

References casacore::sqrt().

Referenced by predict().

◆ predictNgt3()

static Double casacore::VanVleck::predictNgt3 ( Int  n,
Double  threshhold 
)
staticprivate

Predict a zero-lag value given the indicated first threshold level for n>3.

Referenced by predict().

◆ r()

static Double casacore::VanVleck::r ( const Double  rho)
static

Given a rho return the corresponding corrected r Returns 0.0 if no quantization has been set yet.

◆ rinc()

static Double casacore::VanVleck::rinc ( Double rhoi,
Double rhof 
)
staticprivate

For a given rhoi, rhof, this produces a high-accuracy numerical approximation to the integral of drbydrho over the range rhoi to rhof.

It calls the standard QUADPACK adaptive Gaussian quadrature procedure, dqags, to do the numerical integration.

◆ setEquiSpaced()

static Bool casacore::VanVleck::setEquiSpaced ( Double  xlev,
Double  ylev,
Double  xmean,
Double  ymean,
Int  n 
)
static

Set the x and y quantization levels for the case of equi-spaced levels with a possible non-zero offset.

The total number of levels is given by n, which must be 3 or 9. If n is not 3 or 9, False will be returned and no quantization will have been set. For the 3- and 9- level cases a bivarate normal integral calculation will be used. That is much faster than the more general numerical integration used by setQuantization.

◆ setQuantization()

static void casacore::VanVleck::setQuantization ( const Matrix< Double > &  qx,
const Matrix< Double > &  qy 
)
static

Set the x and y quantization functions.

Each matrix should have dimensions (2,n) where n is the number of levels. The first row (0,...) is the (n-1) threshold levels and the second row is the n quantizations based on those thresholds. The thresholds may include a DC offset. The (0,(n-1)) element is never used and need not be set.

◆ size()

static void casacore::VanVleck::size ( uInt  npts)
static

Set the interpolation table size.

Should be an odd number. The default size is 65.

◆ thresh()

static Double casacore::VanVleck::thresh ( Int  n,
Double  zerolag 
)
inlinestatic

Given a measured zero-lag autocorrelation and number of levels (n>=3) return the first positive quantizer input threshold level.

This can be used to set the up the matrix arguments used in setQuantization.

Definition at line 139 of file VanVleck.h.

References threshN3(), and threshNgt3().

◆ threshN3()

static Double casacore::VanVleck::threshN3 ( Double  zerolag)
inlinestaticprivate

compute first threshhold for a given zerolag for n==3

Definition at line 214 of file VanVleck.h.

References invErfc(), and casacore::sqrt().

Referenced by thresh().

◆ threshNgt3()

static Double casacore::VanVleck::threshNgt3 ( Int  n,
Double  zerolag 
)
staticprivate

compute first threshhold for a given zerolag for n>3

Referenced by thresh().

Member Data Documentation

◆ itsEquiSpaced

Bool casacore::VanVleck::itsEquiSpaced
staticprivate

Definition at line 171 of file VanVleck.h.

◆ itsInterp

Interpolate1D<Double, Double>* casacore::VanVleck::itsInterp
staticprivate

The interpolator.

Definition at line 176 of file VanVleck.h.

◆ itsNx

uInt casacore::VanVleck::itsNx
staticprivate

Definition at line 169 of file VanVleck.h.

◆ itsNy

uInt casacore::VanVleck::itsNy
staticprivate

Definition at line 169 of file VanVleck.h.

◆ itsQx0

Vector<Double> casacore::VanVleck::itsQx0
staticprivate

the quantization functions

Definition at line 179 of file VanVleck.h.

◆ itsQx0Qx0

Vector<Double> casacore::VanVleck::itsQx0Qx0
staticprivate

Useful combinations of the above - to speed up drbydrho these are -1/2*(Qx0*Qx0) and -1/2*(Qy0*Qy0) These are only used for i up to (itsQx0.nelements() and for j up to (itsQy0.nelements()).

Definition at line 185 of file VanVleck.h.

◆ itsQx0Qy0

Matrix<Double> casacore::VanVleck::itsQx0Qy0
staticprivate

This is Qx0[i]*Qy0[j].

Definition at line 187 of file VanVleck.h.

◆ itsQx1

Vector<Double> casacore::VanVleck::itsQx1
staticprivate

Definition at line 179 of file VanVleck.h.

◆ itsQx1Qy1diffs

Matrix<Double> casacore::VanVleck::itsQx1Qy1diffs
staticprivate

This is (Qx1[i+1]-Qx1[i])*(Qy1[j+1]*Qy1[j])

Definition at line 189 of file VanVleck.h.

◆ itsQy0

Vector<Double> casacore::VanVleck::itsQy0
staticprivate

Definition at line 179 of file VanVleck.h.

◆ itsQy0Qy0

Vector<Double> casacore::VanVleck::itsQy0Qy0
staticprivate

Definition at line 185 of file VanVleck.h.

◆ itsQy1

Vector<Double> casacore::VanVleck::itsQy1
staticprivate

Definition at line 179 of file VanVleck.h.

◆ itsSize

uInt casacore::VanVleck::itsSize
staticprivate

the number of points to use in setting up the interpolator

Definition at line 169 of file VanVleck.h.

◆ itsXlev

Double casacore::VanVleck::itsXlev
staticprivate

Definition at line 173 of file VanVleck.h.

◆ itsXmean

Double casacore::VanVleck::itsXmean
staticprivate

Definition at line 173 of file VanVleck.h.

◆ itsYlev

Double casacore::VanVleck::itsYlev
staticprivate

Definition at line 173 of file VanVleck.h.

◆ itsYmean

Double casacore::VanVleck::itsYmean
staticprivate

Definition at line 173 of file VanVleck.h.

◆ theirMutex

std::mutex casacore::VanVleck::theirMutex
staticprivate

The mutex to make the functions thread-safe.

Definition at line 191 of file VanVleck.h.


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