Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Return zero if PID is not in the Grid (https://github.com/QCDLab/neopdf/pull/78).
- Changed the passing of the name of the PDF as a positional argument in the
CLI (https://github.com/QCDLab/neopdf/pull/78).
- Move the computation of the logarithmic transformation out of the interpolation.
- Modified `GridArray::find_subgrid` to accept more combinations of variables
so that the construction of subgrids is generic.
Expand Down
20 changes: 10 additions & 10 deletions docs/cli-tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ feature.
To read the metadata for a given PDF set:

```bash
neopdf read metadata --pdf-name NNPDF40_nnlo_as_01180
neopdf read metadata NNPDF40_nnlo_as_01180
```

- `--pdf-name`: Name of the PDF set (can be a `NeoPDF` or `LHAPDF` set).
Expand Down Expand Up @@ -54,7 +54,7 @@ Interpolator Type: LogBicubic
To get the number of subgrids a PDF contains:

```bash
neopdf read num_subgrids --pdf-name NNPDF40_nnlo_as_01180
neopdf read num_subgrids NNPDF40_nnlo_as_01180
```

- `--pdf-name`: Name of the PDF set.
Expand All @@ -64,7 +64,7 @@ neopdf read num_subgrids --pdf-name NNPDF40_nnlo_as_01180
To get the knot values for a given subgrid:

```bash
neopdf read subgrid-info --pdf-name NNPDF40_nnlo_as_01180 --member=0 --subgrid-index=1
neopdf read subgrid-info NNPDF40_nnlo_as_01180 --member=0 --subgrid-index=1
```

- `--pdf-name`: Name of the PDF set.
Expand Down Expand Up @@ -109,7 +109,7 @@ neopdf write metadata --path NNPDF40_nnlo_as_01180.neopdf.lz4 --key SetType --va
To compute the interpolated function $xf(x, Q^2)$ for a given PDF set, member, and flavor:

```bash
neopdf compute xfx_q2 --pdf-name NNPDF40_nnlo_as_01180 --member=0 --pid=21 1e-3 10.0
neopdf compute xfx_q2 NNPDF40_nnlo_as_01180 --member=0 --pid=21 1e-3 10.0
```

- `--pdf-name`: Name of the PDF set (can be a `NeoPDF` or `LHAPDF` set).
Expand All @@ -131,7 +131,7 @@ neopdf compute xfx_q2 --pdf-name NNPDF40_nnlo_as_01180 --member=0 --pid=21 1e-3
To compute the strong coupling constant $\alpha_s(Q^2)$ for a given PDF set and member:

```bash
neopdf compute alphas_q2 --pdf-name NNPDF40_nnlo_as_01180 --member=0 --q2=10
neopdf compute alphas_q2 NNPDF40_nnlo_as_01180 --member=0 --q2=10
```

- `--q2`: The $Q^2$ value at which to evaluate $\alpha_s$.
Expand All @@ -145,7 +145,7 @@ neopdf compute alphas_q2 --pdf-name NNPDF40_nnlo_as_01180 --member=0 --q2=10
To convert a standard LHAPDF set into the new, compressed `NeoPDF` format:

```bash
neopdf write convert --pdf-name NNPDF40_nnlo_as_01180 --output NNPDF40_nnlo_as_01180.neopdf.lz4
neopdf write convert NNPDF40_nnlo_as_01180 --output NNPDF40_nnlo_as_01180.neopdf.lz4
```

- `--output`: The output file name for the `NeoPDF` grid (should end with `.neopdf.lz4`).
Expand Down Expand Up @@ -197,7 +197,7 @@ This will generate a `nNNPDF30_nlo_as_0118.neopdf.lz4` PDF grid that also contai
dependence. One can now check the value of $xf(A, x, Q^2)$ for the Iron $^{56}_{26}\mathrm{Fe}$:

```bash
neopdf compute xfx_q2 --pdf-name nNNPDF30_nlo_as_0118.neopdf.lz4 --member=0 --pid=21 56 1e-3 10.0
neopdf compute xfx_q2 nNNPDF30_nlo_as_0118.neopdf.lz4 --member=0 --pid=21 56 1e-3 10.0
```

### Combine multiple $\alpha_s$ LHAPDF sets
Expand Down Expand Up @@ -225,7 +225,7 @@ Note that the names of the PDF sets can be passed via the command line using the
`--pdf--name`. We can then interpolate the $\alpha_s = 0.1180$ value:

```bash
neopdf compute xfx_q2 --pdf-name NNPDF40_nnlo.neopdf.lz4 --member=0 --pid=21 0.1180 1e-3 10.0
neopdf compute xfx_q2 NNPDF40_nnlo.neopdf.lz4 --member=0 --pid=21 0.1180 1e-3 10.0
```

!!! danger "Warning"
Expand Down Expand Up @@ -257,15 +257,15 @@ multiple subgrids (as we have seen before using the `subgrid-info` command), it
first how many subgrids a given set member contains.

```bash
> neopdf read num_subgrids --pdf-name NNPDF40_nnlo_as_01180.neopdf.lz4
> neopdf read num_subgrids NNPDF40_nnlo_as_01180.neopdf.lz4

2
```

We can look at the contents of the first subgrid for the **gluon** PDF:

```bash
> neopdf read subgrid --pdf-name NNPDF40_nnlo_as_01180.neopdf.lz4 --member=0 --subgrid-index=0 --pid=21
> neopdf read subgrid NNPDF40_nnlo_as_01180.neopdf.lz4 --member=0 --subgrid-index=0 --pid=21

[x | Q2] 2.72250e0 3.19494e0 3.77488e0 4.49175e0 5.38430e0 6.50400e0 7.91974e0
1.00000e-9 1.48441e-1 -1.47266e0 -3.42816e0 -5.57841e0 -7.73893e0 -9.65268e0 -1.10375e1
Expand Down
16 changes: 8 additions & 8 deletions neopdf/src/gridpdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ impl GridPDF {
Error::SubgridNotFound { x, q2 }
})?;

let pid_idx = self
.knot_array
.pid_index(flavor_id)
.ok_or_else(|| Error::InterpolationError(format!("Invalid flavor ID: {flavor_id}")))?;
let pid_idx = match self.knot_array.pid_index(flavor_id) {
Some(idx) => idx,
None => return Ok(0.0),
};

let use_log = matches!(
self.info.interpolator_type,
Expand Down Expand Up @@ -353,10 +353,10 @@ impl GridPDF {
return Ok(Vec::new());
}

let pid_idx = self
.knot_array
.pid_index(flavor_id)
.ok_or_else(|| Error::InterpolationError(format!("Invalid flavor ID: {flavor_id}")))?;
let pid_idx = match self.knot_array.pid_index(flavor_id) {
Some(idx) => idx,
None => return Ok(vec![0.0; points.len()]),
};

if !matches!(self.info.interpolator_type, InterpolatorType::LogChebyshev) {
return Err(Error::InterpolationError(
Expand Down
Loading