### Findpeaks Quickstart Example Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Installation.rst Demonstrates the basic workflow of the findpeaks library, including importing data, performing peak detection using the 'topology' method, and visualizing the results and persistence diagram. ```python # Import library from findpeaks import findpeaks # Initialize with topology method (most robust) fp = findpeaks(method='topology') # Example data: X = fp.import_example('1dpeaks') # Peak detection results = fp.fit(X) # Plot results fp.plot() # Plot persistence diagram fp.plot_persistence() ``` -------------------------------- ### Bash: Install findpeaks via pip Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Installation.html Instructions for installing the findpeaks library using pip, both from PyPI (recommended) and directly from GitHub for the latest development version. ```bash # Installation from PyPI (recommended): pip install findpeaks # Install directly from GitHub (unstable version but it is the latest development version): pip install git+https://github.com/erdogant/findpeaks ``` -------------------------------- ### Bash: Install findpeaks via pip Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Installation.html Instructions for installing the findpeaks library using pip, both from PyPI (recommended) and directly from GitHub for the latest development version. ```bash # Installation from PyPI (recommended): pip install findpeaks # Install directly from GitHub (unstable version but it is the latest development version): pip install git+https://github.com/erdogant/findpeaks ``` -------------------------------- ### Findpeaks Quickstart Example Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Installation.rst.txt Demonstrates the basic workflow of the findpeaks library, including importing data, performing peak detection using the 'topology' method, and visualizing the results and persistence diagram. ```python # Import library from findpeaks import findpeaks # Initialize with topology method (most robust) fp = findpeaks(method='topology') # Example data: X = fp.import_example('1dpeaks') # Peak detection results = fp.fit(X) # Plot results fp.plot() # Plot persistence diagram fp.plot_persistence() ``` -------------------------------- ### Findpeaks Quickstart Example Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Installation.rst.txt Demonstrates the basic workflow of the findpeaks library, including importing data, performing peak detection using the 'topology' method, and visualizing the results and persistence diagram. ```python # Import library from findpeaks import findpeaks # Initialize with topology method (most robust) fp = findpeaks(method='topology') # Example data: X = fp.import_example('1dpeaks') # Peak detection results = fp.fit(X) # Plot results fp.plot() # Plot persistence diagram fp.plot_persistence() ``` -------------------------------- ### Python: Initialize and Use findpeaks Library Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Installation.html Demonstrates initializing the findpeaks library with the topology method, importing example data, performing peak detection, and plotting the results and persistence diagram. ```python from findpeaks import findpeaks fp = findpeaks(method='topology') X = fp.import_example('1dpeaks') results = fp.fit(X) fp.plot() fp.plot_persistence() ``` -------------------------------- ### Python: Initialize and Use findpeaks Library Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Installation.html Demonstrates initializing the findpeaks library with the topology method, importing example data, performing peak detection, and plotting the results and persistence diagram. ```python from findpeaks import findpeaks fp = findpeaks(method='topology') X = fp.import_example('1dpeaks') results = fp.fit(X) fp.plot() fp.plot_persistence() ``` -------------------------------- ### Quick Start Peak Detection Source: https://github.com/erdogant/findpeaks/blob/master/README.md A quick start guide to using the findpeaks library. It shows how to initialize the library with the 'topology' method, load example data, perform peak detection, and plot the results. ```python # Import library from findpeaks import findpeaks # Initialize with topology method (most robust) fp = findpeaks(method='topology') # Example data X = fp.import_example('1dpeaks') # Peak detection results = fp.fit(X) # Plot results fp.plot() # Plot persistence diagram fp.plot_persistence() ``` -------------------------------- ### Bash: Create and Activate Conda Environment Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Installation.html Commands to create a new conda environment named 'env_findpeaks' with Python 3.6 and activate it for installing the findpeaks library. ```bash conda create -n env_findpeaks python=3.6 conda activate env_findpeaks ``` -------------------------------- ### Bash: Create and Activate Conda Environment Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Installation.html Commands to create a new conda environment named 'env_findpeaks' with Python 3.6 and activate it for installing the findpeaks library. ```bash conda create -n env_findpeaks python=3.6 conda activate env_findpeaks ``` -------------------------------- ### Import Example Dataset Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/findpeaks.findpeaks.html Illustrates how to import example datasets provided by the findpeaks library. It shows the basic usage of the import_example function with the default '2dpeaks' dataset. ```Python from findpeaks import findpeaks X = fp.import_example('2dpeaks') ``` -------------------------------- ### Findpeaks Installation Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Installation.rst Instructions for installing the findpeaks library. It covers creating a conda environment, activating it, and installing the package via pip from PyPI or directly from GitHub. ```console conda create -n env_findpeaks python=3.6 conda activate env_findpeaks ``` ```console # Installation from PyPI (recommended): pip install findpeaks # Install directly from GitHub (unstable version but it is the latest development version): pip install git+https://github.com/erdogant/findpeaks ``` -------------------------------- ### Findpeaks Installation Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Installation.rst.txt Instructions for installing the findpeaks library. It covers creating a conda environment, activating it, and installing the package via pip from PyPI or directly from GitHub. ```console conda create -n env_findpeaks python=3.6 conda activate env_findpeaks ``` ```console # Installation from PyPI (recommended): pip install findpeaks # Install directly from GitHub (unstable version but it is the latest development version): pip install git+https://github.com/erdogant/findpeaks ``` -------------------------------- ### Import Example Dataset Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/findpeaks.findpeaks.html Illustrates how to import example datasets provided by the findpeaks library. It shows the basic usage of the import_example function with the default '2dpeaks' dataset. ```Python from findpeaks import findpeaks X = fp.import_example('2dpeaks') ``` -------------------------------- ### Findpeaks Installation Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Installation.rst.txt Instructions for installing the findpeaks library. It covers creating a conda environment, activating it, and installing the package via pip from PyPI or directly from GitHub. ```console conda create -n env_findpeaks python=3.6 conda activate env_findpeaks ``` ```console # Installation from PyPI (recommended): pip install findpeaks # Install directly from GitHub (unstable version but it is the latest development version): pip install git+https://github.com/erdogant/findpeaks ``` -------------------------------- ### Build PDF Documentation with Sphinx Source: https://github.com/erdogant/findpeaks/blob/master/docs/HOWTO.txt This command demonstrates how to build a PDF version of the documentation using Sphinx. It specifies the PDF builder and the source and build directories. ```bash sphinx-build -b pdf source build ``` -------------------------------- ### Importing and Preprocessing Images with findpeaks Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Use-cases.rst.txt This snippet demonstrates the initial steps of using the findpeaks library, including importing an example image and applying several preprocessing techniques. These include resizing, converting to grayscale, and scaling the image data to prepare it for peak detection. ```python from findpeaks import findpeaks fp = findpeaks(limit=160) img = fp.import_example('2dpeaks_image') import findpeaks img = findpeaks.stats.resize(img, size=(300,300)) img = findpeaks.stats.togray(img) img = findpeaks.stats.scale(img) ``` -------------------------------- ### Import Example Dataset Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/findpeaks.findpeaks.html Imports a specified example dataset from the library's GitHub source. The function supports various dataset names and allows specifying a custom download URL or data directory. ```Python from findpeaks import findpeaks data = fp.import_example('2dpeaks') # or # data = fp.import_example(data='btc', url='http://example.com/data.csv') ``` -------------------------------- ### Import Example Dataset Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/findpeaks.findpeaks.html Imports a specified example dataset from the library's GitHub source. The function supports various dataset names and allows specifying a custom download URL or data directory. ```Python from findpeaks import findpeaks data = fp.import_example('2dpeaks') # or # data = fp.import_example(data='btc', url='http://example.com/data.csv') ``` -------------------------------- ### Compare Peak Detection Methods with Interpolation Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Examples.html Illustrates the effect of interpolation on both 'peakdetect' and 'topology' methods. This example initializes findpeaks with the 'interpolate' parameter for both methods to show enhanced detection capabilities. ```Python # Initialize with interpolate parameter fp = findpeaks(method='peakdetect', lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` ```Python fp = findpeaks(method='topology', lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` -------------------------------- ### Find Peaks using Default Settings Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Examples.html This snippet demonstrates how to find peaks in data using the findpeaks library with its default settings. It includes importing the library, loading example data, initializing the findpeaks object, fitting the data, and plotting the preprocessing steps and the final results. ```Python from findpeaks import findpeaks X = fp.import_example() print(X) fp = findpeaks(method='mask') fp.fit(X) fp.plot_preprocessing() fp.plot() ``` ```Python fp = findpeaks(method='topology') fp.fit(X) fp.plot() fp.plot_mesh() ``` ```Python fp.plot_persistence() ``` -------------------------------- ### Compare Peak Detection Methods with Interpolation Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Examples.html Illustrates the effect of interpolation on both 'peakdetect' and 'topology' methods. This example initializes findpeaks with the 'interpolate' parameter for both methods to show enhanced detection capabilities. ```Python # Initialize with interpolate parameter fp = findpeaks(method='peakdetect', lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` ```Python fp = findpeaks(method='topology', lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` -------------------------------- ### Import Example Function Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/genindex.html Provides an example of how to import and use functions within the findpeaks library. It demonstrates the usage pattern for methods within the findpeaks class. ```Python def import_example(): # Function implementation details... ``` -------------------------------- ### Redirect to HTML Index in index.html Source: https://github.com/erdogant/findpeaks/blob/master/docs/HOWTO.txt This HTML meta tag is used within the docs/index.html file to automatically redirect the user to the main HTML documentation located at ./html/index.html. ```html ``` -------------------------------- ### Import Example Function Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/genindex.html Provides an example of how to import and use functions within the findpeaks library. It demonstrates the usage pattern for methods within the findpeaks class. ```Python def import_example(): # Function implementation details... ``` -------------------------------- ### Find Peaks using Default Settings Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Examples.html This snippet demonstrates how to find peaks using the default settings of the findpeaks library. It includes importing the library, loading example data, initializing the findpeaks object with the 'mask' method, fitting the data, and plotting the preprocessing steps and the final results. ```python from findpeaks import findpeaks X = fp.import_example() print(X) fp = findpeaks(method='mask') fp.fit(X) fp.plot_preprocessing() fp.plot() ``` -------------------------------- ### Install findpeaks Python Library Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/index.html This snippet provides instructions on how to install the findpeaks Python library using pip. It's a common first step for using the library. ```bash pip install findpeaks ``` -------------------------------- ### Apply Lee Filter to Image (Example) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/findpeaks.findpeaks.html Demonstrates the application of the Lee filter to an image. The example shows preprocessing steps like resizing, converting to grayscale, scaling, and then applying the Lee filter. ```Python import findpeaks import matplotlib.pyplot as plt img = findpeaks.import_example('2dpeaks_image') # Resize img = findpeaks.stats.resize(img, size=(300,300)) # Make grey image img = findpeaks.stats.togray(img) # Scale between [0-255] img = findpeaks.stats.scale(img) # Filter img_filtered = findpeaks.stats.lee_filter(img.copy(), win_size=15, cu=0.25) plt.figure() fig, axs = plt.subplots(1,2) axs[0].imshow(img, cmap='gray'); axs[0].set_title('Input') axs[1].imshow(img_filtered, cmap='gray'); axs[1].set_title('Lee filter') ``` -------------------------------- ### Apply Lee Filter to Image (Example) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/findpeaks.findpeaks.html Demonstrates the application of the Lee filter to an image. The example shows preprocessing steps like resizing, converting to grayscale, scaling, and then applying the Lee filter. ```Python import findpeaks import matplotlib.pyplot as plt img = findpeaks.import_example('2dpeaks_image') # Resize img = findpeaks.stats.resize(img, size=(300,300)) # Make grey image img = findpeaks.stats.togray(img) # Scale between [0-255] img = findpeaks.stats.scale(img) # Filter img_filtered = findpeaks.stats.lee_filter(img.copy(), win_size=15, cu=0.25) plt.figure() fig, axs = plt.subplots(1,2) axs[0].imshow(img, cmap='gray'); axs[0].set_title('Input') axs[1].imshow(img_filtered, cmap='gray'); axs[1].set_title('Lee filter') ``` -------------------------------- ### Import Example and Pre-processing Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Use-cases.html This code imports an example image, resizes it, converts it to grayscale, and scales the pixel values between 0 and 255. These pre-processing steps are often necessary before applying denoising filters. ```Python from findpeaks import findpeaks fp = findpeaks(limit=160) img = fp.import_example('2dpeaks_image') import findpeaks # Some pre-processing # Resize img = findpeaks.stats.resize(img, size=(300,300)) # Make grey image img = findpeaks.stats.togray(img) # Scale between [0-255] img = findpeaks.stats.scale(img) ``` -------------------------------- ### Import Example and Pre-processing Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Use-cases.html This code imports an example image, resizes it, converts it to grayscale, and scales the pixel values between 0 and 255. These pre-processing steps are often necessary before applying denoising filters. ```Python from findpeaks import findpeaks fp = findpeaks(limit=160) img = fp.import_example('2dpeaks_image') import findpeaks # Some pre-processing # Resize img = findpeaks.stats.resize(img, size=(300,300)) # Make grey image img = findpeaks.stats.togray(img) # Scale between [0-255] img = findpeaks.stats.scale(img) ``` -------------------------------- ### Import Example Data and Perform 2D Peak Detection Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/findpeaks.findpeaks.html Imports a 2D peaks example dataset and performs peak detection using the topology method. It then prints the number of significant features found. This demonstrates the basic workflow for 2D data analysis. ```Python from findpeaks import findpeaks # 2D peak detection X = fp.import_example('2dpeaks') fp = findpeaks(method='topology', limit=0.1) results = fp.fit(X) print(f"Found {len(results['persistence'])} significant features") ``` -------------------------------- ### Set Sphinx Build Directory in Makefile Source: https://github.com/erdogant/findpeaks/blob/master/docs/HOWTO.txt This line in the Makefile configures Sphinx to use the 'pages' directory as the build output directory for the documentation. ```makefile BUILDDIR = pages ``` -------------------------------- ### Load Example Data and Fit with Caerus Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Caerus.html Imports example 'facebook' stock market data using the initialized findpeaks object and then applies the 'fit' method to detect peaks and valleys based on the Caerus algorithm's parameters. The results of the fitting process are stored within the findpeaks object. ```Python # Import example data X = fp.import_example('facebook') # Fit results = fp.fit(X) ``` -------------------------------- ### Import Example Data and Perform 2D Peak Detection Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/findpeaks.findpeaks.html Imports a 2D peaks example dataset and performs peak detection using the topology method. It then prints the number of significant features found. This demonstrates the basic workflow for 2D data analysis. ```Python from findpeaks import findpeaks # 2D peak detection X = fp.import_example('2dpeaks') fp = findpeaks(method='topology', limit=0.1) results = fp.fit(X) print(f"Found {len(results['persistence'])} significant features") ``` -------------------------------- ### Load Example Data and Fit with Caerus Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Caerus.html Imports example 'facebook' stock market data using the initialized findpeaks object and then applies the 'fit' method to detect peaks and valleys based on the Caerus algorithm's parameters. The results of the fitting process are stored within the findpeaks object. ```Python # Import example data X = fp.import_example('facebook') # Fit results = fp.fit(X) ``` -------------------------------- ### Compare Peak Detection Methods with Interpolation (1D) (Python) Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Examples.rst Demonstrates how interpolation affects both 'peakdetect' and 'topology' methods for 1D peak detection. The example initializes findpeaks with the 'interpolate' parameter for both methods and plots the results. ```python fp = findpeaks(method='peakdetect', lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() fp = findpeaks(method='topology', lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` -------------------------------- ### Import and Get Version Source: https://github.com/erdogant/findpeaks/blob/master/README.md Demonstrates how to import the findpeaks library and print its installed version. This is a common first step after installation. ```python import findpeaks print(findpeaks.__version__) # Import library from findpeaks import findpeaks ``` -------------------------------- ### Install findpeaks Library Source: https://github.com/erdogant/findpeaks/blob/master/README.md Installs the findpeaks Python library using pip. This is the primary method to get the library into your Python environment. ```bash pip install findpeaks ``` -------------------------------- ### findpeaks.findpeaks.findpeaks.import_example Function Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Function_Reference.rst.txt Imports example datasets for testing and demonstration purposes. This function provides sample data to help users understand and test the library's functionality. ```Python from findpeaks.findpeaks import findpeaks # Import an example dataset example_data = findpeaks.import_example('sample_1d') ``` -------------------------------- ### Build HTML Documentation with Sphinx Source: https://github.com/erdogant/findpeaks/blob/master/docs/HOWTO.txt This snippet shows the commands to clean and build the HTML documentation using Sphinx. It's a common workflow to repeat these steps until the documentation meets the desired standard. ```bash make clean make html ``` -------------------------------- ### findpeaks.findpeaks.findpeaks.import_example Function Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Function_Reference.rst.txt Imports example datasets for testing and demonstration purposes. This function provides sample data to help users understand and test the library's functionality. ```Python from findpeaks.findpeaks import findpeaks # Import an example dataset example_data = findpeaks.import_example('sample_1d') ``` -------------------------------- ### findpeaks.findpeaks.findpeaks.import_example Function Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Function_Reference.rst Imports example datasets for testing and demonstration purposes. This function provides sample data to help users understand and test the library's functionality. ```Python from findpeaks.findpeaks import findpeaks # Import an example dataset example_data = findpeaks.import_example('sample_1d') ``` -------------------------------- ### Find Peaks with Default Settings using findpeaks Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Examples.rst.txt Demonstrates importing data, initializing the findpeaks library with the 'mask' method, fitting the data, and plotting the preprocessing steps and results. It also shows initialization with the 'topology' method and fitting. ```python from findpeaks import findpeaks X = fp.import_example() print(X) fp = findpeaks(method='mask') fp.fit(X) fp.plot_preprocessing() fp.plot() fp = findpeaks(method='topology') fp.fit(X) ``` ```python fp.plot() ``` ```python fp.plot_mesh() ``` ```python fp.plot_persistence() ``` -------------------------------- ### Initialize and Plot 1D Peaks Data Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Topology.rst.txt Initializes the findpeaks library with the 'topology' method and imports/plots a 1D example dataset. This sets up the data for topological analysis. ```Python # Import library from findpeaks import findpeaks # Initialize fp = findpeaks(method='topology') # Example 1d-vector X = fp.import_example('1dpeaks') # Plot plt.plot(X); plt.grid(True) ``` -------------------------------- ### Find Peaks with Default Settings using findpeaks Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Examples.rst Demonstrates importing data, initializing the findpeaks library with the 'mask' method, fitting the data, and plotting the preprocessing steps and results. It also shows initialization with the 'topology' method and fitting. ```python from findpeaks import findpeaks X = fp.import_example() print(X) fp = findpeaks(method='mask') fp.fit(X) fp.plot_preprocessing() fp.plot() fp = findpeaks(method='topology') fp.fit(X) ``` ```python fp.plot() ``` ```python fp.plot_mesh() ``` ```python fp.plot_persistence() ``` -------------------------------- ### Find Peaks with Default Settings using findpeaks Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Examples.rst.txt Demonstrates importing data, initializing the findpeaks library with the 'mask' method, fitting the data, and plotting the preprocessing steps and results. It also shows initialization with the 'topology' method and fitting. ```python from findpeaks import findpeaks X = fp.import_example() print(X) fp = findpeaks(method='mask') fp.fit(X) fp.plot_preprocessing() fp.plot() fp = findpeaks(method='topology') fp.fit(X) ``` ```python fp.plot() ``` ```python fp.plot_mesh() ``` ```python fp.plot_persistence() ``` -------------------------------- ### Initialize and Plot 1D Peaks Data Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Topology.rst Initializes the findpeaks library with the 'topology' method and imports/plots a 1D example dataset. This sets up the data for topological analysis. ```Python # Import library from findpeaks import findpeaks # Initialize fp = findpeaks(method='topology') # Example 1d-vector X = fp.import_example('1dpeaks') # Plot plt.plot(X); plt.grid(True) ``` -------------------------------- ### Visualizing Peaks with 3D Mesh Plots using findpeaks Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Use-cases.rst.txt This code illustrates how to generate 3D mesh plots using the findpeaks library to better understand the detected peaks and the effectiveness of denoising. It includes options for rotating the view to get a top-down perspective, aiding in the analysis of image features. ```python fp.plot_mesh() fp.plot_mesh(view=(90,0)) ``` -------------------------------- ### Configure GitHub Pages Source Source: https://github.com/erdogant/findpeaks/blob/master/docs/HOWTO.txt This section describes how to configure your GitHub repository settings to deploy your documentation using GitHub Pages. It involves selecting the master branch and the docs folder as the source. ```text Source: master branch/docs folder ``` -------------------------------- ### Install findpeaks using pip Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/index.html This snippet shows the command to install the findpeaks library using pip, the Python package installer. Ensure you have Python and pip installed. ```bash pip install findpeaks ``` -------------------------------- ### Install findpeaks using pip Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/index.html This snippet shows the command to install the findpeaks library using pip, the Python package installer. Ensure you have Python and pip installed. ```bash pip install findpeaks ``` -------------------------------- ### Initializing and Preprocessing Image Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Use-cases.rst Demonstrates the initialization of the findpeaks object and preprocessing steps for an image. This includes resizing, converting to grayscale, and scaling the image data to prepare it for peak detection and denoising. ```python from findpeaks import findpeaks fp = findpeaks(limit=160) img = fp.import_example('2dpeaks_image') import findpeaks # Some pre-processing # Resize img = findpeaks.stats.resize(img, size=(300,300)) # Make grey image img = findpeaks.stats.togray(img) # Scale between [0-255] img = findpeaks.stats.scale(img) ``` -------------------------------- ### Initializing and Preprocessing Image Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Use-cases.rst.txt Demonstrates the initialization of the findpeaks object and preprocessing steps for an image. This includes resizing, converting to grayscale, and scaling the image data to prepare it for peak detection and denoising. ```python from findpeaks import findpeaks fp = findpeaks(limit=160) img = fp.import_example('2dpeaks_image') import findpeaks # Some pre-processing # Resize img = findpeaks.stats.resize(img, size=(300,300)) # Make grey image img = findpeaks.stats.togray(img) # Scale between [0-255] img = findpeaks.stats.scale(img) ``` -------------------------------- ### Install findpeaks from GitHub Source: https://github.com/erdogant/findpeaks/blob/master/README.md Installs the findpeaks library directly from its GitHub repository source. This is useful for installing the latest development version. ```bash pip install git+https://github.com/erdogant/findpeaks ``` -------------------------------- ### Install findpeaks from PyPI Source: https://github.com/erdogant/findpeaks/blob/master/README.md Installs the findpeaks library using pip from the Python Package Index (PyPI). This is the standard way to install Python packages. ```bash pip install findpeaks ``` -------------------------------- ### Compare Peak Detection Methods (Peakdetect vs Topology) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Examples.html Compares the 'peakdetect' and 'topology' methods for peak detection on the same dataset. It shows how to initialize findpeaks with different methods and visualize the results, including persistence plots for the topology method. ```Python # Load library from findpeaks import findpeaks # Data X = [10,11,9,23,21,11,45,20,11,12] # Initialize fp = findpeaks(method='peakdetect', lookahead=1) results = fp.fit(X) # Plot fp.plot() ``` ```Python fp = findpeaks(method='topology', lookahead=1) results = fp.fit(X) fp.plot() fp.plot_persistence() ``` -------------------------------- ### Install findpeaks Python Package Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/index.rst This snippet shows the command to install the findpeaks library using pip, the Python package installer. It ensures you have the necessary tools to use the library for peak and valley detection. ```console pip install findpeaks ``` -------------------------------- ### Compare Peak Detection Methods (Peakdetect vs Topology) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Examples.html Compares the 'peakdetect' and 'topology' methods for peak detection on the same dataset. It shows how to initialize findpeaks with different methods and visualize the results, including persistence plots for the topology method. ```Python # Load library from findpeaks import findpeaks # Data X = [10,11,9,23,21,11,45,20,11,12] # Initialize fp = findpeaks(method='peakdetect', lookahead=1) results = fp.fit(X) # Plot fp.plot() ``` ```Python fp = findpeaks(method='topology', lookahead=1) results = fp.fit(X) fp.plot() fp.plot_persistence() ``` -------------------------------- ### Initialize and Use findpeaks Preprocessing Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Pre-processing.rst.txt Demonstrates how to initialize the findpeaks object with specific preprocessing parameters like image size, scaling, grayscale conversion, and denoising. It also shows how to import an example dataset, apply the preprocessing and peak detection using the fit method, and plot the results. ```python from findpeaks import findpeaks fp = findpeaks(method="topology", whitelist=['peak'], imsize=(50,100), scale=True, togray=True, denoise=None) X = fp.import_example("2dpeaks") results = fp.fit(X) fp.plot(figure_order='horizontal') ``` -------------------------------- ### Install findpeaks Python Package Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/index.rst.txt This snippet shows the command to install the findpeaks library using pip, the Python package installer. It ensures you have the necessary tools to use the library for peak and valley detection. ```console pip install findpeaks ``` -------------------------------- ### Install findpeaks Python Package Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/index.rst.txt This snippet shows the command to install the findpeaks library using pip, the Python package installer. It ensures you have the necessary tools to use the library for peak and valley detection. ```console pip install findpeaks ``` -------------------------------- ### Initialize and Use findpeaks Preprocessing Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Pre-processing.rst.txt Demonstrates how to initialize the findpeaks object with specific preprocessing parameters like image size, scaling, grayscale conversion, and denoising. It also shows how to import an example dataset, apply the preprocessing and peak detection using the fit method, and plot the results. ```python from findpeaks import findpeaks fp = findpeaks(method="topology", whitelist=['peak'], imsize=(50,100), scale=True, togray=True, denoise=None) X = fp.import_example("2dpeaks") results = fp.fit(X) fp.plot(figure_order='horizontal') ``` -------------------------------- ### Find Peaks in Facebook Stock Data with Caerus Method Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Use-cases.rst.txt This code example shows how to apply the findpeaks library using the 'Caerus' method to analyze Facebook stock data. It covers importing the library, initializing the findpeaks object, loading the example Facebook stock data, fitting the model to the data, and visualizing the detected peaks. ```python # Import library from findpeaks import findpeaks # Initialize findpeaks with cearus method. # The default setting is that it only return peaks-vallyes with at least 5% difference. We can change this using params fp = findpeaks(method='caerus') # Import example data X = fp.import_example('facebook') # Fit results = fp.fit(X) # Make the plot fp.plot() ``` -------------------------------- ### Find Peaks in Facebook Stock Data with Caerus Method Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Use-cases.rst.txt This code example shows how to apply the findpeaks library using the 'Caerus' method to analyze Facebook stock data. It covers importing the library, initializing the findpeaks object, loading the example Facebook stock data, fitting the model to the data, and visualizing the detected peaks. ```python # Import library from findpeaks import findpeaks # Initialize findpeaks with cearus method. # The default setting is that it only return peaks-vallyes with at least 5% difference. We can change this using params fp = findpeaks(method='caerus') # Import example data X = fp.import_example('facebook') # Fit results = fp.fit(X) # Make the plot fp.plot() ``` -------------------------------- ### Initialize and Fit Peak Detection Methods (Python) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Performance.rst.txt Demonstrates initializing and fitting the 'peakdetect' and 'topology' methods from the findpeaks library on a small 1D dataset. It shows how to configure interpolation and lookahead parameters and then plots the results. ```python from findpeaks import findpeaks # peakdetect without interpolation fp_peakdetect = findpeaks(method='peakdetect', interpolate=None, lookahead=1) # peakdetect with interpolation fp_peakdetect_int = findpeaks(method='peakdetect', interpolate=10, lookahead=1) # topology without interpolation fp_topology = findpeaks(method='topology', interpolate=None) # topology with interpolation fp_topology_int = findpeaks(method='topology', interpolate=10) # Example 1d-vector with mixed peak sizes X = [1,1,1.1,1,0.9,1,1,1.1,1,0.9,1,1.1,1,1,0.9,1,1,1.1,1,1,1,1,1.1,0.9,1,1.1,1,1,0.9,1,1.1,1,1,1.1,1,0.8,0.9,1,1.2,0.9,1,1,1.1,1.2,1,1.5,1,3,2,5,3,2,1,1,1,0.9,1,1,3,2.6,4,3,3.2,2,1,1,0.8,4,4,2,2.5,1,1,1] # Fit the methods on the 1d-vector results_1 = fp_peakdetect.fit(X) results_2 = fp_peakdetect_int.fit(X) results_3 = fp_topology.fit(X) results_4 = fp_topology_int.fit(X) # Plot results fp_peakdetect.plot() fp_peakdetect_int.plot() fp_topology.plot() fp_topology_int.plot() ``` -------------------------------- ### Install findpeaks Python Library Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/index.html This snippet provides instructions on how to install the findpeaks Python library using pip. It's a common first step for using the library. ```bash pip install findpeaks ``` -------------------------------- ### Initialize and Use findpeaks Preprocessing Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Pre-processing.rst Demonstrates how to initialize the findpeaks object with specific preprocessing parameters like image size, scaling, grayscale conversion, and denoising. It also shows how to import an example dataset, apply the preprocessing and peak detection using the fit method, and plot the results. ```python from findpeaks import findpeaks fp = findpeaks(method="topology", whitelist=['peak'], imsize=(50,100), scale=True, togray=True, denoise=None) X = fp.import_example("2dpeaks") results = fp.fit(X) fp.plot(figure_order='horizontal') ``` -------------------------------- ### 1D Peak Detection with Interpolation (Python) Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Examples.rst Shows how interpolation using `interpolate_line1d` can improve peak detection results in 1D data. The example initializes findpeaks with an 'interpolate' parameter and plots the results. ```python fp = findpeaks(lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` -------------------------------- ### 1D Peak Detection with Interpolation (Python) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/_sources/Examples.rst.txt Shows how interpolation can improve peak detection results in 1D data. This example initializes the findpeaks library with an interpolation parameter and then fits and plots the data. ```python # Initialize with interpolation parameter fp = findpeaks(lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` -------------------------------- ### Find Peaks in High Sampled Dataset (Peakdetect vs Topology) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Examples.html Demonstrates peak detection on a large, noisy dataset using both 'peakdetect' and 'topology' methods. It shows how to generate synthetic data and visualize the detection results, including persistence for the topology method. ```Python # Load library import numpy as np from findpeaks import findpeaks # Data i = 10000 xs = np.linspace(0,3.7*np.pi,i) X = (0.3*np.sin(xs) + np.sin(1.3 * xs) + 0.9 * np.sin(4.2 * xs) + 0.06 * np.random.randn(i)) # Initialize fp = findpeaks(method='peakdetect') results = fp.fit(X) # Plot fp.plot1d() ``` ```Python fp = findpeaks(method='topology', limit=1) results = fp.fit(X) fp.plot1d() fp.plot_persistence() ``` -------------------------------- ### 1D Peak Detection with Interpolation (Python) Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/_sources/Examples.rst.txt Shows how interpolation can improve peak detection results in 1D data. This example initializes the findpeaks library with an interpolation parameter and then fits and plots the data. ```python # Initialize with interpolation parameter fp = findpeaks(lookahead=1, interpolate=10) results = fp.fit(X) fp.plot() ``` -------------------------------- ### Initialize and Fit Topology Method in Python Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Topology.html Demonstrates how to initialize the findpeaks object with the 'topology' method and then fit it to one-dimensional data (X). It also shows how to print the keys of the results dictionary. ```Python from findpeaks import findpeaks fp = findpeaks(method='topology', interpolate=None, limit=None, figsize=(15, 8)) results = fp.fit(X) print(results.keys()) ``` -------------------------------- ### Initialize and Fit Topology Method in Python Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/Topology.html Demonstrates how to initialize the findpeaks object with the 'topology' method and then fit it to one-dimensional data (X). It also shows how to print the keys of the results dictionary. ```Python from findpeaks import findpeaks fp = findpeaks(method='topology', interpolate=None, limit=None, figsize=(15, 8)) results = fp.fit(X) print(results.keys()) ``` -------------------------------- ### Find Peaks with Advanced Pre-processing Source: https://github.com/erdogant/findpeaks/blob/master/docs/pages/html/Examples.html This snippet illustrates finding peaks with advanced pre-processing enabled. It includes initializing findpeaks with parameters like scaling, denoising, converting to grayscale, and resizing the image. The code demonstrates fitting the data and plotting the preprocessing pipeline and final results. ```python from findpeaks import findpeaks X = fp.import_example() fp = findpeaks(method='topology', scale=True, denoise=10, togray=True, imsize=(50,100)) results = fp.fit(X) fp.plot() fp.plot_preprocessing() ``` -------------------------------- ### Compare Peak Detection Methods (1D) (Python) Source: https://github.com/erdogant/findpeaks/blob/master/docs/source/Examples.rst Compares the 'peakdetect' and 'topology' methods for peak detection on the same 1D dataset. It demonstrates the different characteristics of each approach and includes plotting of the results and persistence diagrams. ```python from findpeaks import findpeaks X = [10,11,9,23,21,11,45,20,11,12] fp = findpeaks(method='peakdetect', lookahead=1) results = fp.fit(X) fp.plot() fp = findpeaks(method='topology', lookahead=1) results = fp.fit(X) fp.plot() fp.plot_persistence() ```