10 #ifndef LOFAR_PARMDB_PARMVALUE_H
11 #define LOFAR_PARMDB_PARMVALUE_H
16 #include <casacore/casa/Arrays/Array.h>
42 typedef std::shared_ptr<ParmValue>
ShPtr;
82 unsigned int nx()
const {
83 return static_cast<unsigned int>(itsValues.shape()[0]);
85 unsigned int ny()
const {
86 return static_cast<unsigned int>(itsValues.shape()[1]);
92 const casacore::Array<double>&
getValues()
const {
return itsValues; }
93 casacore::Array<double>&
getValues() {
return itsValues; }
104 const casacore::Array<double>&
getErrors()
const {
return *itsErrors; }
105 casacore::Array<double>&
getErrors() {
return *itsErrors; }
117 static casacore::Matrix<double>
scale2(
const casacore::Matrix<double>& coeff,
118 double offx,
double offy,
119 double scalex,
double scaley);
124 bool rescale(
double sx,
double ex,
double sy,
double ey,
125 const Box& oldDomain);
133 static void fillPascal(casacore::Matrix<double>& pascal,
int order);
137 casacore::Array<double> itsValues;
138 casacore::Array<double>* itsErrors;
155 double perturbation = 1e-6,
bool pertRel =
true,
156 const Box& scaleDomain =
Box());
162 const std::vector<ParmValue::ShPtr>& values,
165 double perturbation = 1e-6,
bool pertRel =
true);
185 return itsSolvableMask;
188 itsSolvableMask.assign(mask);
202 unsigned int size()
const {
return itsValues.size(); }
205 bool empty()
const {
return itsValues.size() == 0; }
232 void setDirty(
bool dirty =
true) { itsDirty = dirty; }
238 void createValues(
const Grid& solveGrid);
239 void checkGrid(
const Grid& solveGrid);
240 void addValues(
const Grid& solveGrid);
241 void addCoeffValues(
const Grid& solveGrid);
247 double itsPerturbation;
249 casacore::Array<bool> itsSolvableMask;
251 std::vector<ParmValue::ShPtr> itsValues;
Classes representing a regular or irregular axis.
Class representing a regular or irregular 2-D grid.
Class representing a 2-dim box.
Definition: Box.h:36
The envelope class for a 2-D grid with regular or irregular axes. -.
Definition: Grid.h:83
A class holding information of multiple domains of a parameter. ParmValueSet holds the information of...
Definition: ParmValue.h:146
void setSolvableMask(const casacore::Array< bool > &mask)
Definition: ParmValue.h:187
ParmValueSet(const ParmValue &defaultValue=ParmValue(), ParmValue::FunkletType=ParmValue::Scalar, double perturbation=1e-6, bool pertRel=true, const Box &scaleDomain=Box())
const Grid & getGrid() const
Get access to the grid info, so a domain can be looked up.
Definition: ParmValue.h:199
bool empty() const
No ParmValues?
Definition: ParmValue.h:205
void setDirty(bool dirty=true)
Definition: ParmValue.h:232
unsigned int size() const
Get the nr of ParmValues.
Definition: ParmValue.h:202
ParmValueSet(const ParmValueSet &)
Copy constructor.
const ParmValue & getFirstParmValue() const
const ParmValue & getParmValue(int i) const
Definition: ParmValue.h:222
const ParmValue & getDefParmValue() const
Get the default ParmValue.
Definition: ParmValue.h:208
bool isDirty() const
Definition: ParmValue.h:231
const casacore::Array< bool > & getSolvableMask() const
Definition: ParmValue.h:184
void setScaleDomain(const Box &domain)
Definition: ParmValue.h:213
ParmValue & getParmValue(int i)
Definition: ParmValue.h:223
ParmValueSet(const Grid &domainGrid, const std::vector< ParmValue::ShPtr > &values, const ParmValue &defaultValue=ParmValue(), ParmValue::FunkletType type=ParmValue::Scalar, double perturbation=1e-6, bool pertRel=true)
void setSolveGrid(const Grid &solveGrid)
double getPerturbation() const
Get the perturbation value.
Definition: ParmValue.h:193
bool getPertRel() const
Is the perturbation relative or absolute?
Definition: ParmValue.h:196
ParmValue::FunkletType getType() const
Get the funklet type.
Definition: ParmValue.h:179
ParmValueSet & operator=(const ParmValueSet &)
Assignment.
const Box & getScaleDomain() const
Definition: ParmValue.h:212
A class containing the values of a parameter.
Definition: ParmValue.h:39
const Grid & getGrid() const
Get the grid.
Definition: ParmValue.h:97
const casacore::Array< double > & getValues() const
Definition: ParmValue.h:92
int getRowId() const
Definition: ParmValue.h:110
void setScalars(const Grid &, const casacore::Array< double > &)
casacore::Array< double > & getErrors()
Definition: ParmValue.h:105
ParmValue(const ParmValue &)
Copy constructor makes a deep copy.
std::shared_ptr< ParmValue > ShPtr
Define a shared pointer for this type.
Definition: ParmValue.h:42
FunkletType
Define the possible funklet types.
Definition: ParmValue.h:45
@ Scalar
A constant scalar.
Definition: ParmValue.h:47
@ Polc
A polynomial.
Definition: ParmValue.h:49
@ PolcLog
A polynomial of logs.
Definition: ParmValue.h:51
void clearRowId()
Definition: ParmValue.h:112
unsigned int ny() const
Definition: ParmValue.h:85
void setRowId(int rowId)
Definition: ParmValue.h:111
bool rescale(double sx, double ex, double sy, double ey, const Box &oldDomain)
static casacore::Matrix< double > scale2(const casacore::Matrix< double > &coeff, double offx, double offy, double scalex, double scaley)
ParmValue(double value=0.)
Construct with the given scalar value.
void setErrors(const casacore::Array< double > &)
void setScalar(double value)
Set as a single scalar value.
bool hasErrors() const
Are there errors? If false, the result of getErrors is undefined.
Definition: ParmValue.h:100
unsigned int nx() const
Definition: ParmValue.h:82
const casacore::Array< double > & getErrors() const
Definition: ParmValue.h:104
void setCoeff(const casacore::Array< double > &)
Set as an array of coefficients.
casacore::Array< double > & getValues()
Definition: ParmValue.h:93
ParmValue & operator=(const ParmValue &)
Assignment makes a deep copy.
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53