Skip to content

Commit 7b2446a

Browse files
committed
address review comments
1 parent 9a62820 commit 7b2446a

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

validphys2/src/validphys/lhapdfset.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class LHAPDFSet:
7474
the resutls for all members (i.e., when using ``grid_values``).
7575
However, it is possible to add member 0 by changing the ``include_cv`` attribute to True.
7676
77-
Temporarily: it exposes all libNNPDF attributes that were exposed and used prior to
77+
Temporarily: it exposes all libNNPDF error attributes that were exposed and used prior to
7878
the introduction of this class
7979
"""
8080

@@ -96,17 +96,6 @@ def __init__(self, name, error_type, lhapdf_verbosity=None):
9696
# Set the verbosity of LHAPDF
9797
if lhapdf_verbosity is not None:
9898
lhapdf.setVerbosity(lhapdf_verbosity)
99-
# Prepare a Legacy Interface
100-
self.legacy_interface()
101-
102-
def legacy_interface(self):
103-
"""Setting some methods and attribute as per libNNPDF specs"""
104-
self.GetMembers = self.get_members
105-
self.GetSetName = lambda self: self.name
106-
107-
def get_members(self):
108-
"""Get the number of members"""
109-
return len(self.members)
11099

111100
@property
112101
def is_monte_carlo(self):
@@ -118,6 +107,10 @@ def is_t0(self):
118107
"""Check whether we are in t0 mode"""
119108
return self._error_type.t0
120109

110+
@property
111+
def n_members(self):
112+
return len(self.members)
113+
121114
@property
122115
def members(self):
123116
"""Return the members of the set, this depends on the error type:
@@ -162,7 +155,8 @@ def flavors(self):
162155
return self._flavors
163156

164157
def grid_values(self, flavors: np.ndarray, xgrid: np.ndarray, qgrid: np.ndarray):
165-
"""Reimplementation of libNNPDF grid_values
158+
"""Returns the PDF values for every member for the required
159+
flavours, points in x and pointx in q
166160
The return shape is
167161
(members, flavors, xgrid, qgrid)
168162
@@ -183,8 +177,6 @@ def grid_values(self, flavors: np.ndarray, xgrid: np.ndarray, qgrid: np.ndarray)
183177
"""
184178
# LHAPDFSet.grid_values accepts flavours not included in the the PDF
185179
# keep track of which they are to add them later as 0s
186-
# The LHAPDFSet way is that it is accepted to ask for flavours outside the ones
187-
# accepted by the PDF, they will just be made of 0s
188180
flavs, zero_idxs = [], []
189181
for idx, f in enumerate(flavors):
190182
if f in self.flavors:

validphys2/src/validphys/sumrules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def f(x, lpdf, irep, Q):
125125

126126
def _sum_rules(rules_dict, lpdf, Q):
127127
"""Compute a SumRulesGrid from the loaded PDF, at Q"""
128-
nmembers = lpdf.GetMembers()
128+
nmembers = lpdf.n_members
129129
#TODO: Write this in something fast
130130
#If nothing else, at least allocate and store the result contiguously
131131
res = np.zeros((len(rules_dict), nmembers))

0 commit comments

Comments
 (0)