### Install PeakUtils from Source Source: https://github.com/lucashn/peakutils/blob/master/README.rst Use this command to install the PeakUtils package directly from its source code. Ensure you have Python 2.7 or later installed. ```bash python setup.py install ``` -------------------------------- ### peakutils.prepare Source: https://github.com/lucashn/peakutils/blob/master/docs/reference.rst Provides functions for data preparation. The contents of this submodule are imported into the main peakutils module. ```APIDOC ## peakutils.prepare ### Description Provides functions for data preparation. The contents of this submodule are imported into the main peakutils module. ### Module peakutils.prepare ### Members This submodule exposes its members directly. Use `peakutils.prepare.function_name` or rely on the members being imported into the main `peakutils` namespace. ``` -------------------------------- ### Detect Initial Peaks Source: https://github.com/lucashn/peakutils/blob/master/docs/tutorial_a.rst Uses peakutils.indexes to find the approximate indices of peaks in the noisy data. Prints the detected indices and corresponding x, y values. ```python indexes = peakutils.indexes(y, thres=0.5, min_dist=30) print(indexes) print(x[indexes], y[indexes]) pyplot.figure(figsize=(10,6)) pplot(x, y, indexes) pyplot.title('First estimate') ``` -------------------------------- ### Prepare Noisy Data Source: https://github.com/lucashn/peakutils/blob/master/docs/tutorial_a.rst Generates sample 1D data by combining two Gaussian functions with added random noise. Visualizes the generated data. ```python centers = (30.5, 72.3) x = numpy.linspace(0, 120, 121) y = (peakutils.gaussian(x, 5, centers[0], 3) + peakutils.gaussian(x, 7, centers[1], 10) + numpy.random.rand(x.size)) pyplot.figure(figsize=(10,6)) pyplot.plot(x, y) pyplot.title("Data with noise") ``` -------------------------------- ### Import Libraries Source: https://github.com/lucashn/peakutils/blob/master/docs/tutorial_a.rst Imports necessary libraries including numpy, peakutils, and plotting functions. Sets up inline plotting for matplotlib. ```python import numpy import peakutils from peakutils.plot import plot as pplot from matplotlib import pyplot %matplotlib inline ``` -------------------------------- ### Add Baseline to Data Source: https://github.com/lucashn/peakutils/blob/master/docs/tutorial_a.rst Creates a new dataset by adding a polynomial baseline to the existing noisy data. Visualizes the data with the added baseline. ```python y2 = y + numpy.polyval([0.002,-0.08,5], x) pyplot.figure(figsize=(10,6)) pyplot.plot(x, y2) pyplot.title("Data with baseline") ``` -------------------------------- ### peakutils.baseline Source: https://github.com/lucashn/peakutils/blob/master/docs/reference.rst Provides functions for baseline correction. The contents of this submodule are imported into the main peakutils module. ```APIDOC ## peakutils.baseline ### Description Provides functions for baseline correction. The contents of this submodule are imported into the main peakutils module. ### Module peakutils.baseline ### Members This submodule exposes its members directly. Use `peakutils.baseline.function_name` or rely on the members being imported into the main `peakutils` namespace. ``` -------------------------------- ### peakutils.plot Source: https://github.com/lucashn/peakutils/blob/master/docs/reference.rst Provides plotting functions, requiring explicit import due to matplotlib dependency. ```APIDOC ## peakutils.plot ### Description Provides plotting functions. This submodule must be explicitly imported due to its `matplotlib` dependency. ### Module peakutils.plot ### Members This submodule exposes its members directly. Use `peakutils.plot.function_name`. ``` -------------------------------- ### peakutils.peak Source: https://github.com/lucashn/peakutils/blob/master/docs/reference.rst Provides functions for peak detection. The contents of this submodule are imported into the main peakutils module. ```APIDOC ## peakutils.peak ### Description Provides functions for peak detection. The contents of this submodule are imported into the main peakutils module. ### Module peakutils.peak ### Members This submodule exposes its members directly. Use `peakutils.peak.function_name` or rely on the members being imported into the main `peakutils` namespace. ``` -------------------------------- ### Estimate and Remove Baseline Source: https://github.com/lucashn/peakutils/blob/master/docs/tutorial_a.rst Estimates the baseline of the data using an iterative polynomial regression algorithm and then removes it. Visualizes the data with the baseline removed. ```python base = peakutils.baseline(y2, 2) pyplot.figure(figsize=(10,6)) pyplot.plot(x, y2-base) pyplot.title("Data with baseline removed") ``` -------------------------------- ### Enhance Peak Resolution with Interpolation Source: https://github.com/lucashn/peakutils/blob/master/docs/tutorial_a.rst Applies interpolation to refine the detected peak locations, aiming for a more precise estimation of peak positions. ```python peaks_x = peakutils.interpolate(x, y, ind=indexes) print(peaks_x) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.