Potku  1.0.0
Class Documentation
 All Classes Namespaces Functions
Modules.Calibration.TOFCalibrationHistogram Class Reference

Public Member Functions

def __init__
 
def get_error_function_parameters
 
def error_function
 
def fit_error_function
 
def find_middle
 
def get_curve_fit_points
 

Public Attributes

 cut
 
 bin_width
 
 use_column
 
 histogram_x
 
 histogram_y
 

Detailed Description

Class for creating a histogram based on a cut file data. Can make a curve 
fit to histogram's front edge.

Constructor & Destructor Documentation

def Modules.Calibration.TOFCalibrationHistogram.__init__ (   self,
  cut,
  bin_width,
  use_column = 1 
)
Inits the class.

Args:
    cut: CutFile that is used to make a histogram.
    bin_width: Created histograms bin width
    use_column: Which column of the CutFile's data is used to create a 
    histogram.

Member Function Documentation

def Modules.Calibration.TOFCalibrationHistogram.error_function (   self,
  x,
  params 
)
The function used for fit. 

Takes the function parameters as a "namedtuple" or "tuple".
A * (erf((x - x0) / k) + 1) / 2

Args:
    x: Float representing value on X axis.
    params: namedtuple or tuple that brings the used parameters ("x0 A k").
    
Return:
    Returns calculated error function value for x.
def Modules.Calibration.TOFCalibrationHistogram.find_middle (   self)
Finds the point at x axis that is somewhere in the middle of the histogram.
This is very inaccurate way.

Return:
    The value at the histogram's x axis that is somewhere in the middle of 
    the top of the graph.
def Modules.Calibration.TOFCalibrationHistogram.fit_error_function (   self,
  x,
  y,
  guess_x0,
  guess_A,
  guess_k 
)
Fits a error function to the given data.

Args:
    x: data's x axis a list
    y: data's y axis a list
    guess_x0: Guess for the x_0's value
    guess_A: Guess for the A's value
    guess_k: Guess for the k's value
    
Return:
    tuple(x0, A, k) of parameters of a fitted error function. 
def Modules.Calibration.TOFCalibrationHistogram.get_curve_fit_points (   self,
  params,
  points_in_range 
)
Generates points from the error function with the histogram's range

Args:
    params: tuple of parameters (x0, A, k)
    
Return:
    tuple(xp, pxp) of generated lists of axis data (x and y axis)
def Modules.Calibration.TOFCalibrationHistogram.get_error_function_parameters (   self,
  end_of_front_edge,
  start_of_front_edge = 0 
)
Get the parameters of the fitted curve. Parameters are used to specify 
the range where the curve fit is made.

Args:
    end_of_front_edge: End of the histogram's range in x axis.
    start_of_front_edge: Start of the histogram's range in x axis.

Return: 
    Tuple of fit function parameters (x0, A, k).

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