14 #include "msdevstudio/MSconfig.h"
34 using namespace hippodraw;
36 #ifdef ITERATOR_MEMBER_DEFECT
40 using std::accumulate;
75 m_x_label ( projector.m_x_label ),
76 m_y_label ( projector.m_y_label ),
77 m_cols ( projector.m_cols ),
78 m_rows ( projector.m_rows ),
79 m_x_step ( projector.m_x_step ),
80 m_y_step ( projector.m_y_step ),
81 m_x_origin ( projector.m_x_origin ),
82 m_y_origin ( projector.m_y_origin ),
83 m_null_value ( projector.m_null_value ),
84 m_transpose ( projector.m_transpose )
193 bool in = x_range.
includes ( lvalue ) ||
194 x_range.
includes ( lvalue + m_x_step );
202 y_range.
includes ( bvalue + m_y_step );
206 if ( accept && use_z ==
true ) {
209 accept &= z_range.
includes ( value );
227 namespace dp = hippodraw::DataPoint3DTuple;
236 return Range ( 0.0, 1.0, 0.5 );
240 return Range ( values );
253 if ( m_x_step < 0. ) {
262 if ( m_y_step < 0. ) {
284 double low = DBL_MAX;
285 double pos = DBL_MAX;
286 double high = -DBL_MIN;
289 std::size_t rows =
m_ntuple -> rows ();
290 unsigned int used = 0;
291 for (
unsigned int row = 0; row < rows; row++ ) {
295 low = std::min ( low, value );
297 pos = std::min ( pos, value );
299 high = std::max ( high, value );
359 unsigned int col = 3;
380 const vector < double > &
data = ntuple -> getColumn ( col );
382 unsigned int size = ntuple -> rows ();
385 sum = accumulate ( data.begin(), data.end(), sum );
402 unsigned int size = ntuple->
rows ();
403 double s = static_cast <
double > (
size );
404 double side = sqrt ( s );
406 m_rows = static_cast <
unsigned int > ( side );
407 m_cols = static_cast <
unsigned int > ( side );
430 unsigned int i_x = static_cast <
unsigned int> ( xx );
431 unsigned int i_y = static_cast <
unsigned int> ( yy );
456 unsigned int columns = 6;
460 ntuple -> setLabelAt (
getXLabel (), 0 );
461 ntuple -> setLabelAt (
getYLabel (
false ), 1 );
462 ntuple -> setLabelAt (
getZLabel (), 2 );
463 ntuple -> setLabelAt (
"Width", 3 );
464 ntuple -> setLabelAt (
"Height", 4 );
465 if ( z_err < UINT_MAX ) {
466 ntuple -> setLabelAt (
m_ntuple -> getLabelAt ( z_err ), 5 );
469 ntuple -> setLabelAt (
"Error", 5 );
495 for (
unsigned int i = 0;
i <
m_cols;
i++ ) {
503 for (
unsigned int j = 0; j <
m_rows; j++ ) {
511 index =
i + m_cols * j;
514 index =
i * m_rows + j;
532 ntuple -> addRow ( row );
537 vector < unsigned int >
shape ( 3 );
542 ntuple -> setShape ( shape );
double m_y_step
The step along the Y axis.
virtual void setNumberOfBins(hippodraw::Axes::Type axis, unsigned int number)
Sets the number of steps.
virtual double getAverage(hippodraw::Axes::Type axis) const
Get the Average of all projected values on the specified axis.
const std::string & getYLabel(bool flag) const
Returns the label for the Y axis.
double getPos(int column) const
Returns the minimum positive value on the specified column.
virtual void setNTuple(const DataSource *ntuple)
Changes the DataSource used for the projections to source.
virtual void setNTuple(const DataSource *source)
Changes the DataSource used for the projections to source.
virtual void setOffset(hippodraw::Axes::Type axis, double origin)
Sets the bin offset.
AxisModelBase * m_x_axis
The AxisModel along the X axis.
CutList_t m_cut_list
A list of cuts that filter the projection.
virtual double getZValue(double x, double y) const
Returns the value at the coordinate.
virtual const Range & setBinWidth(hippodraw::Axes::Type axis, double step)
Sets the bin width.
bool acceptRow(unsigned int i, const CutList_t &cut_list) const
For row i of the column in the DataSource, returns true if all the cuts accept the row...
double m_x_origin
The origin along the X axis.
std::string m_y_label
The label for the generated y axis.
virtual const Range & getRange(Axes::Type) const
Returns the Range along the specified axis.
std::vector< unsigned int > m_columns
A vector containing indexes to the columns of the DataSource.
double m_null_value
The value of the null value.
double m_y_origin
The origin along the Y axis.
void * data(numeric::array arr)
virtual bool isImageConvertable() const
Returns true since the projected values can be converted to an image.
double getPosWithError(int data, int error) const
Returns the minimum positive values considering both data and error.
bool isDirty() const
Returns true if the projector has been marked dirty.
An NTupleProjector is a projector that projects data from an DataSource object.
std::vector< intptr_t > shape(numeric::array arr)
virtual double getPosOn(hippodraw::Axes::Type axis) const
Returns the minimum positive value of the data on a specified axis.
virtual void fillProjectedValues(DataSource *ntuple, bool in_range=false) const
bool includes(double value) const
Returns true if the argument value is inside the range.
virtual void matrixTranspose(bool yes)
Transposes the X and Y axis of the contained matrix.
virtual Range dataRangeOnValue() const
unsigned int m_cols
The number of columns for each row.
hippodraw::MapMatrixProjector class interface
virtual void setDirty(bool value=true)
Sets the dirty flag to value.
const DataSource * getProjectedValues() const
Returns DataSource representation of projected values.
AxisModelBase * m_z_axis
The AxisModel along the Z axis.
virtual double getOffset(hippodraw::Axes::Type axis) const
Returns the origin along the axis axis.
virtual DataSource * createNTuple() const
Creates an NTuple representation of the projected values.
virtual double getBinWidth(hippodraw::Axes::Type axis) const
Returns the step size along the axis axis.
virtual Range dataRangeOn(hippodraw::Axes::Type) const
Returns the range of the data on the specified axis.
error on X or half bin width
virtual Range preferredRange(Axes::Type) const
Returns the preferred Range.
double m_x_step
The step along the X axis.
ProjectorBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
A DataSource class implemented with std::vector<double> to store the row data.
intp size(numeric::array arr)
A derived class of NTupleProjector that maps 1 DataSource column to a Y axis of two dimensional proje...
const DataSource * m_ntuple
The pointer to the data source being projected.
std::vector< std::string > m_binding_options
The list of binding options for the Projector.
const std::string & getZLabel() const
Returns the label of the z axis.
bool inRangeWithZ(int row, bool flag) const
Returns true if value at row is within range.
virtual bool inRange(int row) const
Checks if the entries in a given row are within the range of the axis model.
bool m_transpose
A flag to indicate if the X-Y matrix should be transposed or not.
void setRange(double low, double high, double pos)
Changes the current Range.
The base class for the Projector hierarchy.
virtual void addPointReps()
Function to add the acceptable point reps.
virtual void changedNTuple()
This function is called when the NTuple has been changed to a new one.
hippodraw::AxisModelBase class interface
std::string m_x_label
The label for the generated x axis.
virtual unsigned int rows() const =0
Returns the number of rows.
DataSource * m_proj_values
The NTuple representing the result of the projection.
virtual void prepareValues()
Informs the projector to prepare its projected values for plotting.
const Range & getRange(bool scaled) const
Returns the range represented by this AxisModel.
unsigned int columns() const
Returns the number of columns or data arrays available from this DataSource.
unsigned int m_rows
The number of rows for each column.
const std::string & getXLabel() const
Returns the label (title) of the x axis.
Expresses a range of values.
std::vector< std::string > m_pointreps
Vector of acceptable PointReps.
hippodraw::DataPointTuple namespace interface
MapMatrixProjector()
This default constructor binds to the first two columns.
virtual Range valueRange() const
Finds the range of the projected values.
AxisModelBase * m_y_axis
The AxisModel along the Y axis.
unsigned int m_min_bindings
The minimum number of columns that must be bound.
unsigned int calcRowIndex(unsigned int row) const
Calculates the index of the row of the matrix, given the row of the NTuple.
virtual const std::string & getLabelAt(unsigned int index) const
Returns the label for the column at index index.
double m_scale_factor
The scale factor.
unsigned int calcColumnIndex(unsigned int row) const
Calculates the index of the column of the matrix, given the row of the NTuple.
virtual Range preferredRange(hippodraw::Axes::Type axis) const
Returns the preferred Range.
virtual int getNumberOfBins(hippodraw::Axes::Type axis) const
Returns the number of bins.
Base class for DataSource.