Skip to content

Commit fa7913a

Browse files
committed
use the correct call to xfxq
1 parent 354bfd6 commit fa7913a

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

validphys2/src/validphys/lhapdfset.py

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -170,35 +170,16 @@ def grid_values(self, flavors: np.ndarray, xgrid: np.ndarray, qgrid: np.ndarray)
170170
>>> flavs[4] = 21
171171
>>> results = pdf.grid_values(flavs, xgrid, qgrid)
172172
"""
173-
# LHAPDFSet.grid_values accepts flavours not included in the the PDF
174-
# keep track of which they are to add them later as 0s
175-
flavs, zero_idxs = [], []
176-
for idx, f in enumerate(flavors):
177-
if f in self.flavors:
178-
flavs.append(f)
179-
else:
180-
zero_idxs.append(idx)
181-
182173
# Grid values loop
183-
xvals = []
184-
for x in xgrid:
185-
qvals = []
186-
for q in qgrid:
187-
mres = []
188-
for member in self.members:
189-
all_flavs_dict = member.xfxQ(x, q)
190-
mres.append([all_flavs_dict[i] for i in flavs])
191-
qvals.append(mres)
192-
xvals.append(qvals)
193-
ret = np.array(xvals)
194-
195-
# Add 0s for flavours that were not in the PDF but the user asked for
196-
for idx in zero_idxs:
197-
# Do it one by one to keep the index in the right places
198-
ret = np.insert(ret, idx, 0.0, -1)
199-
200-
# Finally return in the preferred shape
201-
return np.transpose(ret, (2, 3, 0, 1))
174+
ret = np.array(
175+
[
176+
[[member.xfxQ(flavors, x, q) for x in xgrid] for q in qgrid]
177+
for member in self.members
178+
]
179+
)
180+
181+
# Finally return in the documented shape
182+
return np.transpose(ret, (0, 3, 2, 1))
202183

203184

204185
# libNNPDF compatibility

0 commit comments

Comments
 (0)