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.1.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 globalsplinefit 2.1.0
File Size Uploaded
globalsplinefit-2.1.0.tar.gz 814.6 kB Details

Built distribution (wheel)

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

Total release size: 1.4 MB

Release files / globalsplinefit-2.1.0.tar.gz

Download URL globalsplinefit-2.1.0.tar.gz
Size 814.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9f66076dca1ec4b34550ecc2eb6d507df16da4a277067c70fff9df38e6b6647d
BLAKE2b-256 checksum
How to use checksums
30e9a7c00262332a1da6b2923335bf790e5f97eacc92087507a63355e5ab758f
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 Oct 6, 2026.

Transparency log

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

Download URL globalsplinefit-2.1.0-py3-none-any.whl
Size 623.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0f422ecf00f0beefddbf213c4fbdcca32921ff01c77f497e08bf9e8d6ae496f
BLAKE2b-256 checksum
How to use checksums
cd9d0be2bd24e6d81e271dec1b72b69db2707bfc76880b837081d08f9843ef25
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 Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.1

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