62 virtual bool isValid()
const = 0;
86 virtual unsigned int size()
const = 0;
89 virtual double at(
unsigned int i)
const = 0;
109 virtual unsigned int size()
const = 0;
112 virtual double xAt(
unsigned int i)
const = 0;
115 virtual double yAt(
unsigned int i)
const = 0;
118 virtual bool minsMaxes(
double& xMin,
double& xMax,
double& yMin,
129 virtual void xAndYAt(
unsigned int index,
double& x,
double& y)
const;
145 virtual unsigned int sizeMasked()
const = 0;
148 virtual unsigned int sizeUnmasked()
const = 0;
151 virtual bool maskedAt(
unsigned int index)
const = 0;
154 virtual bool maskedMinsMaxes(
double& xMin,
double& xMax,
double& yMin,
158 virtual bool unmaskedMinsMaxes(
double& xMin,
double& xMax,
double& yMin,
163 virtual bool reverseConnect(
unsigned int index)
const = 0;
166 virtual bool plotConjugates()
const = 0;
172 virtual void xyAndMaskAt(
unsigned int index,
double& x,
double& y,
199 virtual double yTopErrorAt(
unsigned int i)
const = 0;
202 virtual bool errorMaxes(
double& xLeft,
double& xRight,
double& yBottom,
210 virtual void xyAndErrorsAt(
unsigned int index,
double& x,
double& y,
211 double& xLeftError,
double& xRightError,
double& yBottomError,
212 double& yTopError)
const;
232 virtual unsigned int numBins()
const = 0;
236 virtual unsigned int binAt(
unsigned int i)
const = 0;
288 virtual void setXRange(
double from,
double to) = 0;
291 virtual void setYRange(
double from,
double to) = 0;
297 virtual double valueAt(
double x,
double y)
const = 0;
318 m_arraySize(0), m_shouldDelete(false) { }
323 m_vector(&value), m_cvector(NULL), m_array(NULL), m_arraySize(0),
324 m_shouldDelete(shouldDelete) {
325 recalculateMinMax(); }
327 m_vector(NULL), m_cvector(&value), m_array(NULL), m_arraySize(0),
328 m_shouldDelete(shouldDelete) {
329 recalculateMinMax(); }
331 m_vector(NULL), m_cvector(NULL), m_array(value), m_arraySize(size),
332 m_shouldDelete(shouldDelete) {
333 recalculateMinMax(); }
339 if(m_vector != NULL)
delete m_vector;
340 if(m_cvector != NULL)
delete m_cvector;
341 if(m_array != NULL)
delete m_array;
348 return m_vector != NULL || m_cvector != NULL || m_array != NULL; }
358 if(m_vector != NULL)
return m_vector->size();
359 if(m_cvector != NULL)
return m_cvector->size();
360 if(m_array != NULL)
return m_arraySize;
365 double at(
unsigned int i)
const {
366 if(m_vector != NULL)
return (
double)(*m_vector)[i];
367 if(m_cvector != NULL)
return (
double)(*m_cvector)[i];
368 if(m_array != NULL)
return (
double)m_array[i];
374 if(!isValid() ||
size() == 0)
return false;
375 min = m_min; max = m_max;
382 if(!isValid())
return;
383 unsigned int n =
size();
385 double temp = (double)at(0);
386 m_min = m_max = temp;
387 if(m_vector != NULL) {
388 for(
unsigned int i = 1; i < n; i++) {
389 temp = (double)(*m_vector)[i];
390 if(temp < m_min) m_min = temp;
391 if(temp > m_max) m_max = temp;
393 }
else if(m_cvector != NULL) {
394 for(
unsigned int i = 1; i < n; i++) {
395 temp = (double)(*m_cvector)[i];
396 if(temp < m_min) m_min = temp;
397 if(temp > m_max) m_max = temp;
399 }
else if(m_array != NULL) {
400 for(
unsigned int i = 1; i < n; i++) {
401 temp = (double)m_array[i];
402 if(temp < m_min) m_min = temp;
403 if(temp > m_max) m_max = temp;
448 m_yData(y, size, shouldDel) { }
477 double xAt(
unsigned int i)
const {
486 bool minsMaxes(
double& xMin,
double& xMax,
double& yMin,
double& yMax) {
490 return m_yData.minMax(yMin, yMax);
535 virtual double xAt(
unsigned int i)
const;
538 virtual double yAt(
unsigned int i)
const;
541 virtual bool minsMaxes(
double& xMin,
double& xMax,
double& yMin,
549 virtual unsigned int numBins()
const;
570 bool shouldDelete =
false) :
575 bool shouldDelete =
false) :
580 bool shouldDel =
false) :
589 bool shouldDelete =
false) :
594 bool shouldDelete =
false) :
599 bool shouldDel =
false) :
660 unsigned int n =
size();
661 unsigned int count = 0;
678 double& yMax,
bool masked) {
680 unsigned int n =
size();
681 if(n == 0)
return false;
689 if((masked && m) || (!masked && !m)) {
690 xMin = xMax =
xAt(i);
691 yMin = yMax =
yAt(i);
695 if(i == n)
return false;
699 if((masked && m) || (!masked && !m)) {
701 if(temp < xMin) xMin = temp;
702 if(temp > xMax) xMax = temp;
704 if(temp < yMin) yMin = temp;
705 if(temp > yMax) yMax = temp;
727 T xRightError, T yBottomError, T yTopError,
732 T xRightError, T yBottomError, T yTopError,
737 T xRightError, T yBottomError, T yTopError,
738 bool shouldDelete =
false) :
755 bool shouldDelete =
false) :
772 bool shouldDelete =
false) :
790 bool errorMaxes(
double& xLeft,
double& xRight,
double& yBottom,
818 bool shouldDelete =
true) :
820 m_xError(xError, xError, size, shouldDelete),
821 m_yError(yError, yError, size, shouldDelete) { }
823 std::vector<T>& yError,
bool shouldDelete =
false) :
825 m_xError(xError, xError, shouldDelete),
826 m_yError(yError, yError, shouldDelete) { }
830 m_xError(xError, xError, shouldDelete),
831 m_yError(yError, yError, shouldDelete) { }
837 T*& yBottomError, T*& yTopError,
unsigned int size,
838 bool shouldDelete =
true) :
840 m_xError(xLeftError, xRightError, size, shouldDelete),
841 m_yError(yBottomError, yTopError, size, shouldDelete) { }
843 std::vector<T>& xRightError, std::vector<T>& yBottomError,
844 std::vector<T>& yTopError,
bool shouldDelete =
false) :
846 m_xError(xLeftError, xRightError, shouldDelete),
847 m_yError(yBottomError, yTopError, shouldDelete) { }
852 m_xError(xLeftError, xRightError, shouldDelete),
853 m_yError(yBottomError, yTopError, shouldDelete) { }
880 bool errorMaxes(
double& xLeft,
double& xRight,
double& yBottom,
883 return m_xError.minsMaxes(temp, xLeft, temp, xRight) &&
884 m_yError.minsMaxes(temp, yBottom, temp, yTop);
910 unsigned int n0 = shape[0] - 1, n1 = shape[1] - 1;
919 double val =
static_cast<double>(
data(0, 0));
923 val =
static_cast<double>(
data(i, j));
965 if(from == to)
return;
985 if(from == to)
return;
1009 if(x < m_0From || x >
m_0To || y < m_1From || y >
m_1To)
return 0;
1013 if(xi >=
m_data->shape()[0]) xi =
m_data->shape()[0] - 1;
1014 if(yi >=
m_data->shape()[1]) yi =
m_data->shape()[1] - 1;
1016 return static_cast<double>((*m_data)(xi, yi));
1019 if(x < m_1From || x >
m_1To || y < m_0From || y >
m_0To)
return 0;
1023 if(xi >=
m_data->shape()[1]) xi =
m_data->shape()[1] - 1;
1024 if(yi >=
m_data->shape()[0]) yi =
m_data->shape()[0] - 1;
1026 return static_cast<double>((*m_data)(yi, xi));
1032 std::vector<double>* v =
new std::vector<double>();
1036 for(
unsigned int i = 0; i <
m_data->nrow() && v->size() <=
max; i++) {
1037 for(
unsigned int j = 0; j <
m_data->ncolumn() && v->size() <=
max;
1039 val =
static_cast<double>((*m_data)(i, j));
1041 for(
unsigned int k = 0; k < v->size() && !found; k++)
1042 if(v->at(k) == val) found =
true;
1043 if(!found) v->push_back(val);
Specialized subclass of PlotPointData that creates histogram data from single point data...
double yAt(unsigned int i) const
Implements PlotPointData::yAt().
std::vector< prange_t > m_ranges
A Vector of integers, for indexing into Array<T> objects.
void setDeleteData(bool del=true)
Overrides PlotPointDataImpl::setDeleteData().
A single source of data that basically provides indexing of its values.
A 1-D Specialization of the Array class.
PlotSingleDataImpl()
Invalid data constructor.
PlotErrorDataImpl< float > PlotErrorFloatData
PlotMaskedPointDataImpl(std::vector< T > &x, std::vector< T > &y, std::vector< bool > &mask, bool shouldDelete=false)
X/Y constructors.
bool errorMaxes(double &xLeft, double &xRight, double &yBottom, double &yTop)
Implements PlotErrorData::errorMaxes().
virtual double xAt(unsigned int i) const
Implements PlotPointData::xAt().
casacore::Matrix< T > * matrix()
Gets/sets the matrix.
PlotScalarErrorDataImpl(T *&x, T *&y, unsigned int size, T error, bool shouldDelete=false)
virtual prange_t rangeAt(unsigned int i) const
Returns the range at the given index.
virtual double valueAt(double x, double y) const =0
Returns the data value at the given (x,y) coordinate.
size_t nrow() const
The number of rows in the Matrix, i.e.
bool isValid() const
Implements PlotData::isValid().
double xRightErrorAt(unsigned int) const
PlotErrorDataImpl< double > PlotErrorDoubleData
const IPosition & shape() const
The length of each axis of the Matrix.
virtual prange_t xRange() const =0
Returns the range of x.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
casacore::Vector< T > * m_cvector
Indexing
Whether the indexing is (row,col) or (x,y).
Implementation of raster data using casa::Matrix.
prange_t valueRange() const
Implements PlotRasterData::valueRange().
PlotPointDataImpl< float > PlotPointFloatData
void setDeleteData(bool del=true)
Implements PlotData::setDeleteData().
double xLeftErrorAt(unsigned int) const
Implements PlotErrorData getter methods.
~PlotScalarErrorDataImpl()
Destructor.
A source of data used to supply x and y values.
PlotSingleDataImpl< T > m_yData
virtual void setDeleteData(bool del=true)
Implements PlotData::setDeleteData().
PlotMaskedPointDataImpl(casacore::Vector< T > &x, casacore::Vector< T > &y, casacore::Vector< bool > &mask, bool shouldDelete=false)
PlotScalarErrorDataImpl(casacore::Vector< T > &x, casacore::Vector< T > &y, T xError, T yError, bool shouldDelete=false)
casacore::Vector< bool > * m_maskCVector
PlotErrorDataImpl(std::vector< T > &x, std::vector< T > &y, std::vector< T > &xError, std::vector< T > &yError, bool shouldDelete=false)
PlotSingleDataImpl(std::vector< T > &value, bool shouldDelete=false)
casacore::Data using different standard containers.
PlotPointDataImpl(T *&y, unsigned int size, bool shouldDel=false)
virtual void setDeleteData(bool del=true)
Implements PlotData::setDeleteData().
PlotErrorDataImpl< int > PlotErrorIntData
virtual unsigned int binAt(unsigned int i) const =0
Returns the bin index number for the given index.
virtual ~PlotRasterData()
unsigned int size() const
Implements PlotSingleData::size().
casacore::Matrix< T > * m_data
void setMatrix(casacore::Matrix< T > *m, bool shouldDelete=true)
PlotScalarErrorDataImpl< float > PlotScalarErrorFloatData
PlotPointDataImpl< T > m_xError
A 2-D Specialization of the Array class.
virtual unsigned int size() const
Implements PlotPointData::size().
unsigned int sizeMaskedOrUnmasked(bool masked) const
Helper for size.
PlotSingleDataImpl(T *&value, unsigned int size, bool shouldDelete=false)
PlotPointDataImpl< double > PlotPointDoubleData
virtual prange_t valueRange() const =0
Returns the range of the data values.
Default implementation of PlotErrorData using standard containers, plus PlotPointDataImpls for the er...
virtual double yAt(unsigned int i) const
Implements PlotPointData::yAt().
void setDeleteData(bool del=true)
Implements PlotData::setDeleteData().
virtual double xLeftErrorAt(unsigned int i) const =0
ABSTRACT METHODS //.
PlotScalarErrorDataImpl(casacore::Vector< T > &x, casacore::Vector< T > &y, T xLeftError, T xRightError, T yBottomError, T yTopError, bool shouldDelete=false)
PlotErrorDataImpl< unsigned int > PlotErrorUIntData
void setXRange(double from, double to)
Implements PlotRasterData::setXRange().
Default implementation of PlotPointData that supports raw arrays, vectors, and CASA Vectors...
virtual bool willDeleteData() const =0
Returns whether this object will delete its underlying data structures upon deconstruction or not...
virtual bool isBinned() const
IMPLEMENTED METHODS //.
Default implementation of PlotMaskedPointData using default containers.
PlotPointDataImpl< int > PlotPointIntData
PlotSingleDataImpl< double > PlotSingleDoubleData
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
virtual bool isValid() const =0
ABSTRACT METHODS //.
bool getMaskedOrUnmaskedMinsMaxes(double &xMin, double &xMax, double &yMin, double &yMax, bool masked)
Helper for mins/maxes.
virtual unsigned int size() const =0
ABSTRACT METHODS //.
PlotSingleDataImpl< float > PlotSingleFloatData
virtual bool plotConjugates() const
Returns whether to plot conjugate data (e.g.
PlotErrorDataImpl(std::vector< T > &x, std::vector< T > &y, std::vector< T > &xLeftError, std::vector< T > &xRightError, std::vector< T > &yBottomError, std::vector< T > &yTopError, bool shouldDelete=false)
Indexing indexing() const
Gets/sets the indexing used for the matrix.
PlotPointDataImpl(casacore::Vector< T > &x, casacore::Vector< T > &y, bool shouldDelete=false)
bool isValid() const
Implements PlotData::isValid().
~PlotMaskedPointDataImpl()
Destructor.
virtual void setYRange(double from, double to)=0
Sets the range of y.
casacore::CountedPtr< PlotData > PlotDataPtr
PlotMaskedPointDataImpl< unsigned int > PlotMaskedPointUIntData
void setDeleteData(bool del=true)
Overrides PlotPointDataImpl::setDeleteData().
virtual bool reverseConnect(unsigned int) const
Returns whether data is plotted in reverse order (right to left), needed when connecting points...
unsigned int sizeUnmasked() const
Implements PlotMaskedPointData::sizeUnmasked().
bool minMax(double &min, double &max)
Implements PlotSingleData::minMax().
Referenced counted pointer for constant data.
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
prange_t xRange() const
Implements PlotRasterData::xRange().
PlotPointDataImpl(std::vector< T > &x, std::vector< T > &y, bool shouldDelete=false)
X/Y constructors.
PlotErrorDataImpl(T *&x, T *&y, T *&xLeftError, T *&xRightError, T *&yBottomError, T *&yTopError, unsigned int size, bool shouldDelete=true)
Asymmetric error constructors.
bool minsMaxes(double &xMin, double &xMax, double &yMin, double &yMax)
Implements PlotPointData::minsMaxes().
virtual ~PlotHistogramData()
Destructor.
virtual bool minMax(double &min, double &max)=0
Gets the minimum and maximum values.
virtual void recalculateBins(unsigned int numBins)
Recalculates the histogram data into the given number of bins.
virtual prange_t yRange() const =0
Returns the range of y.
PlotSingleDataImpl< T > m_xData
std::vector< double > * colorBarValues(unsigned int max=1000) const
Implements PlotRasterData::colorBarValues().
double xAt(unsigned int i) const
Implements PlotPointData::xAt().
virtual ~PlotBinnedData()
Destructor.
PlotScalarErrorDataImpl(std::vector< T > &x, std::vector< T > &y, T error, bool shouldDelete=false)
Single error for all values.
PlotScalarErrorDataImpl(std::vector< T > &x, std::vector< T > &y, T xError, T yError, bool shouldDelete=false)
Single error for x and y.
virtual bool willDeleteData() const
Implements PlotData::willDeleteData().
double yBottomErrorAt(unsigned int) const
virtual unsigned int numBins() const
Returns the current number of histogram bins.
PlotMaskedPointDataImpl(std::vector< T > &y, std::vector< bool > &mask, bool shouldDelete=false)
Y constructors.
PlotPointDataImpl< T > m_yError
PlotPointDataImpl< unsigned int > PlotPointUIntData
PlotSingleDataImpl< int > PlotSingleIntData
PlotErrorDataImpl(T *&x, T *&y, T *&xError, T *&yError, unsigned int size, bool shouldDelete=true)
Symmetric error constructors.
bool maskedMinsMaxes(double &xMin, double &xMax, double &yMin, double &yMax)
Implements PlotMaskedPointData::maskedMinsMaxes().
Origin
casacore::Data for raster plots, which can be thought of as three-dimensional.
virtual double at(unsigned int i) const =0
Returns the value at given index.
PlotScalarErrorDataImpl< int > PlotScalarErrorIntData
size_t ncolumn() const
The number of columns in the Matrix, i.e.
PlotSingleDataImpl< unsigned int > PlotSingleUIntData
PlotMaskedPointDataImpl< float > PlotMaskedPointFloatData
virtual void setDeleteData(bool del=true)=0
Sets whether this object will delete its underlying data structures upon deconstruction or not...
double yTopErrorAt(unsigned int i) const
virtual double yBottomErrorAt(unsigned int i) const =0
Returns the "bottom" error for y at the given index.
PlotErrorDataImpl(casacore::Vector< T > &x, casacore::Vector< T > &y, casacore::Vector< T > &xError, casacore::Vector< T > &yError, bool shouldDelete=false)
virtual void setXRange(double from, double to)=0
Sets the range of x.
virtual void setOrigin(Origin o)=0
Sets the data origin.
virtual void xyAndErrorsAt(unsigned int index, double &x, double &y, double &xLeftError, double &xRightError, double &yBottomError, double &yTopError) const
IMPLEMENTED METHODS //.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
unsigned int size() const
Implements PlotPointData::size().
std::vector< unsigned int > m_bins
INHERITANCE_POINTER2(PlotLayoutSingle, PlotLayoutSinglePtr, PlotCanvasLayout, PlotCanvasLayoutPtr) INHERITANCE_POINTER2(PlotLayoutGrid
virtual Origin origin() const =0
ABSTRACT METHODS //.
prange_t yRange() const
Implements PlotRasterData::yRange().
std::pair< double, double > ppoint_t
Typedef for a point, which is two doubles (x and y).
PlotPointDataImpl(std::vector< T > &y, bool shouldDelete=false)
Y constructors.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of but is it too vague to be useful Since the interface is meant to be a simple it may be better to restrict PlotData to be more like PlotPointData
std::pair< double, double > prange_t
Typedef for range, which is two doubles (min and max).
PlotScalarErrorDataImpl(T *&x, T *&y, unsigned int size, T xLeftError, T xRightError, T yBottomError, T yTopError, bool shouldDelete=false)
PlotSingleDataImpl(casacore::Vector< T > &value, bool shouldDelete=false)
virtual ~PlotSingleData()
PlotMaskedPointDataImpl< double > PlotMaskedPointDoubleData
virtual double xRightErrorAt(unsigned int i) const =0
Returns the "right" error for x at the given index.
Origin origin() const
Implements PlotRasterData::origin().
std::vector< T > * m_vector
virtual double yTopErrorAt(unsigned int i) const =0
Returns the "top" error for y at the given index.
PlotScalarErrorDataImpl(casacore::Vector< T > &x, casacore::Vector< T > &y, T error, bool shouldDelete=false)
virtual bool isValid() const
Implements PlotData::isValid().
bool isValid() const
Implements PlotData::isValid().
void recalculateMinMax()
Recalculates the cached min and max.
PlotMaskedPointDataImpl< int > PlotMaskedPointIntData
PlotPointDataImpl(casacore::Vector< T > &y, bool shouldDelete=false)
PlotHistogramData(PlotSingleDataPtr data, unsigned int numBins)
Constructor which takes data and number of bins.
PlotErrorDataImpl(casacore::Vector< T > &x, casacore::Vector< T > &y, casacore::Vector< T > &xLeftError, casacore::Vector< T > &xRightError, casacore::Vector< T > &yBottomError, casacore::Vector< T > &yTopError, bool shouldDelete=false)
double yTopErrorAt(unsigned int) const
PlotScalarErrorDataImpl(std::vector< T > &x, std::vector< T > &y, T xLeftError, T xRightError, T yBottomError, T yTopError, bool shouldDelete=false)
Scalar error for top, bottom, left, and right.
virtual std::vector< double > * colorBarValues(unsigned int max=1000) const =0
Gets color bar values.
Default implementation of PlotErrorData using standard containers, plus scalars for the four errors...
void setIndexing(Indexing i)
void setYRange(double from, double to)
Implements PlotRasterData::setYRange().
double xLeftErrorAt(unsigned int i) const
Implements PlotErrorData getter methods.
void setOrigin(Origin o)
Implements PlotRasterData::setOrigin().
bool willDeleteData() const
Implements PlotData::willDeleteData().
double yBottomErrorAt(unsigned int i) const
PlotScalarErrorDataImpl(T *&x, T *&y, unsigned int size, T xError, T yError, bool shouldDelete=false)
virtual ~PlotMaskedPointData()
unsigned int sizeMasked() const
Implements PlotMaskedPointData::sizeMasked().
virtual bool minsMaxes(double &xMin, double &xMax, double &yMin, double &yMax)
Implements PlotPointData::minsMaxes().
PlotRasterMatrixData(casacore::Matrix< T > &data, bool shouldDelete=false)
bool willDeleteData() const
Implements PlotData::willDeleteData().
PlotPointDataImpl(T *&x, T *&y, unsigned int size, bool shouldDel=false)
virtual unsigned int connectBinAt(unsigned int i) const
virtual bool willDeleteData() const
Implements PlotData::willDeleteData().
casacore::Data that adds masking functionality on top of normal point data.
PlotMaskedPointDataImpl(T *&y, bool *&mask, unsigned int size, bool shouldDel=false)
std::vector< bool > * m_maskVector
INHERITANCE_POINTER(PlotFlagAllTool, PlotFlagAllToolPtr, PlotMouseTool, PlotMouseToolPtr, PlotTool, PlotToolPtr) TOOL NOTIFICATION CLASSESInterface for objects that want to be notified when the selection tool changes.*/class PlotSelectToolNotifier
PlotScalarErrorDataImpl< unsigned int > PlotScalarErrorUIntData
bool willDeleteData() const
Overrides PlotPointDataImpl::willDeleteData().
PlotMaskedPointDataImpl(casacore::Vector< T > &y, casacore::Vector< bool > &mask, bool shouldDelete=false)
bool unmaskedMinsMaxes(double &xMin, double &xMax, double &yMin, double &yMax)
Implements PlotMaskedPointData::unmaskedMinsMaxes().
virtual unsigned int numBins() const =0
ABSTRACT METHODS //.
bool willDeleteData() const
Overrides PlotPointDataImpl::willDeleteData().
~PlotSingleDataImpl()
Destructor.
double xRightErrorAt(unsigned int i) const
PlotMaskedPointDataImpl(T *&x, T *&y, bool *&mask, unsigned int size, bool shouldDel=false)
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
PlotScalarErrorDataImpl< double > PlotScalarErrorDoubleData
bool errorMaxes(double &xLeft, double &xRight, double &yBottom, double &yTop)
Implements PlotErrorData::errorMaxes().
virtual bool errorMaxes(double &xLeft, double &xRight, double &yBottom, double &yTop)=0
Gets the maximum errors for the four sides.
bool maskedAt(unsigned int index) const
Implements PlotMaskedPointData::maskedAt().
double at(unsigned int i) const
Implements PlotSingleData::at().
double valueAt(double x, double y) const
Implements PlotRasterData::valueAt().
virtual ~PlotPointDataImpl()
unsigned int m_maskArraySize