|
2 | 2 |
|
3 | 3 | use super::convolutions::PyConv; |
4 | 4 | use super::grid::PyGrid; |
| 5 | +use super::pids::PyPidBasis; |
5 | 6 | use numpy::{IntoPyArray, PyArray1, PyArrayDyn}; |
6 | 7 | use pineappl::convolutions::ConvolutionCache; |
7 | 8 | use pineappl::fk_table::{FkAssumptions, FkTable}; |
8 | 9 | use pineappl::grid::Grid; |
| 10 | +use pineappl::pids::PidBasis; |
9 | 11 | use pyo3::prelude::*; |
10 | 12 | use std::collections::BTreeMap; |
11 | 13 | use std::fs::File; |
@@ -206,6 +208,30 @@ impl PyFkTable { |
206 | 208 | self.fk_table.x_grid().into_pyarray(py) |
207 | 209 | } |
208 | 210 |
|
| 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 | + |
209 | 235 | /// Write to file. |
210 | 236 | /// |
211 | 237 | /// # Panics |
|
0 commit comments