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 (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.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.0.0
File Size Uploaded
globalsplinefit-2.0.0.tar.gz 815.5 kB Details

Built distribution (wheel)

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

Total release size: 1.4 MB

Release files / globalsplinefit-2.0.0.tar.gz

Download URL globalsplinefit-2.0.0.tar.gz
Size 815.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2f01b332bbaf51fb47689e148067f6028ba29d512e90596b3195ec65ed30d1b7
BLAKE2b-256 checksum
How to use checksums
c5e66df951538e1e7e17f57c98d5f0b0c3c2903722a582bff2640b760d640ba3
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 26, 2026.

Transparency log

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

Download URL globalsplinefit-2.0.0-py3-none-any.whl
Size 626.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e24bd04fe6df265eb49945aee72b85c722bb4f6edd4df82cde3579e08cab061e
BLAKE2b-256 checksum
How to use checksums
99a45cb2cb779020cb09587a45c0f926fb477bedc705d29ef65291530ed9dbfa
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 26, 2026.

Transparency log

Release history Release notifications | RSS feed

2.1.0

2 release files

2.0.1

2 release files

This release

2.0.0 This release

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