Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0fe55b4
Add old PineAPPL v0 code
cschwan Mar 29, 2026
34cefef
Replace `pineappl-v0.8.x` with new crate `pineappl_v0`
cschwan Mar 29, 2026
bedb693
Update also `pineappl_v0` version numbers for a release
cschwan Mar 29, 2026
27aac44
Fix compiler warnings
cschwan Mar 29, 2026
7a0d6ef
Fix crate name
cschwan Mar 29, 2026
a4f949a
Minimize dependencies
cschwan Mar 29, 2026
eaa01fb
Upgrade `pineappl_v0` to Rust 2024
cschwan Mar 29, 2026
26fd110
Actually test all crates in CI
cschwan Mar 29, 2026
85dfb44
Fix `pineappl_v0` doctests
cschwan Mar 29, 2026
267d72b
Remove `evolve_info` unit test
cschwan Mar 29, 2026
ba5aadb
Setup Python in workflows to fix CI
cschwan Apr 1, 2026
38d2eb4
Print environment variables
cschwan Apr 1, 2026
2bdafcb
Disable some workflows temporarily
cschwan Apr 1, 2026
370b06b
Revert "Actually test all crates in CI"
cschwan Apr 1, 2026
ff422a2
Revert "Disable some workflows temporarily"
cschwan Apr 1, 2026
3d39e89
Revert "Print environment variables"
cschwan Apr 1, 2026
68fa724
Revert "Setup Python in workflows to fix CI"
cschwan Apr 1, 2026
fff9673
Strip out unused code from `pineappl_v0`
cschwan Apr 1, 2026
c38ec3e
Remove `pineappl_v0`'s unit tests
cschwan Apr 1, 2026
6eb58dd
Strip more code from `grid.rs`
cschwan Apr 1, 2026
d360751
Remove `Subgrid::{convolve,fill}`
cschwan Apr 1, 2026
2a45391
Remove two bits of code
cschwan Apr 1, 2026
8eb9807
Backport fix for Issue #334 to `pineappl_v0` crate
cschwan Apr 1, 2026
083521e
Deduplicate code
cschwan Apr 1, 2026
356b270
Rename test to mark it as a regression test
cschwan Apr 1, 2026
e2c4c31
Reuse `Grid::pid_basis` from `pineappl_v0`
cschwan Apr 1, 2026
76d0ba2
Remove unneeded dependencies from `pineappl_v0`
cschwan Apr 1, 2026
363cb76
Remove more `Subgrid` methods in `pineappl_v0` crate
cschwan Apr 1, 2026
7365b84
Drop compressed `Grid::read` in `pineappl_v0` crate
cschwan Apr 1, 2026
c20f6d5
Remove code from `bin.rs`
cschwan Apr 1, 2026
dd82b81
Rip out a large chunk of code from `pineappl_v0`
cschwan Apr 1, 2026
667d88b
Remove some final bits of code in `pineappl_v0`
cschwan Apr 1, 2026
7171126
Fix some clippy warnings
cschwan Apr 1, 2026
47b49db
Remove obsolete comment
cschwan Apr 1, 2026
1ef612a
Increase test coverage by testing `LagrangeSubgrid*` types
cschwan Apr 1, 2026
ae22797
Fix file name of the new test data
cschwan Apr 1, 2026
3ed3500
Increase cache number
cschwan Apr 1, 2026
5f801b0
Increase cache version to download fixed grid
cschwan Apr 1, 2026
4a8814f
Fix test output
cschwan Apr 1, 2026
923c5a6
Increase test coverage
cschwan Apr 1, 2026
4b50f64
Fix test-data link
cschwan Apr 1, 2026
4ea366d
Increase test coverage
cschwan Apr 1, 2026
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
3 changes: 2 additions & 1 deletion .github/actions/cache-test-data/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ runs:
uses: actions/cache@v4
with:
path: test-data
key: test-data-v24
key: test-data-v30
- name: Download test data if cache miss
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd maintainer
# TODO: if this script fails to download some files, the cache is saved nevertheless
./download-test-data.sh
shell: bash
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ increasing the MSRV make sure to set it everywhere to the same value:
data with `curl`. To make Github refresh the cached test data when running
the CI, increase the integer `XX` in the line `key: test-data-vXX` by one.

### Regression tests for Github Issues

If you're writing a regression test for a Github Issue, name the test
`issue_XXX`, where `XXX` is the Github Issue number.

## Git

- When you commit, make sure the commit message is written properly. This
Expand Down
74 changes: 18 additions & 56 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"pineappl_cli",
"pineappl_fastnlo",
"pineappl_py",
"pineappl_v0",
"xtask",
]
default-members = [
Expand Down
4 changes: 4 additions & 0 deletions maintainer/download-test-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ files=(
'https://data.nnpdf.science/dy_high_mass/NNPDF_DY_14TEV_BSM_AFB.pineappl.lz4'
'https://data.nnpdf.science/pineappl/test-data/ATLASWPT11-Wplus_tot.appl'
'https://data.nnpdf.science/pineappl/test-data/CMS_TTB_8TEV_2D_TTM_TRAP_TOT-opt.pineappl.lz4'
'https://data.nnpdf.science/pineappl/test-data/DYAA_0.3.0_LagrangeSubgridV1.pineappl.lz4'
'https://data.nnpdf.science/pineappl/test-data/DYAA_0.4.1_LagrangeSparseSubgridV1.pineappl.lz4'
'https://data.nnpdf.science/pineappl/test-data/DYAA_0.4.1_LagrangeSubgridV1.pineappl.lz4'
'https://data.nnpdf.science/pineappl/test-data/DYAA_0.4.1_LagrangeSubgridV2.pineappl.lz4'
'https://data.nnpdf.science/pineappl/test-data/CMS_TTB_8TEV_2D_TTM_TRAP_TOT.tar'
'https://data.nnpdf.science/pineappl/test-data/E906nlo_bin_00.pineappl.lz4'
'https://data.nnpdf.science/pineappl/test-data/E906nlo_bin_00.tar'
Expand Down
1 change: 1 addition & 0 deletions maintainer/make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ for crate in . ${crates[@]}; do
-e "s:^\(pineappl_applgrid = .*\)version = \".*\":\1version = \"=${version}\":" \
-e "s:^\(pineappl_cli = .*\)version = \".*\":\1version = \"=${version}\":" \
-e "s:^\(pineappl_fastnlo = .*\)version = \".*\":\1version = \"=${version}\":" \
-e "s:^\(pineappl_v0 = .*\)version = \".*\":\1version = \"=${version}\":" \
${crate}/Cargo.toml
git add ${crate}/Cargo.toml
done
Expand Down
3 changes: 1 addition & 2 deletions pineappl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ git-version = "0.3.5"
itertools = "0.10.1"
lz4_flex = "0.11.6"
ndarray = { features = ["serde"], version = "0.15.4" }
# TODO: opt out of default features in this crate to match line above
pineappl-v0 = { package = "pineappl", version = "0.8.2" }
pineappl_v0 = { path = "../pineappl_v0", version = "=1.3.3" }
rayon = "1.5.1"
rustc-hash = "1.1.0"
serde = { features = ["derive"], version = "1.0.130" }
Expand Down
102 changes: 19 additions & 83 deletions pineappl/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,26 @@ pub fn default_interps(flexible_scale: bool, convolutions: usize) -> Vec<Interp>
}

pub fn read_uncompressed_v0(mut reader: impl BufRead) -> Result<Grid> {
use pineappl_v0::convolutions::Convolution;
use pineappl_v0::pids::PidBasis as PidBasisV0;
use pineappl_v0::subgrid::Subgrid as _;

let grid = GridV0::read(&mut reader).map_err(|err| Error::Other(err.into()))?;
let convolutions = read_convolutions_from_metadata(&grid);
let grid = GridV0::read_uncompressed(&mut reader).map_err(|err| Error::Other(err.into()))?;
let convolutions: Vec<_> = grid
.convolutions()
.into_iter()
.map(|old_conv| match old_conv {
Convolution::UnpolPDF(pid) => Some(Conv::new(ConvType::UnpolPDF, pid)),
Convolution::PolPDF(pid) => Some(Conv::new(ConvType::PolPDF, pid)),
Convolution::UnpolFF(pid) => Some(Conv::new(ConvType::UnpolFF, pid)),
Convolution::PolFF(pid) => Some(Conv::new(ConvType::PolFF, pid)),
Convolution::None => None,
})
.collect();
let pid_basis = match grid.pid_basis() {
PidBasisV0::Pdg => PidBasis::Pdg,
PidBasisV0::Evol => PidBasis::Evol,
};

let flexible_scale_grid = grid.subgrids().iter().any(|subgrid| {
subgrid
Expand Down Expand Up @@ -128,16 +144,7 @@ pub fn read_uncompressed_v0(mut reader: impl BufRead) -> Result<Grid> {
)
})
.collect(),
grid.key_values()
.and_then(|kv| kv.get("lumi_id_types"))
// TODO: use PidBasis::from_str
.map_or(PidBasis::Pdg, |lumi_id_types| {
match lumi_id_types.as_str() {
"pdg_mc_ids" => PidBasis::Pdg,
"evol" => PidBasis::Evol,
_ => panic!("unknown PID basis '{lumi_id_types}'"),
}
}),
pid_basis,
convolutions.clone().into_iter().flatten().collect(),
default_interps(
flexible_scale_grid,
Expand Down Expand Up @@ -261,74 +268,3 @@ pub fn read_uncompressed_v0(mut reader: impl BufRead) -> Result<Grid> {

Ok(result)
}

fn read_convolutions_from_metadata(grid: &GridV0) -> Vec<Option<Conv>> {
grid.key_values().map_or_else(
// if there isn't any metadata, we assume two unpolarized proton-PDFs are used
|| vec![Some(Conv::new(ConvType::UnpolPDF, 2212)); 2],
|kv| {
// file format v0 only supports exactly two convolutions
(1..=2)
.map(|index| {
// if there are key-value pairs `convolution_particle_1` and
// `convolution_type_1` and the same with a higher index, we convert this
// metadata into `Convolution`
match (
kv.get(&format!("convolution_particle_{index}"))
.map(|s| s.parse::<i32>()),
kv.get(&format!("convolution_type_{index}"))
.map(String::as_str),
) {
(_, Some("None")) => None,
(Some(Ok(pid)), Some("UnpolPDF")) => Some(Conv::new(ConvType::UnpolPDF, pid)),
(Some(Ok(pid)), Some("PolPDF")) => Some(Conv::new(ConvType::PolPDF, pid)),
(Some(Ok(pid)), Some("UnpolFF")) => Some(Conv::new(ConvType::UnpolFF, pid)),
(Some(Ok(pid)), Some("PolFF")) => Some(Conv::new(ConvType::PolFF, pid)),
(None, None) => {
// if these key-value pairs are missing use the old metadata
match kv
.get(&format!("initial_state_{index}"))
.map(|s| s.parse::<i32>())
{
Some(Ok(pid)) => {
// Addresses: https://github.com/NNPDF/pineappl/issues/334
if grid.channels().is_empty() && pid == 2212 {
Some(Conv::new(ConvType::UnpolPDF, 2212))
} else {
let condition = !grid.channels().iter().all(|entry| {
entry.entry().iter().all(|&(a, b, _)|
match index {
1 => a,
2 => b,
_ => unreachable!()
} == pid
)
});

condition.then_some(Conv::new(ConvType::UnpolPDF, pid))
}
}
None => Some(Conv::new(ConvType::UnpolPDF, 2212)),
Some(Err(err)) => panic!(
"metadata 'initial_state_{index}' could not be parsed: {err}"
),
}
}
(None, Some(_)) => {
panic!("metadata 'convolution_type_{index}' is missing")
}
(Some(_), None) => {
panic!("metadata 'convolution_particle_{index}' is missing")
}
(Some(Ok(_)), Some(type_)) => {
panic!("metadata 'convolution_type_{index} = {type_}' is unknown")
}
(Some(Err(err)), Some(_)) => {
panic!("metadata 'convolution_particle_{index}' could not be parsed: {err}")
}
}
})
.collect()
},
)
}
Loading
Loading