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

Data access the parameter database. More...

#include <ParmFacade.h>

Public Member Functions

 ParmFacade (const std::string &tableName, bool create=false)
 
 ~ParmFacade ()
 The destructor closes the parm table. More...
 
void addDefValues (const casacore::Record &rec, bool check=true)
 
void addValues (const casacore::Record &rec)
 
void clearTables ()
 Clear the tables, thus remove all parameter values and default values. More...
 
void deleteDefValues (const std::string &parmNamePattern)
 Delete the default value records for the given parameters. More...
 
void deleteValues (const std::string &parmNamePattern, double freqv1=-1e30, double freqv2=1e30, double timev1=-1e30, double timev2=1e30, bool asStartEnd=true)
 Delete the records for the given parameters and domain. More...
 
void flush (bool fsync=false)
 Flush the possible changes to disk. More...
 
casacore::Record getCoeff (const std::string &parmNamePattern, double freqv1=-1e30, double freqv2=1e30, double timev1=-1e30, double timev2=1e30, bool asStartEnd=true)
 
std::vector< double > getDefaultSteps () const
 Get the default step values for the frequency and time axis. More...
 
std::vector< std::string > getDefNames (const std::string &parmNamePattern=std::string()) const
 
casacore::Record getDefValues (const std::string &parmNamePattern=std::string()) const
 
std::vector< std::string > getNames (const std::string &parmNamePattern=std::string(), bool includeDefaults=false) const
 
std::vector< double > getRange (const std::string &parmNamePattern=std::string()) const
 
casacore::Record getValues (const std::string &parmNamePattern, const std::vector< double > &freqv1, const std::vector< double > &freqv2, const std::vector< double > &timev1, const std::vector< double > &timev2, bool asStartEnd=true, bool includeDefaults=false)
 
casacore::Record getValuesGrid (const std::string &parmNamePattern, double freqv1=-1e30, double freqv2=1e30, double timev1=-1e30, double timev2=1e30, bool asStartEnd=true)
 
void setDefaultSteps (const std::vector< double > &steps)
 Set the default step values for the frequency and time axis. More...
 
string version (const std::string &type) const
 Get the version info (tree, top, full or other) More...
 
std::map< std::string, std::vector< double > > getValuesMap (const std::string &parmNamePattern, double freqv1, double freqv2, double freqStep, double timev1, double timev2, double timeStep, bool asStartEnd=false, bool includeDefaults=false)
 
std::map< std::string, std::vector< double > > getValuesMap (const std::string &parmNamePattern, double freqv1, double freqv2, double timev1, double timev2, bool asStartEnd=false, bool includeDefaults=false)
 
casacore::Record getValues (const std::string &parmNamePattern, double freqv1, double freqv2, double freqStep, double timev1, double timev2, double timeStep, bool asStartEnd=true, bool includeDefaults=false)
 
casacore::Record getValues (const std::string &parmNamePattern, double freqv1=-1e30, double freqv2=1e30, double timev1=-1e30, double timev2=1e30, bool asStartEnd=true, bool includeDefaults=false)
 
void lock (bool lockForWrite)
 
void unlock ()
 

Detailed Description

Data access the parameter database.

ParmFacade is the high level interface to the Parameter Data Base. The current version assumes it is a Casacore table; with a few extra constructor arguments it can easily be changed to other types of databases. The class provides a few functions:

The parameter names can be given as a pattern. This is the same as a file name pattern that can be given in the UNIX shells (e.g. RA:*). Thus it is not a full regular expression.

Constructor & Destructor Documentation

◆ ParmFacade()

dp3::parmdb::ParmFacade::ParmFacade ( const std::string &  tableName,
bool  create = false 
)

Make a connection to the given ParmTable. If create=true, a new local ParmTable is created. Otherwise the local or distributed ParmTable must exist. A distributed ParmTable should be given by means of the VDS-file as created by the scripts setupparmdb and setupsourcedb.

◆ ~ParmFacade()

dp3::parmdb::ParmFacade::~ParmFacade ( )

The destructor closes the parm table.

Member Function Documentation

◆ addDefValues()

void dp3::parmdb::ParmFacade::addDefValues ( const casacore::Record &  rec,
bool  check = true 
)
inline

Add one or more default values. The name of each field in the record is the parameter name. The values are subrecords containing the parameter values, etc.
By default it checks if the name does not exist.

◆ addValues()

void dp3::parmdb::ParmFacade::addValues ( const casacore::Record &  rec)
inline

Add the values for the given parameter names and domain. The name of each field in the record is the parameter name. The values are subrecords containing the domains, parameter values, etc.
It checks if no values exist for the parameters and domains yet.

◆ clearTables()

void dp3::parmdb::ParmFacade::clearTables ( )
inline

Clear the tables, thus remove all parameter values and default values.

◆ deleteDefValues()

void dp3::parmdb::ParmFacade::deleteDefValues ( const std::string &  parmNamePattern)
inline

Delete the default value records for the given parameters.

◆ deleteValues()

void dp3::parmdb::ParmFacade::deleteValues ( const std::string &  parmNamePattern,
double  freqv1 = -1e30,
double  freqv2 = 1e30,
double  timev1 = -1e30,
double  timev2 = 1e30,
bool  asStartEnd = true 
)
inline

Delete the records for the given parameters and domain.

◆ flush()

void dp3::parmdb::ParmFacade::flush ( bool  fsync = false)
inline

Flush the possible changes to disk.

◆ getCoeff()

casacore::Record dp3::parmdb::ParmFacade::getCoeff ( const std::string &  parmNamePattern,
double  freqv1 = -1e30,
double  freqv2 = 1e30,
double  timev1 = -1e30,
double  timev2 = 1e30,
bool  asStartEnd = true 
)
inline

Get the coefficients and possible errors for the given parameters and domains. The Record contains a map of parameter name to a subrecord. The subrecord contains a map of 'v_i' to a subrecord where v_i represents the i-th domain. Each subrecord contains the fields coeff, error, and domain. Each of these fields contain an array of doubles containing the values. The error array is empty if no errors are stored.

◆ getDefaultSteps()

std::vector<double> dp3::parmdb::ParmFacade::getDefaultSteps ( ) const
inline

Get the default step values for the frequency and time axis.

◆ getDefNames()

std::vector<std::string> dp3::parmdb::ParmFacade::getDefNames ( const std::string &  parmNamePattern = std::string()) const
inline

Get default parameter names in the table matching the pattern. An empty name pattern is the same as * (all parm names).

◆ getDefValues()

casacore::Record dp3::parmdb::ParmFacade::getDefValues ( const std::string &  parmNamePattern = std::string()) const
inline

Get default values of parameters in the table matching the pattern. An empty name pattern is the same as * (all parm names).

◆ getNames()

std::vector<std::string> dp3::parmdb::ParmFacade::getNames ( const std::string &  parmNamePattern = std::string(),
bool  includeDefaults = false 
) const
inline

Get parameter names in the table matching the pattern. An empty name pattern is the same as * (all parm names).

◆ getRange()

std::vector<double> dp3::parmdb::ParmFacade::getRange ( const std::string &  parmNamePattern = std::string()) const
inline

Get the domain range (as startx,endx,starty,endy) of the given parameters in the table. This is the minimum start value and maximum end value for all parameters. An empty name pattern is the same as * (all parm names).

◆ getValues() [1/3]

casacore::Record dp3::parmdb::ParmFacade::getValues ( const std::string &  parmNamePattern,
const std::vector< double > &  freqv1,
const std::vector< double > &  freqv2,
const std::vector< double > &  timev1,
const std::vector< double > &  timev2,
bool  asStartEnd = true,
bool  includeDefaults = false 
)
inline

Get the values of the given parameters on the given grid where v1/v2 represents center/width or start/end. The Record contains a map of parameter name to Array<double>.

◆ getValues() [2/3]

casacore::Record dp3::parmdb::ParmFacade::getValues ( const std::string &  parmNamePattern,
double  freqv1,
double  freqv2,
double  freqStep,
double  timev1,
double  timev2,
double  timeStep,
bool  asStartEnd = true,
bool  includeDefaults = false 
)
inline

Get the values of the given parameters on the given regular grid where v1/v2 represents center/width or start/end. The Record contains a map of parameter name to Array<double>. If freqStep and timeStep are not given (or given as <=0), the default freq and time step from the ParmDB will be used.

◆ getValues() [3/3]

casacore::Record dp3::parmdb::ParmFacade::getValues ( const std::string &  parmNamePattern,
double  freqv1 = -1e30,
double  freqv2 = 1e30,
double  timev1 = -1e30,
double  timev2 = 1e30,
bool  asStartEnd = true,
bool  includeDefaults = false 
)

◆ getValuesGrid()

casacore::Record dp3::parmdb::ParmFacade::getValuesGrid ( const std::string &  parmNamePattern,
double  freqv1 = -1e30,
double  freqv2 = 1e30,
double  timev1 = -1e30,
double  timev2 = 1e30,
bool  asStartEnd = true 
)
inline

Get the values of the given parameters for the given domain. The Record contains a map of parameter name to subrecords. Each subrecord has the fields values, freqs, freqwidths, times, and timewidths giving the values and domains. The domain values are the center and width of each cell.

◆ getValuesMap() [1/2]

std::map<std::string, std::vector<double> > dp3::parmdb::ParmFacade::getValuesMap ( const std::string &  parmNamePattern,
double  freqv1,
double  freqv2,
double  freqStep,
double  timev1,
double  timev2,
double  timeStep,
bool  asStartEnd = false,
bool  includeDefaults = false 
)

Get the values of the given parameters on the given regular grid where v1/v2 represents center/width or start/end. The vector values in the map are in fact 2-dim arrays with axes freq and time. If freqStep and timeStep are not given (or given as <=0), the default freq and time step from the ParmDB will be used.

◆ getValuesMap() [2/2]

std::map<std::string, std::vector<double> > dp3::parmdb::ParmFacade::getValuesMap ( const std::string &  parmNamePattern,
double  freqv1,
double  freqv2,
double  timev1,
double  timev2,
bool  asStartEnd = false,
bool  includeDefaults = false 
)
inline

◆ lock()

void dp3::parmdb::ParmFacade::lock ( bool  lockForWrite)
inline

The following functions are only implemented for a local ParmDB. The ParmFacadeDistr functions throw an exception. Writelock and unlock the database tables. The user does not need to lock/unlock, but it can increase performance if many small accesses have to be done.

◆ setDefaultSteps()

void dp3::parmdb::ParmFacade::setDefaultSteps ( const std::vector< double > &  steps)
inline

Set the default step values for the frequency and time axis.

◆ unlock()

void dp3::parmdb::ParmFacade::unlock ( )
inline

◆ version()

string dp3::parmdb::ParmFacade::version ( const std::string &  type) const

Get the version info (tree, top, full or other)


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