Skip to content

Commit 51e2643

Browse files
Merge branch 'master' into expose-evolve-capi
2 parents 4cbb8f6 + eb3d184 commit 51e2643

9 files changed

Lines changed: 51 additions & 19 deletions

File tree

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-alpha4"
25+
version = "1.0.0-alpha5"
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
@@ -16,7 +16,7 @@ version.workspace = true
1616
workspace = true
1717

1818
[dependencies]
19-
pineappl = { path = "../pineappl", version = "=1.0.0-alpha4" }
19+
pineappl = { path = "../pineappl", version = "=1.0.0-alpha5" }
2020
itertools = "0.10.1"
2121
ndarray = "0.15.4"
2222

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-alpha4" }
34-
pineappl_applgrid = { optional = true, path = "../pineappl_applgrid", version = "=1.0.0-alpha4" }
35-
pineappl_fastnlo = { optional = true, path = "../pineappl_fastnlo", version = "=1.0.0-alpha4" }
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" }
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
@@ -30,5 +30,5 @@ crate-type = ["cdylib"]
3030
itertools = "0.10.1"
3131
ndarray = "0.15.4"
3232
numpy = "0.24.0"
33-
pineappl = { path = "../pineappl", version = "=1.0.0-alpha4" }
33+
pineappl = { path = "../pineappl", version = "=1.0.0-alpha5" }
3434
pyo3 = { features = ["extension-module"], version = "0.24.1" }

pineappl_py/src/fk_table.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
33
use super::convolutions::PyConv;
44
use super::grid::PyGrid;
5+
use super::pids::PyPidBasis;
56
use numpy::{IntoPyArray, PyArray1, PyArrayDyn};
67
use pineappl::convolutions::ConvolutionCache;
78
use pineappl::fk_table::{FkAssumptions, FkTable};
89
use pineappl::grid::Grid;
10+
use pineappl::pids::PidBasis;
911
use pyo3::prelude::*;
1012
use std::collections::BTreeMap;
1113
use std::fs::File;
@@ -206,6 +208,30 @@ impl PyFkTable {
206208
self.fk_table.x_grid().into_pyarray(py)
207209
}
208210

211+
/// Return the convention by which the channels' PIDS are encoded.
212+
#[getter]
213+
#[must_use]
214+
pub const fn pid_basis(&self) -> PyPidBasis {
215+
match self.fk_table.grid().pid_basis() {
216+
PidBasis::Pdg => PyPidBasis::Pdg,
217+
PidBasis::Evol => PyPidBasis::Evol,
218+
}
219+
}
220+
221+
/// Rotate the F Table into the specified basis.
222+
///
223+
/// Parameters
224+
/// ----------
225+
/// pid_basis: PyPidBasis
226+
/// PID basis of the resulting FK Table
227+
pub fn rotate_pid_basis(&mut self, pid_basis: PyPidBasis) -> PyGrid {
228+
let mut grid_mut = self.fk_table.grid().clone();
229+
grid_mut.rotate_pid_basis(pid_basis.into());
230+
PyGrid {
231+
grid: grid_mut.clone(),
232+
}
233+
}
234+
209235
/// Write to file.
210236
///
211237
/// # Panics

pineappl_py/src/grid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ impl PyGrid {
696696
self.grid.dedup_channels(ulps);
697697
}
698698

699-
/// Rotate the Grid into the specified basis
699+
/// Rotate the Grid into the specified basis.
700700
///
701701
/// Parameters
702702
/// ----------

pineappl_py/tests/test_fk_table.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pineappl.convolutions import Conv, ConvType
1212
from pineappl.fk_table import FkAssumptions, FkTable
1313
from pineappl.subgrid import ImportSubgridV1
14+
from pineappl.pids import PidBasis
1415

1516

1617
class TestFkTable:
@@ -78,7 +79,7 @@ def test_fktable(
7879

7980
assert fk.table().shape == (1, 51, 34, 34)
8081
np.testing.assert_allclose(fk.fac0(), 2.7224999999999997)
81-
assert fk.frg0() == None
82+
assert fk.frg0() is None
8283

8384
# Check the various aspects of the Bins
8485
assert fk.bins() == 1
@@ -110,6 +111,11 @@ def test_fktable(
110111
assumption = FkAssumptions("Nf6Sym")
111112
fk.optimize(assumption)
112113

114+
# Check that FK table is in the Evolution basis and rotate into PDG
115+
assert fk.pid_basis == PidBasis.Evol
116+
new_fk = fk.rotate_pid_basis(PidBasis.Pdg)
117+
assert new_fk.pid_basis == PidBasis.Pdg
118+
113119
def test_unpolarized_convolution(
114120
self,
115121
pdf,

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-alpha4" }
24+
pineappl_cli = { path = "../pineappl_cli", version = "=1.0.0-alpha5" }

0 commit comments

Comments
 (0)