Fast Transient Imaging
A Python framework revolving around reconstruction of impulse responses from AMCW lidar measurements.
CFiniteDistribution Class Reference

This class represents a finite distribution of a continuous random variable by giving a list of values among with weights for the corresponding delta distributions. More...

Public Member Functions

def __init__
 This constructor initializes this distribution with the given values in the given array and and the given weights. More...
 
def Init
 A synonym for the constructor, which can be called at any time. More...
 
def InitUnsafe (self, Values, Weights)
 A faster variant of Init(). More...
 
def GetGraph
 This function returns a tuple consisting of arrays for the x-coordinates and y-coordinates of points, which need to be connected in order to obtain a graph of this distribution. More...
 
def GetCDF (self, X)
 This function evaluates the CDF of this distribution at the given value and returns the result. More...
 
def Plot (self, LinePlot=None, XMin=0.0, XMax=2.0 *np.pi, KeywordArguments)
 This function creates a plot of the cumulative distribution function of this distribution. More...
 
def Integrate (self, Function)
 Given a function, which can be evaluated on one-dimensional numpy arrays this function returns the result of integral Function(x)dP(x) where P is this distribution. More...
 
def GetNorm (self)
 This function returns the sum of all weights in this finite distribution. More...
 
def Normalize (self)
 This function makes this distribution have norm one, i.e. More...
 
def __rmul__ (self, LHS)
 Multiplies the CDF of this distribution by the given scalar and returns the resulting finite distribution. More...
 
def __add__ (self, RHS)
 Adds the CDF of the given distribution to the CDF of this distribution and returns the resulting finite distribution. More...
 

Static Public Attributes

 Values = None;
 The values of this distribution in an numpy array. More...
 
 Weights = None;
 The weights for the values in an array of identical shape. More...
 

Detailed Description

This class represents a finite distribution of a continuous random variable by giving a list of values among with weights for the corresponding delta distributions.

Constructor & Destructor Documentation

def __init__ (   self,
  Values = None,
  Weights = None,
  Normalize = True 
)

This constructor initializes this distribution with the given values in the given array and and the given weights.

If no weights are given, all values get the same weight and the weights sum to 1.0. If Normalize is True, the weights are scaled to sum to 1.0, otherwise they are used as provided. If Values is None, the distribution is defined as invalid.

Member Function Documentation

def Init (   self,
  Values,
  Weights = None,
  Normalize = True 
)

A synonym for the constructor, which can be called at any time.

def InitUnsafe (   self,
  Values,
  Weights 
)

A faster variant of Init().

Values and Weights have to be given explicitly and values have to be sorted.

def GetGraph (   self,
  XMin = 0.0,
  XMax = 2.0*np.pi 
)

This function returns a tuple consisting of arrays for the x-coordinates and y-coordinates of points, which need to be connected in order to obtain a graph of this distribution.

def GetCDF (   self,
  X 
)

This function evaluates the CDF of this distribution at the given value and returns the result.

X can be an array. In this case an array of identical shape containing all values of the CDF at these samples is returned.

def Plot (   self,
  LinePlot = None,
  XMin = 0.0,
  XMax = 2.0*np.pi,
  KeywordArguments 
)

This function creates a plot of the cumulative distribution function of this distribution.

Keyword arguments are passed on to matplotlib. The return value of pyplot.plot is returned. If you pass the return value of a previous call to LinePlot, this plot is changed to show the new graph and no new plot is generated.

def Integrate (   self,
  Function 
)

Given a function, which can be evaluated on one-dimensional numpy arrays this function returns the result of integral Function(x)dP(x) where P is this distribution.

def GetNorm (   self)

This function returns the sum of all weights in this finite distribution.

For probability distributions this is 1.0.

def Normalize (   self)

This function makes this distribution have norm one, i.e.

it turns it into a probability distribution. This is achieved by means of scaling.

def __rmul__ (   self,
  LHS 
)

Multiplies the CDF of this distribution by the given scalar and returns the resulting finite distribution.

This scalar multiplication among with add() turns probability distributions into a vector space.

def __add__ (   self,
  RHS 
)

Adds the CDF of the given distribution to the CDF of this distribution and returns the resulting finite distribution.

This addition among with rmul() turns probability distributions into a vector space.

Member Data Documentation

Values = None;
static

The values of this distribution in an numpy array.

They are sorted.

Weights = None;
static

The weights for the values in an array of identical shape.


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