Module gwy :: Class Peaks
[hide private]
[frames] | no frames]

Class Peaks

source code

Graph peak analyser

One Peaks analyser can be used repeatedly to find and characterise peaks in several data sets.

Feed the curve data to the analyser using functions such as Peaks.analyze(), Peaks.analyze_dataline() or Peaks.analyze_xy(). It will process the data, locate peaks and remember their various characteristics that you can subsequently obtain using Peaks.get_quantity(). The results are static; if you change the analyser settings (or the curve data) you need to re-run the analysis function.

Instance Methods [hide private]
 
__init__()
Creates a new empty peak analyser.
source code
 
copy()
Creates a copy of a peak analyser.
source code
 
free()
Frees a peak analyser and all associated data.
source code
 
set_background(background)
Sets the background type a peak analyser will use.
source code
 
set_order(order)
Sets the order type a peak analyser will use.
source code
 
analyze_xy(xydata, n, maxpeaks)
Finds peaks a graph curve given as XY data.
source code
 
analyze_dataline(dline, maxpeaks)
Finds peaks a graph curve given as DataLine.
source code
 
n_peaks()
Gets the current number of peaks of a peak analyser.
source code
 
analyze(xdata, ydata, maxpeaks)
Finds peaks a graph curve given as separated x and y data.
source code
 
get_quantity(quantity)
Obtaines values of a given quantity for all found peaks.
source code
Method Details [hide private]

__init__()
(Constructor)

source code 

Creates a new empty peak analyser.

Returns:
A new peak analyser. (Peaks)

Since: 2.46

copy()

source code 

Creates a copy of a peak analyser.

This is mostly useful for language bindings.

Returns:
A newly created peak analyser. (Peaks)

Since: 2.47

free()

source code 

Frees a peak analyser and all associated data.

Since: 2.46

set_background(background)

source code 

Sets the background type a peak analyser will use.

The default background is PEAK_BACKGROUND_MMSTEP. Note that the new background type will only be used in future analyses; it does not change the results of the already performed analysis.

Parameters:
  • background - Background type to use in future analyses. Expected values: PEAK_BACKGROUND_ZERO, PEAK_BACKGROUND_MMSTEP. (PeakBackgroundType)

Since: 2.46

set_order(order)

source code 

Sets the order type a peak analyser will use.

The default order is PEAK_ORDER_ABSCISSA. Note that the new order will only be effective in future analyses; it does not change the results of the already performed analysis.

Parameters:
  • order - Order type to use in future analyses. Expected values: PEAK_ORDER_ABSCISSA, PEAK_ORDER_PROMINENCE. (PeakOrderType)

Since: 2.46

analyze_xy(xydata, n, maxpeaks)

source code 

Finds peaks a graph curve given as XY data.

The peaks are remembered by the analyser and their properties can be subsequently requested using Peaks.get_quantity().

Parameters:
  • xydata - Curve points (array with n items) that must be ordered by x values in ascending order. (const-XY*)
  • n - Number of data points in the curve. (int)
  • maxpeaks - Maximum number of the most prominent peaks to locate. (int)
Returns:
The number of peaks found. (int)

Since: 2.46

analyze_dataline(dline, maxpeaks)

source code 

Finds peaks a graph curve given as DataLine.

The peaks are remembered by the analyser and their properties can be subsequently requested using Peaks.get_quantity().

Parameters:
  • dline - Curve data as a data line. (DataLine)
  • maxpeaks - Maximum number of the most prominent peaks to locate. (int)
Returns:
The number of peaks found. (int)

Since: 2.46

n_peaks()

source code 

Gets the current number of peaks of a peak analyser.

Returns:
The currently remembered number of peaks. (int)

Since: 2.46

analyze(xdata, ydata, maxpeaks)

source code 

Finds peaks a graph curve given as separated x and y data.

The peaks are remembered by the analyser and their properties can be subsequently requested using Peaks.get_quantity().

Parameters:
  • xdata - Abscissa values (array with n items), must be ordered in ascending order. (list)
  • ydata - Ordinate values corresponding to xdata. (list)
  • maxpeaks - Maximum number of the most prominent peaks to locate. (int)
Returns:
Value npeaks. ((int))

Since: 2.46

get_quantity(quantity)

source code 

Obtaines values of a given quantity for all found peaks.

Parameters:
  • quantity - Peak property to return. Expected values: PEAK_PROMINENCE, PEAK_ABSCISSA, PEAK_HEIGHT, PEAK_AREA, PEAK_WIDTH. (PeakQuantity)
Returns:
(list)

Since: 2.46