xboa
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
RefinePeakFinder Class Reference

Find peaks in a list of data points when you have an estimate of the peaks position already, using a quadratic fit (in ROOT) to the peak. More...

Inherits object.

Public Member Functions

def __init__
 Initialise the peak finder. More...
 
def sigma
 Find the standard deviation from the mean of data. More...
 
def find_peak_errors
 Find the error on the peak estimation based on a linear fit to the derivative. More...
 
def find_peaks
 Find peaks in the data. More...
 

Public Attributes

 fit
 
 peak_list
 
 delta_seed
 
 max_delta
 
 draw
 

Static Public Attributes

list fit_list = []
 

Private Member Functions

def _peak_fit
 Fit the data in the vicinity of peak_index to a quadratic. More...
 

Detailed Description

Find peaks in a list of data points when you have an estimate of the peaks position already, using a quadratic fit (in ROOT) to the peak.

This can help to refine a peak estimate e.g. in the presence of noise.

The quality of the fit is estimated using the RMS of the residuals compared to the RMS of the actual data within a certain range of the estimated peak.

Definition at line 37 of file _refine_peak_finder.py.

Constructor & Destructor Documentation

def __init__ (   self,
  peak_list,
  delta_seed,
  max_delta,
  draw 
)

Initialise the peak finder.

  • peak_list: [list of ints] list of integer indices of estimated peak positions
  • delta_seed: [int] xboa initially considers points within a range given by delta_seed from the estimated peak position to refine the peak; xboa subsequently then varies delta to improve the fit quality.
  • max_delta: [int] delta cannot increment beyond max_delta.
  • draw: [bool] set to True to draw the fits. In fit plots, "0" is the estimated peak position

Definition at line 51 of file _refine_peak_finder.py.

Member Function Documentation

def sigma (   self,
  data 
)

Find the standard deviation from the mean of data.

  • data: list of floats containing data

Retuns float S(x**2)/N - {S(x)/N}**2 where N is the length of data

Definition at line 67 of file _refine_peak_finder.py.

Referenced by RefinePeakFinder._peak_fit().

def _peak_fit (   self,
  data,
  peak_index,
  delta_fit,
  delta_bite 
)
private

Fit the data in the vicinity of peak_index to a quadratic.

  • data: list of floats containing data
  • peak_index: the index at which the peak is found
  • delta_fit: the maximum distance from the peak from which data will be drawn for fitting
  • delta_bite: the maximum distance from the peak from which data will be drawn for assessing fit quality

Goodness-of-fit is an estimation of how well the data is fitted, based on comparing the standard deviation of the fit residuals to the sigma of data within a small "bite". fit_quality is given by comparing sigma (standard deviation) of data in a small bite with sigma of fit residuals, like Q = (sigma(res)/sigma(bite)-1.)*N(bite)**0.5 sigma(bite) in this sense is taken to be the natural spread of the raw data, and we seek to ensure sigma(res) does not go much above this spread.

Return value is a tuple of (fit_quality, histogram, graph, fit)

  • fit_quality: goodness-of-fit estimation.

Definition at line 96 of file _refine_peak_finder.py.

References RefinePeakFinder.fit, GaussianSmoothing.sigma, and RefinePeakFinder.sigma().

Referenced by RefinePeakFinder.find_peak_errors().

def find_peak_errors (   self,
  data 
)

Find the error on the peak estimation based on a linear fit to the derivative.

Definition at line 125 of file _refine_peak_finder.py.

References RefinePeakFinder._peak_fit(), RefinePeakFinder.delta_seed, RefinePeakFinder.draw, RefinePeakFinder.fit, RefinePeakFinder.max_delta, and RefinePeakFinder.peak_list.

Referenced by RefinePeakFinder.find_peaks().

def find_peaks (   self,
  data 
)

Find peaks in the data.

  • data list of floats that contains ordinates (y-axis values) of data abscissa are assumed to be data index.

Returns a list of indices, each index corresponding to the location of a peak in data

Definition at line 206 of file _refine_peak_finder.py.

References RefinePeakFinder.find_peak_errors().

Member Data Documentation

list fit_list = []
static

Definition at line 211 of file _refine_peak_finder.py.

fit
peak_list

Definition at line 53 of file _refine_peak_finder.py.

Referenced by RefinePeakFinder.find_peak_errors().

delta_seed

Definition at line 54 of file _refine_peak_finder.py.

Referenced by RefinePeakFinder.find_peak_errors().

max_delta

Definition at line 55 of file _refine_peak_finder.py.

Referenced by RefinePeakFinder.find_peak_errors().

draw

Definition at line 56 of file _refine_peak_finder.py.

Referenced by RefinePeakFinder.find_peak_errors().


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