Skip to main content

GlobalSplineFit

PyPI version Python 3.10+ License: BSD-3-Clause Tests

Parametric model of cosmic ray flux and composition based on cubic B-spline fits to observational data. Covers all elements Z=1--28, with full covariance propagation and solar modulation.

Installation

pip install globalsplinefit

Quick Start

from globalsplinefit import GSFEnergy
import numpy as np

model = GSFEnergy()          # default 2026 fit
model_uso = GSFEnergy(version="2026-USO")  # Usoskin 2017 modulation
model_s23e = GSFEnergy(version="2026-SIB23e")  # SIBYLL-2.3e-only interpretation
model_epos = GSFEnergy(version="2026-EPOSLHCR")  # EPOS-LHC-R only (other half of the mixture)
model_2025 = GSFEnergy(version="2025")   # historical release
energy = np.logspace(0, 3, 100)  # 1 GeV to 1 TeV total energy

proton_flux = model.flux(energy, "p")
proton_error = model.error(energy, "p")
total_flux = model.total_flux(energy)

# Flux at Earth averaged over a time period (end month EXCLUSIVE):
# (200901, 201001) = calendar year 2009
flux_earth = model.flux(energy, "p", time_interval=(200901, 201001))

Examples

Try the model without installing anything: the GSF Explorer and the tutorial gallery run in the browser.

The tutorials in examples/ are marimo notebooks — plain Python files you can open interactively or run as scripts:

uv run marimo edit examples/reduced_model.py   # interactive
uv run python examples/reduced_model.py        # run top to bottom

Need a Jupyter notebook? uvx marimo export ipynb examples/<name>.py -o <name>.ipynb.

How to cite

Please cite the GSF 2026 paper — A. Fedynitch, K. Fujisue, H. Dembinski, and R. Engel, Global Spline Fit: A unified data-driven view of the cosmic-ray spectrum and mass composition from GeV to the highest energies, arXiv:2609.32649 (2026) — and the software version you used. Machine-readable metadata is in CITATION.cff (GitHub's "Cite this repository" button); the documentation lists the reference for every parameter set and solar-modulation potential.

Development

Development uses uv:

git clone https://github.com/gsf-project/globalsplinefit.git
cd globalsplinefit
uv sync --all-extras     # creates .venv with all optional dependencies
uv run pytest tests/
uv run pre-commit install

Contributions are welcome — see CONTRIBUTING.md (it also serves as the orientation guide for AI coding agents).

License

BSD 3-Clause. See LICENSE.

Metadata

Release files for globalsplinefit 2.0.1

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

Source distribution (sdist)

Source distribution for globalsplinefit 2.0.1
File Size Uploaded
globalsplinefit-2.0.1.tar.gz 812.4 kB Details

Built distribution (wheel)

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

Total release size: 1.4 MB

Release files / globalsplinefit-2.0.1.tar.gz

Download URL globalsplinefit-2.0.1.tar.gz
Size 812.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4884221e3fd86702ded5c411cf048fc257405ee7ace5b0786f32f5853f773f39
BLAKE2b-256 checksum
How to use checksums
ff2285324c3c013d32ad6205f5216c2787345fa409a408570b475e53f6629b3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / globalsplinefit-2.0.1-py3-none-any.whl

Download URL globalsplinefit-2.0.1-py3-none-any.whl
Size 622.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e22d8be96740cc77b32d77e1b9d7dd9bceb2c674e19e736e9281958c2a8e57bd
BLAKE2b-256 checksum
How to use checksums
4518781681cc8758853bda3b683ccb7123774e79c3a93253a0c16d1fc5e56d2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

2.1.0

2 release files

This release

2.0.1 This release

2 release files

2.0.0

2 release files

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