Skip to content

Commit

Permalink
Merge pull request #2129 from NNPDF/update-pineappl
Browse files Browse the repository at this point in the history
Bump pineappl version
  • Loading branch information
Radonirinaunimi authored Jul 23, 2024
2 parents 737382f + 5061f25 commit 840ac3e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ requirements:
- requests
- prompt_toolkit
- validobj
- pineappl >=0.7.3
- pineappl >=0.8.2
- eko >=0.14.2
- fiatlux
- sphinx >=5.0.2,<6 # documentation. Needs pinning temporarily due to markdown
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ vp-deltachi2 = "validphys.scripts.vp_deltachi2:main"
# Generic dependencies (i.e., validphys)
python = "^3.9"
matplotlib = ">=3.3.0,<3.8"
pineappl = "^0.7.0"
pineappl = "^0.8.2"
pandas = "*"
numpy = "*"
validobj = "*"
Expand Down
2 changes: 1 addition & 1 deletion validphys2/examples/API_extension_Pineappl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
" bin_norm = self._grid.bin_normalizations().reshape(-1, 1)\n",
" \n",
" for i, member in enumerate(pdf.members):\n",
" tmp = self._grid.convolute_with_one(2212, member.xfxQ2, member.alphasQ2, xi=all_scales).reshape(-1, len(all_scales))\n",
" tmp = self._grid.convolve_with_one(2212, member.xfxQ2, member.alphasQ2, xi=all_scales).reshape(-1, len(all_scales))\n",
"\n",
" if self._apply_bin:\n",
" tmp *= bin_norm\n",
Expand Down
2 changes: 1 addition & 1 deletion validphys2/src/validphys/photon/structure_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, path_to_fktable, pdfs):

self.q2_max = max(q2)

predictions = self.fktable.convolute_with_one(2212, pdfs.xfxQ2)
predictions = self.fktable.convolve_with_one(2212, pdfs.xfxQ2)

grid2D = predictions.reshape(len(x), len(q2))
self.interpolator = RectBivariateSpline(x, q2, grid2D)
Expand Down
13 changes: 10 additions & 3 deletions validphys2/src/validphys/pineparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,16 @@ def pineappl_reader(fkspec):
is_polarized = pine_rep.key_values().get("polarized") == "True"

# Is it hadronic? (at the moment only hadronic and DIS are considered)
hadronic = pine_rep.key_values()["initial_state_1"] == pine_rep.key_values()["initial_state_2"]
try:
parton1 = pine_rep.key_values()["convolution_particle_1"]
parton2 = pine_rep.key_values()["convolution_particle_2"]
except KeyError:
parton1 = pine_rep.key_values()["initial_state_1"]
parton2 = pine_rep.key_values()["initial_state_2"]
hadronic = parton1 == parton2

# Sanity check (in case at some point we start fitting things that are not protons)
if hadronic and pine_rep.key_values()["initial_state_1"] != "2212":
if hadronic and parton1 != "2212":
raise ValueError(
"pineappl_reader is not prepared to read a hadronic fktable with no protons!"
)
Expand Down Expand Up @@ -223,7 +230,7 @@ def pineappl_reader(fkspec):
# Create the multi-index for the dataframe
# for optimized pineappls different grids can potentially have different indices
# so they need to be indexed separately and then concatenated only at the end
lumi_columns = _pinelumi_to_columns(p.lumi(), hadronic)
lumi_columns = _pinelumi_to_columns(p.channels(), hadronic)
lf = len(lumi_columns)
data_idx = np.arange(ndata, ndata + n)
if hadronic:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def bin_left(self, i):
else:
return 0

def convolute_with_one(self, pdgid, xfxQ2):
def convolve_with_one(self, pdgid, xfxQ2):
return np.zeros((10, 10))


Expand Down Expand Up @@ -99,7 +99,7 @@ def test_interpolation_grid():
fktable = pineappl.fk_table.FkTable.read(path_to_fktable)
x = np.unique(fktable.bin_left(1))
q2 = np.unique(fktable.bin_left(0))
predictions = fktable.convolute_with_one(2212, pdfs.members[replica].xfxQ2)
predictions = fktable.convolve_with_one(2212, pdfs.members[replica].xfxQ2)
grid2D = predictions.reshape(len(x), len(q2))

struct_func = sf.InterpStructureFunction(path_to_fktable, pdfs.members[replica])
Expand Down

0 comments on commit 840ac3e

Please sign in to comment.