Skip to main content

pkft: Peakfit Explorer

PyPI DOI

📚 See the documentation for details.

Peak finding for 1D data with uncertainties by discrete Gaussian mixture modeling (Galbraith & Laslett, 1993) in the spirit of IsoplotR peakfit (Vermeesch, 2018), served as a FastAPI service with a minimal dependency-free web UI.

Prerequisite software

This project is written in python. For most users, I recommend installing the miniforge python distribution. This distributions includes a minimal installation of python and the package manager conda, which is required to build the necessary python environment for this software.

For macOS users, miniforge can be installed with homebrew:

brew install miniforge

For Window's users, miniforge can be installed from a binary .exe. Follow the instructions for miniconda, anaconda, or miniforge (recommended) here.

Installation Guide

To install with Conda (recommended):

# Create conda environment
conda create -n pkft python=3.13 pip

# Activate conda environment
conda activate pkft

# Install pkft
pip install pkft

Usage Guide

After installing pkft, launch the server from the command line:

# Activate conda environment
conda activate pkft

# Launch server (UI at http://127.0.0.1:8000/)
pkft

The same JSON serves browsers and agents:

curl -X POST http://127.0.0.1:8000/fit \
  -H 'Content-Type: application/json' \
  -d '{"observations": [{"value": 17.634, "standard_error": 0.016}], "peak_count": 1}'

Open http://127.0.0.1:8000/ for the data explorer, http://127.0.0.1:8000/mixture for the mixture tab, or click Load demo for the bundled Trayler et al. 2020 dataset.

Method

The likelihood is the Galbraith & Laslett (1993) discrete mixture. Each observation $x_i$ with analytical variance $s_i^2$ contributes a mixture density over $k$ discrete ages $\mu_j$ with proportions $\pi_j$:

$$\ell = \sum_i \log \sum_{j=1}^{k} \pi_j , N(x_i \mid \mu_j, s_i^2)$$

Expectation–maximisation alternates between assigning points to peaks and moving the peaks, restarting 10 times from spread-out and random starting points and keeping the best likelihood. BIC with $p = 2k - 1$ parameters selects $k$. The fit maximises the same likelihood as IsoplotR peakfit with log=FALSE. Numbers can differ in the last digits because the optimiser and starting points differ. Component curves use the peak standard error for width and are weighted by each peak's share of the data. See the docs for the full API reference.

Citation

@software{pkft,
  author       = {Kerswell, Buchanan},
  title        = {pkft: Peakfit Explorer},
  month        = oct,
  year         = 2026,
  publisher    = {Zenodo},
  version      = {latest},
  doi          = {10.5281/zenodo.23735940},
  url          = {https://doi.org/10.5281/zenodo.23735940},
}

Acknowledgement

I gratefully acknowledge feedback and suggestions provided by Matthew Kohn and Kayleigh Harvey. Peak modeling follows IsoplotR (Vermeesch, 2018); demo data from Trayler et al. (2020).

Metadata

Release files for pkft 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pkft 0.3.0
File Size Uploaded Provenance Actions
pkft-0.3.0.tar.gz 176.9 kB Without provenance Details for pkft-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pkft 0.3.0
File Interpreter ABI Platform Actions
pkft-0.3.0-py3-none-any.whl Python 3 none any Details for pkft-0.3.0-py3-none-any.whl

Total release size: 198.2 kB

Release files / pkft-0.3.0.tar.gz

Download URL pkft-0.3.0.tar.gz
Size 176.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e02827605e9444e9aa9b6a0b222282e6119a9b9b986a92f9df9b57a9d3f1e1a4
BLAKE2b-256 checksum
How to use checksums
d98f5eae482c7e7d46ec735e855d8945cfd0ffa0c8c4430913d002cc1577d153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Release files / pkft-0.3.0-py3-none-any.whl

Download URL pkft-0.3.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d436e9be60ffd23140ebd85536f2e02ec0a44a743c453c028cad540970ad5ff9
BLAKE2b-256 checksum
How to use checksums
95e37a8b01289e588fbfdb0651f0204a63b8b91b845f8aa8fac3a3f07d301905
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Security for pkft 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page