DP3
Public Member Functions | Static Public Member Functions | List of all members
dp3::parmdb::Parm Class Reference

Class giving access to a parameter. More...

#include <Parm.h>

Public Member Functions

 Parm (ParmCache &, const std::string &name)
 
 Parm (ParmCache &, ParmId parmid)
 Construct the object for the given parmid. More...
 
void calcPerturbations ()
 Calculate the perturbations. More...
 
std::vector< double > getCoeff (const Grid::Location &, bool useMask=true)
 
unsigned int getCoeffSize (bool useMask=true)
 Get the nr of coefficients. More...
 
std::vector< double > getErrors (const Grid::Location &, bool useMask=true)
 
double getPerturbation (unsigned int index)
 Get a particular perturbation. More...
 
const std::vector< double > & getPerturbations () const
 
void getResult (casacore::Array< double > &result, const Grid &predictGrid, bool emptyResult=false)
 
void getResult (std::vector< casacore::Array< double >> &result, const Grid &predictGrid, bool perturb)
 
void revertCoeff ()
 
void setCoeff (const Grid::Location &, const double *values, unsigned int nvalues, const double *errors=nullptr, bool useMask=true)
 
void setSolveGrid (const Grid &solveGrid)
 

Static Public Member Functions

static std::vector< double > copyValues (const casacore::Array< double > &values, const casacore::Array< bool > &mask, bool useMask)
 Form the vector from values and mask. More...
 
static void fillArrayPV (double *resData, int nrx, int stx, int sty, int endx, int endy, const double *data, const ParmValue &pval, const Grid &predictGrid)
 Fill the result array partially for a single ParmValue. More...
 
static void getResultCoeff (casacore::Array< double > *resultVec, const Grid &predictGrid, const ParmValueSet &pvset, const std::vector< double > &perturbations, AxisMappingCache &axisMappingCache)
 Evaluate the result for funklet coefficients. More...
 
static void getResultScalar (casacore::Array< double > &result, casacore::Array< double > *errors, const Grid &predictGrid, const ParmValueSet &pvset, AxisMappingCache &axisMappingCache)
 
static void getResultScalar (casacore::Array< double > &result, const Grid &predictGrid, const ParmValue &pval, AxisMappingCache &axisMappingCache)
 Get the result for a single ParmValue with an array of scalars. More...
 

Detailed Description

Class giving access to a parameter.

Parm makes it possible to get the parameter values for a given predict domain. It uses a ParmCache to cache parameters for a work domain. If a parameter is solvable, the solve grid must have been set before getting the values and perturbed values. For solvable parameters it is also possible to get or set the coefficients for each cell in the solve grid. Parameter values are read from the ParmDB tables. If there are no values for a parameter/domain, the appropriate value from the subtable with default values is used. However, for a solvable parameter, the value of the previous solve domain is used as long as that solve domain is part of the work domain. Thus for a given work domain, the first solve domain uses the default values, while the next domains use the values of the previous domains.

Constructor & Destructor Documentation

◆ Parm() [1/2]

dp3::parmdb::Parm::Parm ( ParmCache ,
ParmId  parmid 
)

Construct the object for the given parmid.

◆ Parm() [2/2]

dp3::parmdb::Parm::Parm ( ParmCache ,
const std::string &  name 
)

Construct the object for the given parm name. It must have been added to the ParmSet used by the ParmCache.

Member Function Documentation

◆ calcPerturbations()

void dp3::parmdb::Parm::calcPerturbations ( )

Calculate the perturbations.

◆ copyValues()

static std::vector<double> dp3::parmdb::Parm::copyValues ( const casacore::Array< double > &  values,
const casacore::Array< bool > &  mask,
bool  useMask 
)
static

Form the vector from values and mask.

◆ fillArrayPV()

static void dp3::parmdb::Parm::fillArrayPV ( double *  resData,
int  nrx,
int  stx,
int  sty,
int  endx,
int  endy,
const double *  data,
const ParmValue pval,
const Grid predictGrid 
)
static

Fill the result array partially for a single ParmValue.

◆ getCoeff()

std::vector<double> dp3::parmdb::Parm::getCoeff ( const Grid::Location ,
bool  useMask = true 
)

Get the coefficients for the given location in the solve grid. The solve grid must have been set before.

◆ getCoeffSize()

unsigned int dp3::parmdb::Parm::getCoeffSize ( bool  useMask = true)

Get the nr of coefficients.

◆ getErrors()

std::vector<double> dp3::parmdb::Parm::getErrors ( const Grid::Location ,
bool  useMask = true 
)

Get the errors for the given location in the solve grid. The solve grid must have been set before.

◆ getPerturbation()

double dp3::parmdb::Parm::getPerturbation ( unsigned int  index)
inline

Get a particular perturbation.

◆ getPerturbations()

const std::vector<double>& dp3::parmdb::Parm::getPerturbations ( ) const
inline

Get the perturbations for the coefficients. The possible mask is applied.

◆ getResult() [1/2]

void dp3::parmdb::Parm::getResult ( casacore::Array< double > &  result,
const Grid predictGrid,
bool  emptyResult = false 
)

Get the result for the given grid. No perturbed values are calculated. Normally the result has the same shape as the predict grid. However, if there is a single constant value, it has shape [1,1]. In the future it might also get shape[nx,1] or [1,ny] in case the values are constant in y or x.
The array will be resized if needed. Note that it is possible to first create a correctly sized MeqMatrix and create the Array from its raw storage. In that way the Array data does not need to be copied to the MeqMatrix.
The argumentemptyResult tells if an empty result can be returned. Normally this is not the case (otherwise a default would not be picked up), but in case of ParmFacade it is used.

◆ getResult() [2/2]

void dp3::parmdb::Parm::getResult ( std::vector< casacore::Array< double >> &  result,
const Grid predictGrid,
bool  perturb 
)

Get the values for the given predict grid. The parm value is taken that contains the middle of a predict interval. If perturb=true, all perturbed values are calculated as well. Otherwise only the first array in the vector is filled in. As above, the shape of the array is normally [nx,ny], but can be [1,1] if constant.

◆ getResultCoeff()

static void dp3::parmdb::Parm::getResultCoeff ( casacore::Array< double > *  resultVec,
const Grid predictGrid,
const ParmValueSet pvset,
const std::vector< double > &  perturbations,
AxisMappingCache axisMappingCache 
)
static

Evaluate the result for funklet coefficients.

◆ getResultScalar() [1/2]

static void dp3::parmdb::Parm::getResultScalar ( casacore::Array< double > &  result,
casacore::Array< double > *  errors,
const Grid predictGrid,
const ParmValueSet pvset,
AxisMappingCache axisMappingCache 
)
static

Get the result for multiple ParmValues containing scalars. If the errors argument is non-zero, the errors are filled too.

◆ getResultScalar() [2/2]

static void dp3::parmdb::Parm::getResultScalar ( casacore::Array< double > &  result,
const Grid predictGrid,
const ParmValue pval,
AxisMappingCache axisMappingCache 
)
static

Get the result for a single ParmValue with an array of scalars.

◆ revertCoeff()

void dp3::parmdb::Parm::revertCoeff ( )

Revert to the original coefficients (as on disk). (not implemented yet). It clears the dirty flag.

◆ setCoeff()

void dp3::parmdb::Parm::setCoeff ( const Grid::Location ,
const double *  values,
unsigned int  nvalues,
const double *  errors = nullptr,
bool  useMask = true 
)

Set the coefficients for the given location in the solve grid. If given, the errors are set too. The solve grid must have been set before. It sets the dirty flag, so the data are written when the ParmCache is flushed.

◆ setSolveGrid()

void dp3::parmdb::Parm::setSolveGrid ( const Grid solveGrid)

Set the solve domains for the parm. For an existing parm it must match the parm domains. For a new parm it creates the domains.


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