Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d8e4c3e
Init. changes
Radonirinaunimi Oct 10, 2025
22ea2d0
Mark tests passing
Radonirinaunimi Oct 10, 2025
9168a6d
Extend to `interpolator.rs`
Radonirinaunimi Oct 10, 2025
1d077f1
Make sure all crates compile
Radonirinaunimi Oct 10, 2025
4a051e5
Fix `UnexpectedEndOf` error
Radonirinaunimi Oct 11, 2025
e78d6d4
Fix backward compatibility issues
Radonirinaunimi Oct 11, 2025
e878119
Run pre-commit on all files
Radonirinaunimi Oct 11, 2025
639d859
Fix `7D` -> `8D`
Radonirinaunimi Oct 11, 2025
54b4cd9
Perform some clean up
Radonirinaunimi Oct 12, 2025
b1f5e93
Fix some of the CLI tests
Radonirinaunimi Oct 12, 2025
bf3c628
Fix CLI `read` test
Radonirinaunimi Oct 12, 2025
708e39f
Safeguard around `CODE_VERSION`
Radonirinaunimi Oct 12, 2025
fac1c1f
Fix TMD test
Radonirinaunimi Oct 15, 2025
2f40e6c
Bump data version
Radonirinaunimi Oct 15, 2025
75375a4
Fix minor bug in test
Radonirinaunimi Oct 16, 2025
c076ad8
Minor cosmetic changes
Radonirinaunimi Oct 21, 2025
c072f14
Add `LogFourCubic` and `LogFiveCubic` interpolation strategies
Radonirinaunimi Oct 21, 2025
7b568b6
Minor adjustments to the interpolations
Radonirinaunimi Oct 21, 2025
5b6c7c8
Attempt to test on macOS
Radonirinaunimi Oct 21, 2025
c44afba
Avoid fail fast
Radonirinaunimi Oct 21, 2025
2487424
Skip macOS for coverage generation
Radonirinaunimi Oct 21, 2025
0f126fe
Try to fix race condition
Radonirinaunimi Oct 22, 2025
f6dd804
Specify version in benchmark
Radonirinaunimi Oct 22, 2025
ab35289
Bump `numpy` and `pyo3` to `v0.27`
Radonirinaunimi Oct 24, 2025
5ac7e09
Fix warnings
Radonirinaunimi Oct 24, 2025
144ada2
Update changelogs
Radonirinaunimi Oct 24, 2025
39f2bb1
Try to include Python 3.14 in the tests
Radonirinaunimi Oct 25, 2025
a31476c
Add `neopdf read code-version` CLI
Radonirinaunimi Oct 25, 2025
3e8141e
Test CLI `code-version`
Radonirinaunimi Oct 25, 2025
5f9f2b3
Add strategies for 4D and 5D `LogChebyshev`
Radonirinaunimi Oct 26, 2025
d0c2cde
Propagate 4D and 5D `LogChebyshev` into `interpolator.rs`
Radonirinaunimi Oct 26, 2025
a207307
Account for `xi` anbd `delta` when writing Grids
Radonirinaunimi Oct 29, 2025
d404e61
Add complementary checks
Radonirinaunimi Oct 29, 2025
c17f00c
Add C++ test for v2 compress
Radonirinaunimi Oct 30, 2025
c3298ce
Propagate v2 compress to Fortran
Radonirinaunimi Oct 30, 2025
0faf147
Update changelogs
Radonirinaunimi Oct 30, 2025
713484c
Propagate `xi` and `delta` to Python
Radonirinaunimi Oct 31, 2025
ec7834f
Update changelogs
Radonirinaunimi Oct 31, 2025
1d75225
Address Clippy warnings
Radonirinaunimi Oct 31, 2025
6705b3d
Undo version pin in CI benchmark
Radonirinaunimi Oct 31, 2025
3c34523
Update README
Radonirinaunimi Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/cache-data/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
uses: actions/cache@v4
with:
path: neopdf-data
key: data-v11
key: data-v12
- name: Download data if cache miss
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
id: bench
run: |
export NEOPDF_DATA_PATH=${PWD}/neopdf-data
# The awk command filters out the verbose test summary before the benchmark results.
# TODO: remove the version specification
cargo bench -p neopdf -- --nocapture | awk '/^test result: ok\./ {p=1; next} p' | tee benchmark_results.txt

- name: Post benchmark results as a PR comment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/run-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ env:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -37,9 +38,12 @@ jobs:
run: |
export NEOPDF_DATA_PATH=${PWD}/neopdf-data
cargo test --workspace --exclude neopdf_pyapi --exclude neopdf_tmdlib --exclude neopdf_wolfram --no-fail-fast 2> >(tee stderr 1>&2)
sed -i 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' stderr
if [ "${{ matrix.os }}" != "macos-latest" ]; then
sed -i 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' stderr
fi

- name: Generate code coverage
if: matrix.os == 'ubuntu-latest'
run: |
find . -name '*.profraw' -exec $(rustc --print target-libdir)/../bin/llvm-profdata merge -sparse -o neopdf.profdata {} +
( sed -nE 's/[[:space:]]+Running( unittests|) [^[:space:]]+ \(([^)]+)\)/\2/p' stderr && echo target/debug/doctestbins/*/rust_out | tr ' ' "\n" ) | \
Expand All @@ -57,6 +61,7 @@ jobs:
grep SF lcov.info | sort -u | sed 's/SF://'

- name: Upload to codecov.io
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added `LogFourCubic` and `LogFiveCubic` interpolation strategies.
- Added new methods to the Fortran and C/C++ APIs to write and compress grids
with `xi` and `delta` dependence.

### Changed

- Breaking change to the Python API for the `PyMetaData` and `PySubgrid`.
- Bump `PyO3` and `numpy` versions to `v0.27` to support Python `3.14`.
- Extended the Grid layout to support GTMDs and GPDs (https://github.com/QCDLab/neopdf/pull/79).

## [0.2.0] - 06/10/2025

### Added
Expand Down
58 changes: 41 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ clap = { version = "4.5", features = ["derive"] }
terminal_size = "0.3.0"

# Python bindings
numpy = "0.25"
pyo3 = { version = "0.25", features = ["extension-module"] }
numpy = "0.27"
pyo3 = { version = "0.27", features = ["extension-module"] }

# Build dependencies
cbindgen = "0.26.0"
Expand Down
31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@
</div>

<p align="justify">
<b>NeoPDF</b> is a fast, reliable, and scalable interpolation library for both <b>collinear</b>
and <b>transverse momentum dependent</b> Parton Distribution Functions with <b>modern features</b>
designed for both present and future hadron collider experiments:
<b>NeoPDF</b> is a fast, reliable, and scalable interpolation library for <b>Non-Perturbative Distribution Functions</b>
with <b>modern features</b> designed for both present and future hadron collider experiments:

<ul>
<li>
<p align="justify">
Beyond interpolations over the kinematic variables (<b>x</b>, <b>kT</b>, <b>Q2</b>), NeoPDF
Beyond interpolations over the kinematic variables (<b>x</b>, <b>ξ</b>, <b>Δ</b>, <b>kT</b>, <b></b>), NeoPDF
also supports interpolations along the nucleon numbers <b>A</b> (relevant for <b>nuclear</b> PDFs
and TMDs) and the strong coupling <b>αs(MZ)</b>.
</p>
Expand All @@ -60,6 +59,30 @@
</ul>
</p>

## Supported distributions

<p align="justify">
NeoPDF supports generic classes of distributions that are functions of different combinations of the kinematic
variables. Examples of distribution functions are given in the diagram below with their simplified relationships.
</p>

```mermaid
graph TD

A["**Generalized Tranverse Momentum Distribution** <br> GTMD(x, ξ, Δ, kT​​, Q²)"]

A -->|∫ dkT| B["**Generalized Parton Distributions** <br> GPD(x, ξ, Δ, Q²)"]
A -->|ξ → 0, Δ → 0| C["**Transverse Momentum Distributions** <br> TMD(x, kT, Q²)"]

B -->|ξ → 0, Δ → 0| D["**Collinear Parton Distribution Functions** <br> PDF(x, Q²)"]
C -->|∫ dkT| D

style A fill:#ffd580,stroke:#b8860b,stroke-width:2px
style B fill:#add8e6,stroke:#1e90ff,stroke-width:2px
style C fill:#98fb98,stroke:#228b22,stroke-width:2px
style D fill:#f08080,stroke:#8b0000,stroke-width:2px
```

## Quick Links

- [Documentation](https://qcdlab.github.io/neopdf/) | [Rust Crate Documentation](https://docs.rs/neopdf/0.1.1/neopdf/) | [C++ API Reference](https://neopdf.readthedocs.io/en/latest/)
Expand Down
3 changes: 3 additions & 0 deletions neopdf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ regex.workspace = true
git-version.workspace = true
indicatif.workspace = true

# For backward compatibility with v0.2.0 format
neopdf_legacy = { package = "neopdf", version = "0.2.0" }

[dev-dependencies]
criterion.workspace = true

Expand Down
22 changes: 13 additions & 9 deletions neopdf/src/alphas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ impl AlphaSAnalytic {
meta.alphas_order_qcd
};

let (_m_up, _m_down, _m_strange, m_charm, m_bottom, m_top) = meta.quark_masses();

Ok(Self {
qcd_order: alphas_order_qcd,
lambda_maps,
mc_sq: meta.m_charm * meta.m_charm,
mb_sq: meta.m_bottom * meta.m_bottom,
mt_sq: meta.m_top * meta.m_top,
mc_sq: m_charm * m_charm,
mb_sq: m_bottom * m_bottom,
mt_sq: m_top * m_top,
num_fl: meta.number_flavors,
fl_scheme: meta.flavor_scheme.clone(),
})
Expand Down Expand Up @@ -162,7 +164,7 @@ impl AlphaSAnalytic {
let mut tmp = 1.0;

if self.qcd_order == 0 {
return 0.118; // _alpha_mz reference value
return 0.118; // `_alpha_mz` reference value
}

if self.qcd_order > 1 {
Expand Down Expand Up @@ -202,20 +204,22 @@ pub struct AlphaSInterpol {

impl AlphaSInterpol {
pub fn from_metadata(meta: &MetaData) -> Result<Self, String> {
let (q_values, alphas_vals): (Vec<_>, Vec<_>) = meta
.alphas_q_values
let alphas_q_values = &meta.alphas_q_values;
let alphas_vals = &meta.alphas_vals;

let (q_values, alphas_vals_filtered): (Vec<_>, Vec<_>) = alphas_q_values
.iter()
.zip(&meta.alphas_vals)
.zip(alphas_vals)
.enumerate()
.filter(|(i, (&q, _))| *i == 0 || q != meta.alphas_q_values[i - 1])
.filter(|(i, (&q, _))| *i == 0 || q != alphas_q_values[i - 1])
.map(|(_, (&q, &alpha))| (q, alpha))
.unzip();

let q2_values: Vec<f64> = q_values.iter().map(|&q| (q * q).ln()).collect();

let interpolator = Interp1D::new(
q2_values.into(),
alphas_vals.into(),
alphas_vals_filtered.into(),
AlphaSCubicInterpolation,
Extrapolate::Error,
)
Expand Down
Loading