Skip to content

Commit 14ba72b

Browse files
Merge branch 'master' into expose-evolve-capi
2 parents be40eb0 + 62c5b98 commit 14ba72b

9 files changed

Lines changed: 44 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.0.0] - 10/06/2025
11+
1012
PineAPPL 1.0 is a major rewrite from the previous version, allowing grids to
1113
have an arbitrary number of convolutions in the initial (PDFs with a
1214
factorization scale) and in the final (FFs with a fragmentation scale) state.
@@ -741,7 +743,8 @@ the old file format can still be read with this new version.
741743

742744
- first release
743745

744-
[Unreleased]: https://github.com/NNPDF/pineappl/compare/v0.8.2...HEAD
746+
[Unreleased]: https://github.com/NNPDF/pineappl/compare/v1.0.0...HEAD
747+
[1.0.0]: https://github.com/NNPDF/pineappl/compare/v0.8.2...v1.0.0
745748
[0.8.7]: https://github.com/NNPDF/pineappl/compare/v0.8.6...v0.8.7
746749
[0.8.6]: https://github.com/NNPDF/pineappl/compare/v0.8.5...v0.8.6
747750
[0.8.5]: https://github.com/NNPDF/pineappl/compare/v0.8.4...v0.8.5

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ keywords = ["high-energy-physics", "physics"]
2222
license = "GPL-3.0-or-later"
2323
repository = "https://github.com/NNPDF/pineappl"
2424
rust-version = "1.80.1"
25-
version = "1.0.0-alpha5"
25+
version = "1.0.0"
2626

2727
[workspace.lints.clippy]
2828
all = { level = "warn", priority = -1 }

pineappl_capi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ version.workspace = true
1919
workspace = true
2020

2121
[dependencies]
22-
pineappl = { path = "../pineappl", version = "=1.0.0-alpha5" }
22+
pineappl = { path = "../pineappl", version = "=1.0.0" }
2323
itertools = "0.10.1"
2424
ndarray = "0.15.4"
2525

pineappl_cli/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ lhapdf = { package = "managed-lhapdf", version = "0.3.4" }
3030
lz4_flex = { optional = true, version = "0.9.2" }
3131
ndarray = "0.15.4"
3232
ndarray-npy = { optional = true, version = "0.8.1" }
33-
pineappl = { path = "../pineappl", version = "=1.0.0-alpha5" }
34-
pineappl_applgrid = { optional = true, path = "../pineappl_applgrid", version = "=1.0.0-alpha5" }
35-
pineappl_fastnlo = { optional = true, path = "../pineappl_fastnlo", version = "=1.0.0-alpha5" }
33+
pineappl = { path = "../pineappl", version = "=1.0.0" }
34+
pineappl_applgrid = { optional = true, path = "../pineappl_applgrid", version = "=1.0.0" }
35+
pineappl_fastnlo = { optional = true, path = "../pineappl_fastnlo", version = "=1.0.0" }
3636
prettytable-rs = { default-features = false, features = ["win_crlf"], version = "0.10.0" }
3737
rayon = "1.5.1"
3838
serde = { features = ["derive"], optional = true, version = "1.0.130" }

pineappl_py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ crate-type = ["cdylib"]
3131
itertools = "0.10.1"
3232
ndarray = "0.15.4"
3333
numpy = "0.24.0"
34-
pineappl = { path = "../pineappl", version = "=1.0.0-alpha5" }
34+
pineappl = { path = "../pineappl", version = "=1.0.0" }
3535
pyo3 = { features = ["extension-module"], version = "0.24.1" }

pineappl_py/src/grid.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use pineappl::grid::Grid;
1717
use pineappl::pids::PidBasis;
1818
use pyo3::exceptions::PyValueError;
1919
use pyo3::prelude::*;
20+
use pyo3::types::PyTuple;
2021
use std::collections::BTreeMap;
2122
use std::fs::File;
2223
use std::io::BufReader;
@@ -468,9 +469,8 @@ impl PyGrid {
468469
///
469470
/// Parameters
470471
/// ----------
471-
/// slices : list(list(tuple(PyOperatorSliceInfo, PyReadOnlyArray4)))
472-
/// list of EKOs where each element is a list of (PyOperatorSliceInfo, 4D array)
473-
/// describing each convolution
472+
/// slices : list(Generator(tuple(PyOperatorSliceInfo, PyReadOnlyArray4)))
473+
/// list of EKOs where each element is in turn a list of (PyOperatorSliceInfo, 4D array)
474474
/// order_mask : numpy.ndarray(bool)
475475
/// boolean mask to activate orders
476476
/// xi : (float, float)
@@ -486,7 +486,7 @@ impl PyGrid {
486486
/// produced FK table
487487
pub fn evolve(
488488
&self,
489-
slices: Vec<Vec<(PyOperatorSliceInfo, PyReadonlyArray4<f64>)>>,
489+
slices: Vec<Bound<PyAny>>,
490490
order_mask: Vec<bool>,
491491
xi: (f64, f64, f64),
492492
ren1: Vec<f64>,
@@ -496,12 +496,19 @@ impl PyGrid {
496496
.grid
497497
.evolve(
498498
slices
499-
.iter()
499+
.into_iter()
500500
.map(|subslice| {
501-
subslice.iter().map(|(info, op)| {
501+
// create lazy iterators from Python object
502+
subslice.try_iter().unwrap().map(|item| {
503+
let item = item.unwrap();
504+
let op_tuple = item.downcast::<PyTuple>().unwrap();
505+
let info: PyOperatorSliceInfo =
506+
op_tuple.get_item(0).unwrap().extract().unwrap();
507+
let op: PyReadonlyArray4<f64> =
508+
op_tuple.get_item(1).unwrap().extract().unwrap();
509+
502510
Ok::<_, std::io::Error>((
503-
info.info.clone(),
504-
// TODO: avoid copying
511+
info.info,
505512
CowArray::from(op.as_array().to_owned()),
506513
))
507514
})
@@ -512,7 +519,6 @@ impl PyGrid {
512519
&AlphasTable { ren1, alphas },
513520
)
514521
.map(|fk_table| PyFkTable { fk_table })
515-
// TODO: avoid unwrap and convert `Result` into `PyResult`
516522
.unwrap())
517523
}
518524

pineappl_py/tests/test_grid.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,8 @@ def test_evolve_with_two_ekos(
601601
h2 = ConvType(polarized=False, time_like=False)
602602
convolution_types = [h1, h2]
603603

604-
input_xgrid = np.geomspace(2e-7, 1, num=50)
605-
slices = []
606-
for conv_id, cvtype in enumerate(convolution_types):
607-
sub_slices = []
604+
def _q2_slices(cvtype):
605+
"""Pass one Q2 at a time using Generators."""
608606
for q2 in evinfo.fac1:
609607
info = OperatorSliceInfo(
610608
fac0=1.0,
@@ -626,8 +624,12 @@ def test_evolve_with_two_ekos(
626624
input_xgrid.size,
627625
),
628626
)
629-
sub_slices.append((info, op))
630-
slices.append(sub_slices)
627+
yield (info, op)
628+
629+
input_xgrid = np.geomspace(2e-7, 1, num=50)
630+
631+
# construct the slice object -- list of generator of slices
632+
slices = [_q2_slices(cvtype=cvtype) for cvtype in convolution_types]
631633

632634
fktable = g.evolve(
633635
slices=slices,

xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ clap_mangen = "0.2.26"
2121
enum_dispatch = "0.3.7"
2222
#git2 = "0.17.2"
2323
#semver = "1.0.17"
24-
pineappl_cli = { path = "../pineappl_cli", version = "=1.0.0-alpha5" }
24+
pineappl_cli = { path = "../pineappl_cli", version = "=1.0.0" }

0 commit comments

Comments
 (0)