Skip to content

Commit

Permalink
Add Reference struct
Browse files Browse the repository at this point in the history
  • Loading branch information
t7phy committed Jan 24, 2025
1 parent 914eca1 commit 029f3a1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pineappl/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use std::io::{self, BufRead, BufReader, BufWriter, Read, Write};
use std::ops::Range;
use std::{iter, mem};
use thiserror::Error;
use super::reference::Reference;

const BIN_AXIS: Axis = Axis(1);

Expand Down Expand Up @@ -133,6 +134,7 @@ pub struct Grid {
scales: Scales,
metadata: BTreeMap<String, String>,
more_members: MoreMembers,
reference: Reference,
}

impl Grid {
Expand Down Expand Up @@ -193,6 +195,7 @@ impl Grid {
scales,
metadata: default_metadata(),
more_members: MoreMembers::V4(Mmv4),
reference: Reference::default(),
}
}

Expand Down Expand Up @@ -1384,6 +1387,8 @@ impl Grid {
},
metadata: self.metadata.clone(),
more_members: self.more_members.clone(),
// TODO: transform the reference result to match the FKTable structure
reference: self.reference.clone(),
};

if let Some(lhs) = &mut lhs {
Expand Down
1 change: 1 addition & 0 deletions pineappl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ pub mod interp_subgrid;
pub mod interpolation;
pub mod packed_array;
pub mod pids;
pub mod reference;
pub mod subgrid;
32 changes: 32 additions & 0 deletions pineappl/src/reference.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//! TODO
use serde::{Deserialize, Serialize};

#[derive(Clone, Deserialize, Serialize)]
enum RefRes{
ByBin(f64),
ByBinOrder(Vec<f64>),
ByBinChannel(Vec<f64>),
ByBinOrderChannel(Vec<Vec<f64>>),
}

#[derive(Clone, Deserialize, Serialize)]
enum RefRelUnc{
ByBin(f64),
ByBinOrder(Vec<f64>, CombOp),
ByBinChannel(Vec<f64>, CombOp),
ByBinOrderChannel(Vec<Vec<f64>>, CombOp),
}

#[derive(Clone, Deserialize, Serialize)]
enum CombOp{
Sum,
Quadrature,
}

/// TODO
#[derive(Clone, Default, Deserialize, Serialize)]
pub struct Reference{
ref_res_unc: Vec<(RefRes, RefRelUnc)>,
ref_conv_fun: Vec<String>,
}

0 comments on commit 029f3a1

Please sign in to comment.