Skip to main content

high-throughput spectrum peak modeling tools by using Spectrum adapted EM algorithms

Project description

EMPeaks

This package is for high-throughput peak analysis by using Spectrum Adapted EM algorithm. Please refer the following paper when using this package: Sci. Tech. Adv. Mater. 20, 733-735 (2019).; Sci. Tech. Adv. Mater. method 1, 45 (2021).

Version 3.0.x (Backend in Rust & GUI Application)

Version 3.0.x brings major updates to EMPeaks, focusing on performance and usability:

  • Backend in Rust: The core algorithms have been rewritten in Rust, achieving substantial speedups in execution time and enabling more efficient high-throughput analysis.
  • GUI Application: We have developed a new, user-friendly GUI application. It provides an intuitive environment for interactive data visualization, parameter tuning, and peak fitting.

Installation

1. Install via Wheel from GitHub Releases (Recommended for v3.0.x) We provide pre-compiled wheel (.whl) files for Python 3.11 and later. Download the appropriate .whl file for your operating system from the GitHub Releases page. Then navigate to the downloaded directory in your terminal and install it using pip:

  • Windows (x64)

    pip install empeaks-3.0.0-cp311-abi3-win_amd64.whl
    
  • macOS (Universal2 for Intel & Apple Silicon)

    pip install empeaks-3.0.0-cp311-abi3-macosx_*_universal2.whl
    
  • Linux (x86_64)

    pip install empeaks-3.0.0-cp311-abi3-manylinux_*_x86_64.whl
    

2. Install via PyPI (Currently Outdated)

You can also install EMPeaks from PyPI using pip:

pip install EMPeaks

[!WARNING] Due to a current issue with PyPI, the pip install EMPeaks command may install an older version, and updating to v3.0.x via PyPI is temporarily unavailable. Please use the wheel installation from GitHub Releases to get the latest 3.0.x features.

Usage

After installation, you can launch the new GUI application by running the following command:

empeaks deck

Version 2.2.x (Deterministic Annealing & TSDC mixture model)

In version 2.2.x, fitting model of Thermally Stimulated Depolarization Current(TSDC) and Deterministic Annealing with Dirichlet prior for mixing ratio estimation is implemented.

You can refer the details of the implementation in these papers;

TSDC modeling

TSDC modeling is available with a same way to use other models like Gaussian mixture models. You can test the model by example object as follows:

from EMPeaks import TSDCMixture

tsdc = TSDCMixture.TSDCMixtureModel()
examples = TSDCMixture.Tests.Example(K=4)

examples.adapted_em()
examples.leastsq()

The method of examples.adapted_em() executes fitting of TSDC mixture model via EM algorithm. The method of examples.leastsq_tau0() demonstrates the fitting of TSDC mixture model via least-square method for the variables of $E_a$, $T_p$, and $\pi$ in each component. $E_a$, $T_p$, and $\pi$ represent activation energy, peak temperature, and mixture ratio, respectively.

Deterministic Annealing

Deterministic Annealing is a kind of sparse modeling. We can select important peak component automatically by Dirichlet prior for mixture ratio. First, enough peak number $K$ should set. Dirichlet prior conducts mixture ratio of redundant components to zero. It is implemented in EMCore/_em_core.py. Deterministic annealing is available for all mixture models. For example, following code shows how to use deterministic annealing with Gaussian mixture models.

from EMPeaks import GaussianMixture

x = np.load("energy.dat")
y = np.load("intensity.dat")

gmm = GaussianMixture.GaussianMixtureModel(K=10, background='linear')
gmm.Dirichlet_alpha = 0.5
gmm.deterministic_annealing(x, y)

In default, Dirichlet_alpha=1.0. Please change it to the number less than 1.0 if you want to introduce it, for example, 0.5.

Version 2.1.x (Background Subtraction)

In version 2.1.x, Automated background subtraction is implemented. Following background models are available now.

  • uniform: uniform background model
  • linear: linear background model (positive gradient)
  • ramp_sum: Ramp-Sum background model

The details of these models are explained in this paper, Sci. Tech. Adv. Mater. Method 3, 2159753 (2023).

Background models are easily implemented into model instance as follows;

from EMPeaks import GaussianMixture
gmm = GaussianMixture.GaussianMixtureModel(K=3, background='uniform')

Keywords to set the background models are uniform, linear, ramp_sum.

Version 2.0.x

In version 2.0.x, Gaussian Mixture Model (GMM), Lorentzian Mixture Model (LMM), Pseudo Voigt Mixture model (PVMM), and Doniach-Sunijic Miture model (DSMM). In principle, these combination models are also available but not implemented yet.

From this version, each model has the same functions but differ from version 1, though functions and classes in version 1 still work. Sample codes to import these models are followings for instance:

from EMPeaks import GaussianMixture
gmm = GaussianMixture.GaussianMixtureModel(K=3)
from EMPeaks import LorentzianMixture
lmm = LorentzianMixture.LorentzianMixtureModel(K=2)

Mixture model object includes a single model object. These packages also have a class for single Gaussian, Lorentizan, pseudo Voigt, and DS models. For example,

from EMPeaks import GaussianMixture
gm = GaussianMixture.Gaussian(x_min=-100, x_max=100, sigma_min=0.1, sigma_max=10)

In version 2, we do not implement the class for optimization. Instead,all model classes has functions to optimize the parameters to fit the target data.

from EMPeaks import GaussianMixture
import numpy as np

x = np.load("energy.dat")
y = np.load("intensity.dat")

gmm = GaussianMixture.GaussianMixtureModel(K=3)
gmm.fit(x, y)
# if you want to sample some initial guess and choose the highest likelihood model,
gmm.sampling(x, y, trial=10)

After fitting, you can plot both raw data and fitted model as follows:

gmm.plot(x, y)

© 2020-2023 National Institute of Advanced Industrial Science and Technology (AIST)
© 2024-2026 Yasunobu Ando in Science Tokyo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

empeaks-3.0.0-cp311-abi3-win_amd64.whl (566.1 kB view details)

Uploaded CPython 3.11+Windows x86-64

empeaks-3.0.0-cp311-abi3-manylinux_2_28_x86_64.whl (595.1 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

empeaks-3.0.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (982.4 kB view details)

Uploaded CPython 3.11+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file empeaks-3.0.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: empeaks-3.0.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 566.1 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for empeaks-3.0.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0b091299d93850405a997c12c1008c0b15af40260f142b4ac8bbbac69d877f36
MD5 cb1834746960140ecc9ecddaf8aa3897
BLAKE2b-256 db1b2c85003c4ce5b01d27cdffc7113d24675b5029caf86b4d34ae9f617f9804

See more details on using hashes here.

File details

Details for the file empeaks-3.0.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for empeaks-3.0.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e5db1755918cc92d09194ca06daabd95b075d22a8b783cbeb3cc012a50b2ef43
MD5 d668340579e6d4fc4f484441cb64f2aa
BLAKE2b-256 3bae2d29bfa0b4c39746266783dc7ea5c00649bcac416f8950f9702ae8253278

See more details on using hashes here.

File details

Details for the file empeaks-3.0.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for empeaks-3.0.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 188239c7428cfc53f39914b03bb85bfdba6a04b34629db78183aaca3b61a645b
MD5 8a8d88c6f903ff2cff6f94d21d0341c2
BLAKE2b-256 3fd855085d1aa781718d892c0e98a5afda206575c5923ab4d7742879b5470308

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page