pub struct PyPDF { /* private fields */ }
Expand description
Python wrapper for the neopdf::pdf::PDF
struct.
This class provides a Python-friendly interface to the core PDF
interpolation functionalities of the neopdf
Rust library.
Implementations§
Source§impl PyPDF
impl PyPDF
Sourcepub fn mkpdfs(pdf_name: &str, method: &PyLoaderMethod) -> Vec<Self>
pub fn mkpdfs(pdf_name: &str, method: &PyLoaderMethod) -> Vec<Self>
Sourcepub fn mkpdfs_lazy(pdf_name: &str) -> PyLazyPDFs
pub fn mkpdfs_lazy(pdf_name: &str) -> PyLazyPDFs
Creates an iterator that loads PDF members lazily.
This function is suitable for .neopdf.lz4
files, which support lazy loading.
It returns an iterator that yields PDF
instances on demand, which is useful
for reducing memory consumption when working with large PDF sets.
§Arguments
pdf_name
- The name of the PDF set (must end with.neopdf.lz4
).
§Returns
An iterator over Result<PDF, Box<dyn std::error::Error>>
.
Sourcepub fn subgrid_knots(
&self,
param: &PyGridParams,
subgrid_index: usize,
) -> Vec<f64>
pub fn subgrid_knots( &self, param: &PyGridParams, subgrid_index: usize, ) -> Vec<f64>
Returns the subgrid knots of a parameter for a given subgrid index.
The parameter could be the nucleon numbers A
, the strong coupling
alphas
, the momentum fraction x
, or the momentum scale Q2
.
§Panics
This panics if the parameter is not valid.
§Returns
list[float] The subgrid knots for a given parameter.
Sourcepub fn set_force_positive(&mut self, option: PyForcePositive)
pub fn set_force_positive(&mut self, option: PyForcePositive)
Clip the negative or small values for the PDF
object.
§Parameters
id : PyFrocePositive The clipping method use to handle negative or small values.
Sourcepub fn set_force_positive_members(
pdfs: Vec<PyRefMut<'_, Self>>,
option: PyForcePositive,
)
pub fn set_force_positive_members( pdfs: Vec<PyRefMut<'_, Self>>, option: PyForcePositive, )
Sourcepub fn is_force_positive(&self) -> PyForcePositive
pub fn is_force_positive(&self) -> PyForcePositive
Returns the clipping method used for a single PDF
object.
§Returns
PyForcePositive
The clipping method used for the PDF
object.
Sourcepub fn flavour_pids(&self) -> Vec<i32>
pub fn flavour_pids(&self) -> Vec<i32>
Sourcepub fn xfxq2(&self, id: i32, x: f64, q2: f64) -> f64
pub fn xfxq2(&self, id: i32, x: f64, q2: f64) -> f64
Interpolates the PDF value (xf) for a given flavor, x, and Q2.
§Parameters
id : int The flavor ID (e.g., 21 for gluon, 1 for d-quark). x : float The momentum fraction. q2 : float The energy scale squared.
§Returns
float The interpolated PDF value. Returns 0.0 if extrapolation is attempted and not allowed.
Sourcepub fn xfxq2_nd(&self, id: i32, params: Vec<f64>) -> f64
pub fn xfxq2_nd(&self, id: i32, params: Vec<f64>) -> f64
Interpolates the PDF value (xf) for a given set of parameters.
§Parameters
id : int
The flavor ID (e.g., 21 for gluon, 1 for d-quark).
params: list[float]
A list of parameters that the grids depends on. If the PDF
grid only contains x
and Q2
dependence then its value is
[x, q2]
; if it contains either the A
and alpha_s
dependence, then its value is [A, x, q2]
or [alpha_s, x, q2]
respectively; if it contains both, then [A, alpha_s, x, q2]
.
§Returns
float The interpolated PDF value. Returns 0.0 if extrapolation is attempted and not allowed.
Sourcepub fn xfxq2_cheby_batch(&self, id: i32, params: Vec<Vec<f64>>) -> Vec<f64>
pub fn xfxq2_cheby_batch(&self, id: i32, params: Vec<Vec<f64>>) -> Vec<f64>
Interpolates the PDF value (xf) for a list containg a set of parameters.
§Parameters
id : int
The flavor ID (e.g., 21 for gluon, 1 for d-quark).
params: list[list[float]]
A list containing the list of points. Each element in the list
is in turn a list containing the parameters that the grids depends
on. If the PDF grid only contains x
and Q2
dependence then its
value is [x, q2]
; if it contains either the A
and alpha_s
dependence, then its value is [A, x, q2]
or [alpha_s, x, q2]
respectively; if it contains both, then [A, alpha_s, x, q2]
.
§Returns
float The interpolated PDF value. Returns 0.0 if extrapolation is attempted and not allowed.
Sourcepub fn xfxq2s<'py>(
&self,
pids: Vec<i32>,
xs: Vec<f64>,
q2s: Vec<f64>,
py: Python<'py>,
) -> Bound<'py, PyArray2<f64>> ⓘ
pub fn xfxq2s<'py>( &self, pids: Vec<i32>, xs: Vec<f64>, q2s: Vec<f64>, py: Python<'py>, ) -> Bound<'py, PyArray2<f64>> ⓘ
Interpolates the PDF value (xf) for lists of flavors, x-values, and Q2-values.
§Parameters
id : list[int] A list of flavor IDs. xs : list[float] A list of momentum fractions. q2s : list[float] A list of energy scales squared.
§Returns
numpy.ndarray A 2D NumPy array containing the interpolated PDF values.
Sourcepub fn metadata(&self) -> PyMetaData
pub fn metadata(&self) -> PyMetaData
Returns the metadata associated with this PDF set.
Provides access to the metadata describing the PDF set, including information such as the set description, number of members, parameter ranges, and other relevant details.
§Returns
MetaData
The metadata for this PDF set as a MetaData
Python object.
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for PyPDF
impl<'py> IntoPyObject<'py> for PyPDF
Source§type Output = Bound<'py, <PyPDF as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PyPDF as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClassImpl for PyPDF
impl PyClassImpl for PyPDF
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§type ThreadChecker = SendablePyClass<PyPDF>
type ThreadChecker = SendablePyClass<PyPDF>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<PyPDF> for PyClassImplCollector<PyPDF>
impl PyClassNewTextSignature<PyPDF> for PyClassImplCollector<PyPDF>
fn new_text_signature(self) -> Option<&'static str>
Source§impl PyMethods<PyPDF> for PyClassImplCollector<PyPDF>
impl PyMethods<PyPDF> for PyClassImplCollector<PyPDF>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PyPDF
impl PyTypeInfo for PyPDF
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
impl DerefToPyAny for PyPDF
Auto Trait Implementations§
impl Freeze for PyPDF
impl !RefUnwindSafe for PyPDF
impl Send for PyPDF
impl Sync for PyPDF
impl Unpin for PyPDF
impl !UnwindSafe for PyPDF
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.