27 return logging.getLogger(__name__)
31 formatter = TolerateMissingKeyFormatter()
35 """Python module to refine a peeled dictionary"""
38 """Constructor of the Refiner instance"""
42 def __get__(self, harvesting_module, cls=None):
43 """Getter of the Refiner instance"""
44 if harvesting_module
is None:
51 def bound_call(*args, **kwds):
52 return refine(harvesting_module, *args, **kwds)
55 def __call__(self, harvesting_module, crops=None, *args, **kwds):
56 """implementation of the function-call of the Refiner instance
58 r(harvester) # decoration
59 r(harvester, crops, args, keywords) # refinement
63 harvesting_module.refiners.append(self)
64 return harvesting_module
67 return self.
refinerefine(harvesting_module, crops, *args, **kwds)
69 def refine(self, harvesting_module, *args, **kwds):
70 """Apply the instance's refiner function"""
75 """Refiner for figures of merit"""
77 default_name =
"{module.id}_figures_of_merit{groupby_key}"
79 default_title =
"Figures of merit in {module.title}"
81 default_contact =
"{module.contact}"
83 default_description =
"Figures of merit are the {aggregation.__name__} of {keys}"
85 default_check =
"Check for reasonable values"
87 default_key =
"{aggregation.__name__}_{part_name}"
95 default_aggregation = mean
106 """Constructor for this refiner"""
108 super(SaveFiguresOfMeritRefiner, self).
__init__()
131 groupby_part_name=None,
134 """Process the figures of merit"""
144 replacement_dict = dict(
146 module=harvesting_module,
147 aggregation=aggregation,
148 groupby_key=
'_' + groupby_part_name + groupby_value
if groupby_part_name
else "",
149 groupby=groupby_part_name,
150 groupby_value=groupby_value,
153 name = formatter.format(name, **replacement_dict)
154 title = formatter.format(title, **replacement_dict)
155 contact = formatter.format(contact, **replacement_dict)
161 for part_name, parts
in iter_items_sorted_for_key(crops):
163 key = formatter.format(key, part_name=part_name, **replacement_dict)
166 keys = list(figures_of_merit.keys())
168 description = formatter.format(description, keys=keys, **replacement_dict)
169 check = formatter.format(check, keys=keys, **replacement_dict)
171 figures_of_merit.description = description
172 figures_of_merit.check = check
175 figures_of_merit.write(tdirectory)
177 print(figures_of_merit)
181 """Refiner for histograms"""
183 default_name =
"{module.id}_{part_name}_histogram{groupby_key}{stackby_key}"
185 default_title =
"Histogram of {part_name}{groupby_key}{stackby_key} from {module.title}"
187 default_contact =
"{module.contact}"
189 default_description =
"This is a histogram of {part_name}{groupby_key}{stackby_key}."
191 default_check =
"Check if the distribution is reasonable"
202 outlier_z_score=None,
203 allow_discrete=False,
207 """Constructor for this refiner"""
209 super(SaveHistogramsRefiner, self).
__init__()
246 groupby_part_name=None,
249 """Process the histogram"""
253 stackby_parts = crops[stackby]
257 replacement_dict = dict(
259 module=harvesting_module,
260 stackby_key=
' stacked by ' + stackby
if stackby
else "",
261 groupby_key=
' in group ' + groupby_part_name + groupby_value
if groupby_part_name
else "",
265 contact = formatter.format(contact, **replacement_dict)
267 for part_name, parts
in iter_items_sorted_for_key(crops):
273 name = formatter.format(name, part_name=part_name, **replacement_dict)
274 title = formatter.format(title, part_name=part_name, **replacement_dict)
275 description = formatter.format(description, part_name=part_name, **replacement_dict)
276 check = formatter.format(check, part_name=part_name, **replacement_dict)
279 histogram.hist(parts,
285 stackby=stackby_parts)
287 histogram.title = title
288 histogram.contact = contact
289 histogram.description = description
290 histogram.check = check
292 histogram.xlabel = compose_axis_label(part_name)
300 fit_method_name =
'fit_' + str(self.
fitfit)
302 fit_method = getattr(histogram, fit_method_name)
303 except AttributeError:
304 histogram.fit(str(self.
fitfit), **kwds)
309 histogram.write(tdirectory)
313 """Refiner for profile histograms and 2D scatterplots"""
315 plot_kind =
"profile"
332 outlier_z_score=None,
335 skip_single_valued=False,
336 allow_discrete=False):
337 """Constructor for this refiner"""
390 groupby_part_name=None,
393 """Process the profile histogram / scatterplot"""
397 stackby_parts = crops[stackby]
401 replacement_dict = dict(
403 module=harvesting_module,
404 stackby_key=
' stacked by ' + stackby
if stackby
else "",
405 groupby_key=
' in group ' + groupby_part_name + groupby_value
if groupby_part_name
else "",
408 contact = self.
contactcontact
or self.default_contact
409 contact = formatter.format(contact, **replacement_dict)
411 y_crops = select_crop_parts(crops, select=self.
yy)
412 x_crops = select_crop_parts(crops, select=self.
xx, exclude=self.
yy)
414 for y_part_name, y_parts
in iter_items_sorted_for_key(y_crops):
415 for x_part_name, x_parts
in iter_items_sorted_for_key(x_crops):
418 get_logger().info(
'Skipping "%s" by "%s" profile because x has only a single value "%s"',
425 get_logger().info(
'Skipping "%s" by "%s" profile because y has only a single value "%s"',
431 name = self.
namename
or self.default_name
432 title = self.
titletitle
or self.default_title
433 description = self.
descriptiondescription
or self.default_description
434 check = self.
checkcheck
or self.default_check
436 name = formatter.format(name,
437 x_part_name=x_part_name,
438 y_part_name=y_part_name,
441 title = formatter.format(title,
442 x_part_name=x_part_name,
443 y_part_name=y_part_name,
446 description = formatter.format(description,
447 x_part_name=x_part_name,
448 y_part_name=y_part_name,
451 check = formatter.format(check,
452 x_part_name=x_part_name,
453 y_part_name=y_part_name,
459 if plot_kind ==
"profile":
460 profile_plot.profile(x_parts,
466 y_log=self.
y_logy_log,
469 stackby=stackby_parts)
477 fit_method_name =
'fit_' + str(self.
fitfit)
479 fit_method = getattr(profile_plot, fit_method_name)
480 except BaseException:
481 profile_plot.fit(str(self.
fitfit), **kwds)
485 elif plot_kind ==
"scatter":
486 profile_plot.scatter(x_parts,
491 stackby=stackby_parts)
493 profile_plot.title = title
494 profile_plot.contact = contact
495 profile_plot.description = description
496 profile_plot.check = check
498 profile_plot.xlabel = compose_axis_label(x_part_name)
499 profile_plot.ylabel = compose_axis_label(y_part_name, self.
y_unity_unit)
502 profile_plot.write(tdirectory)
506 """check if a list has at least two unique values"""
516 """Refiner for profile histograms"""
518 default_name =
"{module.id}_{y_part_name}_by_{x_part_name}_profile{groupby_key}{stackby_key}"
520 default_title =
"Profile of {y_part_name} by {x_part_name} from {module.title}"
522 default_contact =
"{module.contact}"
524 default_description =
"This is a profile of {y_part_name} over {x_part_name}."
526 default_check =
"Check if the trend line is reasonable."
529 plot_kind =
"profile"
533 """Refiner for 2D scatterplots"""
535 default_name =
"{module.id}_{y_part_name}_by_{x_part_name}_scatter{groupby_key}{stackby_key}"
537 default_title =
"Scatter of {y_part_name} by {x_part_name} from {module.title}"
539 default_contact =
"{module.contact}"
541 default_description =
"This is a scatter of {y_part_name} over {x_part_name}."
543 default_check =
"Check if the distributions is reasonable."
546 plot_kind =
"scatter"
550 """Refiner for truth-classification analyses"""
553 default_contact =
"{module.contact}"
556 default_truth_name =
"{part_name}_truth"
558 default_estimate_name =
"{part_name}_estimate"
569 outlier_z_score=None,
570 allow_discrete=False,
572 """Constructor for this refiner"""
603 groupby_part_name=None,
606 """Process the truth-classification analysis"""
608 replacement_dict = dict(
610 module=harvesting_module,
611 groupby_key=
'_' + groupby_part_name + groupby_value
if groupby_part_name
else "",
612 groupby=groupby_part_name,
613 groupby_value=groupby_value,
617 contact = formatter.format(contact, **replacement_dict)
624 truth_name = formatter.format(truth_name, part_name=self.
part_namepart_name)
625 truths = crops[truth_name]
632 if isinstance(estimate_name, str):
633 estimate_names = [estimate_name, ]
635 estimate_names = estimate_name
637 for estimate_name
in estimate_names:
638 estimate_name = formatter.format(estimate_name, part_name=self.
part_namepart_name)
639 estimates = crops[estimate_name]
651 classification_analysis.analyse(estimates, truths)
654 classification_analysis.write(tdirectory)
658 """Refiner for pull analyses"""
661 default_name =
"{module.id}_{quantity_name}"
663 default_contact =
"{module.contact}"
665 default_title_postfix =
" from {module.title}"
668 default_truth_name =
"{part_name}_truth"
670 default_estimate_name =
"{part_name}_estimate"
672 default_variance_name =
"{part_name}_variance"
686 outlier_z_score=None,
689 """Constructor for this refiner"""
690 if aux_names
is None:
701 if part_names
is not None:
704 if part_name
is not None:
733 groupby_part_name=None,
736 """Process the pull analysis"""
738 replacement_dict = dict(
740 module=harvesting_module,
742 groupby_key=
'_' + groupby_part_name + groupby_value
if groupby_part_name
else "",
743 groupby=groupby_part_name,
744 groupby_value=groupby_value,
748 contact = formatter.format(contact, **replacement_dict)
753 auxiliaries = select_crop_parts(crops, self.
aux_namesaux_names)
758 name = formatter.format(name, part_name=part_name, **replacement_dict)
759 plot_name = name +
"_{subplot_name}"
762 if title_postfix
is None:
765 title_postfix = formatter.format(title_postfix, part_name=part_name, **replacement_dict)
766 plot_title =
"{subplot_title} of {quantity_name}" + title_postfix
783 truth_name = formatter.format(truth_name, part_name=part_name)
784 estimate_name = formatter.format(estimate_name, part_name=part_name)
785 variance_name = formatter.format(variance_name, part_name=part_name)
787 truths = crops[truth_name]
788 estimates = crops[estimate_name]
790 variances = crops[variance_name]
803 plot_title=plot_title)
805 pull_analysis.analyse(truths,
808 auxiliaries=auxiliaries,
809 which_plots=which_plots)
811 pull_analysis.contact = contact
814 pull_analysis.write(tdirectory)
818 """Refiner for ROOT TTrees"""
821 default_name =
"{module.id}_tree"
823 default_title =
"Tree of {module.id}"
828 """Constructor for this refiner"""
829 super(SaveTreeRefiner, self).
__init__()
840 groupby_part_name=None,
843 """Process the TTree"""
845 replacement_dict = dict(
847 module=harvesting_module,
848 groupby_key=
'_' + groupby_part_name + groupby_value
if groupby_part_name
else "",
849 groupby=groupby_part_name,
850 groupby_value=groupby_value,
853 with root_cd(tdirectory):
857 name = formatter.format(name, **replacement_dict)
858 title = formatter.format(title, **replacement_dict)
860 output_ttree = ROOT.TTree(root_save_name(name), title)
861 for part_name, parts
in iter_items_sorted_for_key(crops):
862 self.
add_branchadd_branch(output_ttree, part_name, parts)
864 output_ttree.FlushBaskets()
868 """Add a TBranch to the TTree"""
869 input_value = np.zeros(1, dtype=float)
871 branch_type_spec =
'%s/D' % part_name
872 tbranch = output_ttree.Branch(part_name, input_value, branch_type_spec)
874 if output_ttree.GetNbranches() == 1:
879 input_value[0] = value
884 input_value[0] = value
887 output_ttree.GetEntry(0)
888 output_ttree.ResetBranchAddress(tbranch)
889 also_subbranches =
True
890 output_ttree.DropBranchFromCache(tbranch, also_subbranches)
894 """Refiner for filters"""
896 def __init__(self, wrapped_refiner, filter=None, on=None):
897 """Constructor for this refiner"""
906 self.
filterfilter = filter
911 def refine(self, harvesting_module, crops, *args, **kwds):
912 """Process this filter"""
913 filtered_crops = filter_crops(crops, self.
filterfilter, part_name=self.
onon)
914 self.
wrapped_refinerwrapped_refiner(harvesting_module, filtered_crops, *args, **kwds)
918 """Refiner for selection"""
920 def __init__(self, wrapped_refiner, select=None, exclude=None):
921 """Constructor for this refiner"""
933 def refine(self, harvesting_module, crops, *args, **kwds):
934 """Process this selection"""
935 selected_crops = select_crop_parts(crops, select=self.
selectselect, exclude=self.
excludeexclude)
936 self.
wrapped_refinerwrapped_refiner(harvesting_module, selected_crops, *args, **kwds)
940 """Refiner for grouping"""
943 default_exclude_by =
True
949 """Constructor for this refiner"""
962 groupby_part_name=None,
966 """Process this grouping"""
971 if isinstance(by, str)
or by
is None:
976 for groupby_spec
in by:
977 if groupby_spec
is None:
982 groupby_part_name=
None,
988 elif isinstance(groupby_spec, str):
989 part_name = groupby_spec
990 groupby_parts = crops[part_name]
991 unique_values, index_of_values = np.unique(groupby_parts, return_inverse=
True)
992 groupby_values = [
" = {value}]".format(value=value)
for value
in unique_values]
994 elif isinstance(groupby_spec, tuple):
995 part_name = groupby_spec[0]
996 cuts = groupby_spec[1]
998 groupby_parts = crops[part_name]
1001 digitization_cuts = list(np.sort(cuts))
1002 if digitization_cuts[-1] != np.inf:
1003 digitization_cuts.append(np.inf)
1004 index_of_values = np.digitize(groupby_parts, digitization_cuts, right=
True)
1006 groupby_values = [
"below {upper_bound}".format(upper_bound=digitization_cuts[0])]
1007 bin_bounds = list(zip(digitization_cuts[0:], digitization_cuts[1:]))
1008 for lower_bound, upper_bound
in bin_bounds:
1009 if lower_bound == upper_bound:
1011 groupby_values.append(
"= {lower_bound}".format(lower_bound=lower_bound))
1012 elif upper_bound == np.inf:
1013 groupby_values.append(
"above {lower_bound}".format(lower_bound=lower_bound))
1015 groupby_values.append(
"between {lower_bound} and {upper_bound}".format(lower_bound=lower_bound,
1016 upper_bound=upper_bound))
1017 groupby_values.append(
"is nan")
1018 assert len(groupby_values) == len(digitization_cuts) + 1
1021 raise ValueError(
"Unknown groupby specification %s" % groupby_spec)
1024 selected_crops = select_crop_parts(crops, exclude=part_name
if self.
exclude_byexclude_by
else None)
1025 for index_of_value, groupby_value
in enumerate(groupby_values):
1026 indices_for_value = index_of_values == index_of_value
1027 if not np.any(indices_for_value):
1030 filtered_crops = filter_crops(selected_crops, indices_for_value)
1034 groupby_part_name=part_name,
1035 groupby_value=groupby_value,
1041 """Refiner for change-directory"""
1044 default_folder_name =
""
1046 default_groupby_addition =
"_groupby_{groupby}_{groupby_value}"
1051 groupby_addition=None):
1052 """Constructor for this refiner"""
1065 groupby_part_name=None,
1069 """Process the change-directory"""
1072 if folder_name
is None:
1073 if groupby_value
is not None:
1074 folder_name =
"{groupby_addition}"
1080 if groupby_addition
is None:
1083 if groupby_part_name
is None and groupby_value
is None:
1084 groupby_addition =
""
1086 groupby_addition = formatter.format(groupby_addition,
1087 groupby=groupby_part_name,
1088 groupby_value=groupby_value)
1090 folder_name = formatter.format(folder_name,
1091 groupby_addition=groupby_addition,
1092 groupby=groupby_part_name,
1093 groupby_value=groupby_value)
1095 folder_name =
'/'.join(root_save_name(name)
for name
in folder_name.split(
'/'))
1097 with root_cd(tdirectory):
1098 with root_cd(folder_name)
as tdirectory:
1101 tdirectory=tdirectory,
1102 groupby_part_name=groupby_part_name,
1103 groupby_value=groupby_value,
1109 """Refiner for expert-level categorization"""
1111 def __init__(self, wrapped_refiner, above_expert_level=None, below_expert_level=None):
1112 """Constructor for this refiner"""
1121 def refine(self, harvesting_module, crops, *args, **kwds):
1122 """Process the expert-level categorization"""
1128 if above_expert_level
is not None:
1129 proceed = proceed
and harvesting_module.expert_level > above_expert_level
1131 if below_expert_level
is not None:
1132 proceed = proceed
and harvesting_module.expert_level < below_expert_level
1135 self.
wrapped_refinerwrapped_refiner(harvesting_module, crops, *args, **kwds)
1139 def groupby(refiner=None, **kwds):
1140 def group_decorator(wrapped_refiner):
1143 return group_decorator
1145 return group_decorator(refiner)
1148 def select(refiner=None, **kwds):
1149 def select_decorator(wrapped_refiner):
1152 return select_decorator
1154 return select_decorator(refiner)
1157 def filter(refiner=None, **kwds):
1158 def filter_decorator(wrapped_refiner):
1161 return filter_decorator
1163 return filter_decorator(refiner)
1166 def cd(refiner=None, **kwds):
1167 def cd_decorator(wrapped_refiner):
1168 return CdRefiner(wrapped_refiner, **kwds)
1172 return cd_decorator(refiner)
1175 def context(refiner=None,
1176 above_expert_level=None, below_expert_level=None,
1177 folder_name=None, folder_groupby_addition=None,
1178 filter=None, filter_on=None,
1179 groupby=None, exclude_groupby=None,
1180 select=None, exclude=None):
1182 def context_decorator(wrapped_refiner):
1184 if exclude
is not None or select
is not None:
1186 select=select, exclude=exclude)
1188 if folder_name
is not None or groupby
is not None or folder_groupby_addition
is not None:
1189 wrapped_refiner =
CdRefiner(wrapped_refiner,
1190 folder_name=folder_name,
1191 groupby_addition=folder_groupby_addition)
1193 if groupby
is not None:
1196 exclude_by=exclude_groupby)
1198 if filter
is not None or filter_on
is not None:
1203 if above_expert_level
is not None or below_expert_level
is not None:
1205 above_expert_level=above_expert_level,
1206 below_expert_level=below_expert_level)
1208 if not isinstance(wrapped_refiner, Refiner):
1209 wrapped_refiner =
Refiner(wrapped_refiner)
1211 return wrapped_refiner
1214 return context_decorator
1216 return functools.wraps(refiner)(context_decorator(refiner))
1219 def refiner_with_context(refiner_factory):
1220 @functools.wraps(refiner_factory)
1221 def module_decorator_with_context(above_expert_level=None, below_expert_level=None,
1222 folder_name=None, folder_groupby_addition=None,
1223 filter=None, filter_on=None,
1224 groupby=None, exclude_groupby=None,
1225 select=None, exclude=None,
1226 **kwds_for_refiner_factory):
1228 refiner = refiner_factory(**kwds_for_refiner_factory)
1230 return context(refiner,
1231 above_expert_level=above_expert_level, below_expert_level=below_expert_level,
1232 folder_name=folder_name, folder_groupby_addition=folder_groupby_addition,
1233 filter=filter, filter_on=filter_on,
1234 groupby=groupby, exclude_groupby=exclude_groupby,
1235 select=select, exclude=exclude)
1237 return module_decorator_with_context
1240 @refiner_with_context
1241 def save_fom(**kwds):
1245 @refiner_with_context
1246 def save_histograms(**kwds):
1250 @refiner_with_context
1251 def save_profiles(**kwds):
1255 @refiner_with_context
1256 def save_scatters(**kwds):
1260 @refiner_with_context
1261 def save_classification_analysis(**kwds):
1265 @refiner_with_context
1266 def save_pull_analysis(**kwds):
1270 @refiner_with_context
1271 def save_tree(**kwds):
1275 def select_crop_parts(crops, select=None, exclude=None):
1281 if isinstance(select, str):
1284 if isinstance(exclude, str):
1285 exclude = [exclude, ]
1287 if isinstance(crops, collections.MutableMapping):
1288 part_names = list(crops.keys())
1290 if not select
and not exclude:
1294 not_selected_part_names = [name
for name
in part_names
if name
not in select]
1297 select_not_in_part_names = [name
for name
in select
1298 if not isinstance(name, collections.Callable)
and name
not in part_names]
1299 if select_not_in_part_names:
1300 get_logger().warning(
"Cannot select %s, because they are not in crop part names %s",
1301 select_not_in_part_names, sorted(part_names))
1303 not_selected_part_names = []
1306 excluded_part_names = [name
for name
in part_names
if name
in exclude]
1308 excluded_part_names = []
1310 excluded_part_names.extend(not_selected_part_names)
1313 selected_crops = copy.copy(crops)
1314 for part_name
in set(excluded_part_names):
1315 del selected_crops[part_name]
1317 if isinstance(select, collections.Mapping):
1319 for part_name, new_part_name
in list(select.items()):
1320 if isinstance(part_name, collections.Callable):
1321 selected_crops[new_part_name] = part_name(**crops)
1322 elif part_name
in selected_crops:
1323 parts = selected_crops[part_name]
1324 del selected_crops[part_name]
1325 selected_crops[new_part_name] = parts
1327 return selected_crops
1330 raise ValueError(
"Unrecognised crop %s of type %s" % (crops, type(crops)))
1333 def filter_crops(crops, filter_function, part_name=None):
1334 if isinstance(filter_function, np.ndarray):
1335 filter_indices = filter_function
1337 parts = crops[part_name]
1338 filter_indices = filter_function(parts)
1340 if isinstance(crops, np.ndarray):
1341 return crops[filter_indices]
1343 elif isinstance(crops, collections.MutableMapping):
1345 filtered_crops = copy.copy(crops)
1346 for part_name, parts
in list(crops.items()):
1347 filtered_crops[part_name] = parts[filter_indices]
1348 return filtered_crops
1351 raise ValueError(
"Unrecognised crop %s of type %s" % (crops, type(crops)))
1354 def iter_items_sorted_for_key(crops):
1357 if isinstance(crops, dict):
1358 keys = sorted(crops.keys())
1359 return ((key, crops[key])
for key
in keys)
1361 return list(crops.items())
def __init__(self, wrapped_refiner, folder_name=None, groupby_addition=None)
folder_name
cached value of the folder name
def refine(self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, *args, **kwds)
wrapped_refiner
cached value of the wrapped refiner
string default_groupby_addition
Default suffix for a groupby selection.
groupby_addition
cached value of the suffix for a groupby selection
string default_folder_name
Folder name to be used if a groupby selection is active.
below_expert_level
cached value of the lower range of the expert level
wrapped_refiner
cached value of the wrapped refiner
def refine(self, harvesting_module, crops, *args, **kwds)
def __init__(self, wrapped_refiner, above_expert_level=None, below_expert_level=None)
above_expert_level
cached value of the upper range of the expert level
on
cached value of the part name to filter on
wrapped_refiner
cached value of the wrapped refiner
def refine(self, harvesting_module, crops, *args, **kwds)
filter
cached value of the filter
def __init__(self, wrapped_refiner, filter=None, on=None)
by
cached value of the group-by classifier
def __init__(self, wrapped_refiner, by=None, exclude_by=None)
wrapped_refiner
cached value of the wrapped refiner
exclude_by
cached value of the exclude-by classifier
bool default_exclude_by
default value of the exclude-by classifier
def refine(self, harvesting_module, crops, groupby_part_name=None, groupby_value=None, *args, **kwds)
title
cached user-defined title for this profile histogram / scatterplot
y_log
cached flag for logarithmic y axis for this profile histogram / scatterplot
description
cached user-defined description for this profile histogram / scatterplot
contact
cached user-defined contact person for this profile histogram / scatterplot
fit
cached fit for this profile histogram / scatterplot
upper_bound
cached upper bound for this profile histogram / scatterplot
y
cached value of ordinate
outlier_z_score
cached Z-score (for outlier detection) for this profile histogram / scatterplot
y_binary
cached flag for probability y axis (range 0.0 .
skip_single_valued
cached flag to skip single-valued bins for this profile histogram / scatterplot
allow_discrete
cached flag to allow discrete values for this profile histogram / scatterplot
fit_z_score
cached fit Z-score (for outlier detection) for this profile histogram / scatterplot
stackby
cached stacking selection for this profile histogram / scatterplot
y_unit
cached measurement unit for ordinate
def __init__(self, y, x=None, name=None, title=None, contact=None, description=None, check=None, stackby=None, y_unit=None, y_binary=None, y_log=None, lower_bound=None, upper_bound=None, bins=None, outlier_z_score=None, fit=None, fit_z_score=None, skip_single_valued=False, allow_discrete=False)
x
cached value of abscissa
string plot_kind
by default, this refiner is for profile histograms
def has_more_than_one_value(xs)
name
cached user-defined name for this profile histogram / scatterplot
bins
cached number of bins for this profile histogram / scatterplot
def refine(self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, **kwds)
lower_bound
cached lower bound for this profile histogram / scatterplot
check
cached user-defined user-check action for this profile histogram / scatterplot
refiner_function
cached copy of the instance's refiner function
def __init__(self, refiner_function=None)
def refine(self, harvesting_module, *args, **kwds)
def __get__(self, harvesting_module, cls=None)
def __call__(self, harvesting_module, crops=None, *args, **kwds)
truth_name
cached truth-values-collection name for this truth-classification analysis
cut
cached threshold of estimates for this truth-classification analysis
contact
cached contact person for this truth-classification analysis
upper_bound
cached upper bound of estimates for this truth-classification analysis
outlier_z_score
cached Z-score (for outlier detection) of estimates for this truth-classification analysis
allow_discrete
cached discrete-value flag of estimates for this truth-classification analysis
unit
cached measurement unit of estimates for this truth-classification analysis
string default_truth_name
default name for the truth-classification analysis truth-values collection
estimate_name
cached estimates-collection name for this truth-classification analysis
string default_estimate_name
default name for the truth-classification analysis estimates collection
cut_direction
cached cut direction (> or <) of estimates for this truth-classification analysis
def __init__(self, part_name=None, contact=None, estimate_name=None, truth_name=None, cut_direction=None, cut=None, lower_bound=None, upper_bound=None, outlier_z_score=None, allow_discrete=False, unit=None)
part_name
cached part name for this truth-classification analysis
string default_contact
default contact person for this truth-classification analysis
def refine(self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, **kwds)
lower_bound
cached lower bound of estimates for this truth-classification analysis
title
cached user-defined title for this histogram
description
cached user-defined description for this histogram
contact
cached user-defined contact person for this histogram
fit
cached fit for this histogram
upper_bound
cached upper bound for this histogram
outlier_z_score
cached Z-score (for outlier detection) for this histogram
allow_discrete
cached flag to allow discrete values for this histogram
string default_description
default description for this histogram
def __init__(self, name=None, title=None, contact=None, description=None, check=None, lower_bound=None, upper_bound=None, bins=None, outlier_z_score=None, allow_discrete=False, stackby="", fit=None, fit_z_score=None)
fit_z_score
cached fit Z-score (for outlier detection) for this histogram
stackby
cached stacking selection for this histogram
string default_check
default user-check action for this histogram
string default_title
default title for this histogram
name
cached user-defined name for this histogram
string default_contact
default contact person for this histogram
string default_name
default name for this histogram
bins
cached number of bins for this histogram
def refine(self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, **kwds)
lower_bound
cached lower bound for this histogram
check
cached user-defined user-check action for this histogram
variance_name
cached name for the pull analysis variances collection
truth_name
cached name for the pull analysis truth-values collection
string default_variance_name
default name for the pull analysis variances collection
quantity_name
cached name of the quantity for the pull analysis
contact
cached contact person for this pull analysis
outlier_z_score
cached Z-score (for outlier detection) for the pull analysis
part_names
cached array of part names for this pull analysis
unit
cached measurement unit for the pull analysis
aux_names
cached auxiliary names for the pull analysis
string default_truth_name
default name for the pull analysis truth-values collection
estimate_name
cached name for the pull analysis estimates collection
string default_estimate_name
default name for the pull analysis estimates collection
title_postfix
cached suffix for the title of this pull analysis
def __init__(self, name=None, contact=None, title_postfix=None, part_name=None, part_names=None, truth_name=None, estimate_name=None, variance_name=None, quantity_name=None, aux_names=None, unit=None, outlier_z_score=None, absolute=False, which_plots=None)
name
cached name for this pull analysis
string default_contact
default contact person for this pull analysis
string default_name
default name for this pull analysis
def refine(self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, **kwds)
string default_title_postfix
default suffix for the title of this pull analysis
which_plots
cached list of plots produced by the pull analysis
absolute
cached absolute-value-comparison flag for the pull analysis
title
cached title for this TTree
def __init__(self, name=None, title=None)
def add_branch(self, output_ttree, part_name, parts)
string default_title
default title for this TTree
name
cached name for this TTree
string default_name
default name for this TTree
def refine(self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, **kwds)
def __init__(self, wrapped_refiner, select=None, exclude=None)
wrapped_refiner
cached value of the wrapped refiner
def refine(self, harvesting_module, crops, *args, **kwds)
exclude
cached value of the exclusion flag
select
cached value of the selector
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double >> &runs, double cut, std::map< ExpRun, std::pair< double, double >> &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved