SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Member Functions | Private Attributes
ProbabilityContour Class Reference

Reconstructs the optimal α-contour of a Probability Density Function. More...

#include <ProbabilityContour.hh>

Public Member Functions

 ProbabilityContour ()
 Default constructor, initilizes everything to 0. More...
 
 ProbabilityContour (const std::vector< Vertex > &vertices, const Grid grid=Grid(), const std::string algo="hull")
 Hull constructor, sets the vertices and their mapping, computes hull volumes. More...
 
 ProbabilityContour (const Grid &grid, const std::string algo="rectangle")
 Grid constructor, sets a grid of points at which the function is known. More...
 
 ProbabilityContour (const std::vector< Vertex > &vertices, const std::vector< Vertex > &mcvertices, const double &boxvol, const Grid grid=Grid())
 MC constructor, sets the vertices, mcvertices and box volume. More...
 
 ProbabilityContour (const ProbabilityContour &cont)
 Copy constructor. More...
 
ProbabilityContour & operator= (const ProbabilityContour &cont)
 Equality operator. More...
 
 ~ProbabilityContour ()
 Destructor. More...
 
TH1F * Contour1D (size_t idx=0) const
 Returns segments that represent the 1D contour on a function. More...
 
TH2F * Contour2D (size_t idx=0, size_t idy=1) const
 Returns the requested 2D contour on a function. More...
 
TH3F * Contour3D (size_t idx=0, size_t idy=1, size_t idz=2) const
 Returns the requested 2D contour on a function. More...
 
void Evaluate (double alpha, double eps=1e-3)
 Computes the optimal contour using the specified algorithm. More...
 
bool IsInitialized () const
 Returns the array of indices of the vertices used. More...
 
const double & GetAlpha () const
 Returns the fraction of the function for which the contour was computed. More...
 
const double & GetBoxVolume () const
 Returns the volume of the box containing the MC vertices. More...
 
const double & GetContourVolume () const
 Returns the volume of the current contour. More...
 
double GetContourVolumeError () const
 Returns the volume of the current contour. More...
 
const std::vector< std::vector
< size_t > > & 
GetIndexArray () const
 Returns the array of indices of grid cells used to build the contour. More...
 
const std::vector< Vertex > & GetMCVertexArray () const
 Returns the array of MC vertices used to determine the contour. More...
 
const std::vector< Vertex > & GetVertexArray () const
 Returns the array of input vertices. More...
 
const double & GetVolume () const
 Returns the volume of the contour. More...
 
void SetMCVertexArray (const std::vector< Vertex > &mcvertices)
 Sets the array of MC vertices used to determine the contour. More...
 
void SetVertexArray (const std::vector< Vertex > &vertices)
 Sets the array of input vertices. More...
 
void SetBoxVolume (const double &boxvol)
 Sets the array of input vertices. More...
 

Private Member Functions

void AlphaComplexMethod (double alpha, double eps)
 Computes the optimal contour using the "alphac" method. More...
 
void HullMethod (double alpha, double eps)
 Computes the optimal contour using the "hull" method. More...
 
void MCMethod (double alpha, double eps)
 Computes the optimal contour using the "mc" method. More...
 
void RectangleMethod (double alpha, double)
 Computes the optimal contour using the "rectangle" method. More...
 
void TrapezoidMethod (double alpha, double eps=1e-3)
 Computes the optimal contour using the "trapezoid" method. More...
 

Private Attributes

std::string _algo
 Contour computation algorithm. More...
 
Grid _grid
 Grid of points are their value. More...
 
std::vector< std::vector
< size_t > > 
_indices
 Vector of indices of the vertices used. More...
 
double _alpha
 Fraction of the function. More...
 
double _volume
 Volume of the contour. More...
 
double _level
 Level of the contour. More...
 
std::vector< Vertex > _vertices
 Density estimation input vertices. More...
 
std::vector< Vertex > _mcvertices
 Monte Carlo vertices on a box. More...
 
double _boxvol
 Volume of the box in which the MC is run. More...
 

Detailed Description

Reconstructs the optimal α-contour of a Probability Density Function.

Provided with a scalar field normalised to 1 and defined everywhere, the algorithm finds the manifold that bounds the α-contour and reconstructs its volume. The α-contour is the smallest hypersurface that contains a fraction α of the total probability.

Constructor & Destructor Documentation

ProbabilityContour::ProbabilityContour ( )

Default constructor, initilizes everything to 0.

ProbabilityContour::ProbabilityContour ( const std::vector< Vertex > &  vertices,
const Grid  grid = Grid(),
const std::string  algo = "hull" 
)

Hull constructor, sets the vertices and their mapping, computes hull volumes.

Parameters
verticesDensity estimation input vertices
gridGrid on which the distrubution is evaluated (to draw only)
algoProbability contour estimation algorithm
ProbabilityContour::ProbabilityContour ( const Grid &  grid,
const std::string  algo = "rectangle" 
)

Grid constructor, sets a grid of points at which the function is known.

Parameters
gridGrid on which the distrubution is evaluated
algoProbability contour estimation algorithm
ProbabilityContour::ProbabilityContour ( const std::vector< Vertex > &  vertices,
const std::vector< Vertex > &  mcvertices,
const double &  boxvol,
const Grid  grid = Grid() 
)

MC constructor, sets the vertices, mcvertices and box volume.

Parameters
verticesDensity estimation input vertices
mcverticesMC vertices uniformly distributed inside a box
boxvolScaled volume of the box in which the MC vertices were produced
gridGrid on which the distrubution is evaluated (to draw only)
ProbabilityContour::ProbabilityContour ( const ProbabilityContour &  cont)

Copy constructor.

ProbabilityContour::~ProbabilityContour ( )

Destructor.

Member Function Documentation

void ProbabilityContour::AlphaComplexMethod ( double  alpha,
double  eps 
)
private

Computes the optimal contour using the "alphac" method.

Parameters
alphaIntegrated probability to achieve
epsResolution with which to achieve the contour
TH1F * ProbabilityContour::Contour1D ( size_t  idx = 0) const

Returns segments that represent the 1D contour on a function.

Parameters
idxID of the axis in which to plot the contour
Returns
Set of lines representing the contours
TH2F * ProbabilityContour::Contour2D ( size_t  idx = 0,
size_t  idy = 1 
) const

Returns the requested 2D contour on a function.

Parameters
idxID of the first axis in which to plot the contour
idyID of the second axis in which to plot the contour
Returns
Histogram at a certain contour level
TH3F * ProbabilityContour::Contour3D ( size_t  idx = 0,
size_t  idy = 1,
size_t  idz = 2 
) const

Returns the requested 2D contour on a function.

Parameters
idxID of the first axis in which to plot the contour
idyID of the second axis in which to plot the contour
idzID of the third axis in which to plot the contour
Returns
Histogram at a certain contour level
void ProbabilityContour::Evaluate ( double  alpha,
double  eps = 1e-3 
)

Computes the optimal contour using the specified algorithm.

Parameters
alphaIntegrated probability to achieve
epsResolution with which to achieve the contour
Returns
True if successful
const double& ProbabilityContour::GetAlpha ( ) const
inline

Returns the fraction of the function for which the contour was computed.

const double& ProbabilityContour::GetBoxVolume ( ) const
inline

Returns the volume of the box containing the MC vertices.

const double& ProbabilityContour::GetContourVolume ( ) const
inline

Returns the volume of the current contour.

double ProbabilityContour::GetContourVolumeError ( ) const

Returns the volume of the current contour.

const std::vector<std::vector<size_t> >& ProbabilityContour::GetIndexArray ( ) const
inline

Returns the array of indices of grid cells used to build the contour.

const std::vector<Vertex>& ProbabilityContour::GetMCVertexArray ( ) const
inline

Returns the array of MC vertices used to determine the contour.

const std::vector<Vertex>& ProbabilityContour::GetVertexArray ( ) const
inline

Returns the array of input vertices.

const double& ProbabilityContour::GetVolume ( ) const
inline

Returns the volume of the contour.

void ProbabilityContour::HullMethod ( double  alpha,
double  eps 
)
private

Computes the optimal contour using the "hull" method.

Parameters
alphaIntegrated probability to achieve
epsResolution with which to achieve the contour
bool ProbabilityContour::IsInitialized ( ) const
inline

Returns the array of indices of the vertices used.

void ProbabilityContour::MCMethod ( double  alpha,
double  eps 
)
private

Computes the optimal contour using the "mc" method.

Parameters
alphaIntegrated probability to achieve
epsResolution with which to achieve the contour
ProbabilityContour & ProbabilityContour::operator= ( const ProbabilityContour &  cont)

Equality operator.

void ProbabilityContour::RectangleMethod ( double  alpha,
double  eps 
)
private

Computes the optimal contour using the "rectangle" method.

Parameters
alphaIntegrated probability to achieve
epsResolution with which to achieve the contour
void ProbabilityContour::SetBoxVolume ( const double &  boxvol)
inline

Sets the array of input vertices.

void ProbabilityContour::SetMCVertexArray ( const std::vector< Vertex > &  mcvertices)
inline

Sets the array of MC vertices used to determine the contour.

void ProbabilityContour::SetVertexArray ( const std::vector< Vertex > &  vertices)
inline

Sets the array of input vertices.

void ProbabilityContour::TrapezoidMethod ( double  alpha,
double  eps = 1e-3 
)
private

Computes the optimal contour using the "trapezoid" method.

Parameters
alphaIntegrated probability to achieve
epsResolution with which to achieve the contour

Field Documentation

std::string ProbabilityContour::_algo
private

Contour computation algorithm.

double ProbabilityContour::_alpha
private

Fraction of the function.

double ProbabilityContour::_boxvol
private

Volume of the box in which the MC is run.

Grid ProbabilityContour::_grid
private

Grid of points are their value.

std::vector<std::vector<size_t> > ProbabilityContour::_indices
private

Vector of indices of the vertices used.

double ProbabilityContour::_level
private

Level of the contour.

std::vector<Vertex> ProbabilityContour::_mcvertices
private

Monte Carlo vertices on a box.

std::vector<Vertex> ProbabilityContour::_vertices
private

Density estimation input vertices.

double ProbabilityContour::_volume
private

Volume of the contour.


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