Help on class Data in module pypeaks.data:
class Data
| Methods defined here:
|
| __init__(self, x, y, smoothness=7)
| Initializes the data object for peak detection with x, y, smoothness
| parameter and empty peaks. In a histogram, x refers to bin centers (not
| edges), and y refers to the corresponding count/frequency.
|
| The smoothness parameter refers to the standard deviation of the
| gaussian kernel used for smoothing.
|
| extend_peaks(self, prop_thresh=50)
| Each peak in the peaks of the object is checked for its presence in
| other octaves. If it does not exist, it is created.
|
| prop_thresh is the cent range within which the peak in the other octave
| is expected to be present, i.e., only if there is a peak within this
| cent range in other octaves, then the peak is considered to be present
| in that octave.
|
| Note that this does not change the peaks of the object. It just returns
| the extended peaks.
|
| get_peaks(self, method='slope', peak_amp_thresh=5e-05, valley_thresh=3e-05, intervals=None, lookahead=20, avg_interval=100)
| This function expects SMOOTHED histogram. If you run it on a raw histogram,
| there is a high chance that it returns no peaks.
|
| method can be interval/slope/hybrid.
| The interval-based method simply steps through the whole histogram
| and pick up the local maxima in each interval, from which irrelevant
| peaks are filtered out by looking at the proportion of points on
| either side of the detected peak in each interval.
|
| Slope approach uses, of course slope information, to find peaks,
| which are then filtered by applying peal_amp_thresh and
| valley_thresh bounds.
|
| Hybrid approach first finds peaks using slope method and then filters
| them heuristically as in interval-based approach.
|
| peak_amp_thresh is the minimum amplitude/height that a peak should have
| in a normalized smoothed histogram, to be qualified as a peak.
| valley_thresh is viceversa for valleys!
|
| If the method is interval/hybrid, then the intervals argument must be passed
| and it should be an instance of Intervals class.
|
| If the method is slope/hybrid, then the lookahead and avg_window
| arguments should be changed based on the application.
| They have some default values though.
|
| The method returns:
| {"peaks":[[peak positions], [peak amplitudes]],
| "valleys": [[valley positions], [valley amplitudes]]}
|
| normalize(self)
| Normalizes the given data such that the area under the histogram/curve
| comes to 1. Also re applies smoothing once done.
|
| plot(self, intervals=None, new_fig=True)
| This function plots histogram together with its smoothed
| version and peak information if provided. Just intonation
| intervals are plotted for a reference.
|
| serialize(self, path)
| Saves the raw (read unsmoothed) histogram data to the given path using
| pickle python module.
|
| set_smoothness(self, smoothness)
| This method (re)sets the smoothness parameter.
|
| smooth(self)
| Smooths the data using a gaussian kernel of the given standard deviation
| (as smoothness parameter)