@@ -206,14 +206,21 @@ def unknown_sum_rules(pdf: PDF, Q: numbers.Real):
206206 return _combine_limits (_sum_rules (UNKNOWN_SUM_RULES , lpdf , Q ))
207207
208208
209- def _simple_description (d ):
209+ def _simple_description (data , pdf ):
210+ """Return a table with simple descriptive statistics over the members of the PDF.
211+ The statistics used depend on the type of PDF (MC or Hessian)."""
210212 res = {}
211- for k , arr in d .items ():
212- res [k ] = d = {}
213- d ["mean" ] = np .mean (arr )
214- d ["std" ] = np .std (arr )
215- d ["min" ] = np .min (arr )
216- d ["max" ] = np .max (arr )
213+ stats_class = pdf .stats_class
214+ for k , arr in data .items ():
215+ res [k ] = stats_dict = {}
216+ # Each entry in `data` is expected to be a vector with shape
217+ # (central_member + error_members,), hence we reshape to (-1, 1) before
218+ # passing to the stats class.
219+ stats = stats_class (arr .reshape (- 1 ,1 ))
220+ stats_dict ["mean" ] = stats .central_value ().item ()
221+ stats_dict ["std" ] = stats .std_error ().item ()
222+ stats_dict ["min" ] = np .min (arr )
223+ stats_dict ["max" ] = np .max (arr )
217224
218225 return pd .DataFrame (res ).T
219226
@@ -233,10 +240,10 @@ def _err_mean_table(d, polarized=False):
233240
234241
235242@table
236- def sum_rules_table (sum_rules ):
243+ def sum_rules_table (sum_rules , pdf ):
237244 """Return a table with the descriptive statistics of the sum rules,
238245 over members of the PDF."""
239- return _simple_description (sum_rules )
246+ return _simple_description (sum_rules , pdf )
240247
241248
242249@table
0 commit comments