17Define datatypes for later serialization by json
30 Base object for all json-serializable objects of the validation suite
34class Revision(JsonBase):
37 Contains information about a specific revision
46 creation_timezone=None,
49 Create a new Revision object and fill all members
71 self.
packages = []
if (packages
is None)
else packages
77 Container for a list of revisions
82 Create a new Revisions object and fill all members
92 Contains information about a script and its execution output
107 Create a new Script object and fill all members
139 Wrapper for a file containing a set of plots, only
143 def __init__(self, package, title, rootfile, plots, description=""):
145 Create a new PlotFile object and fill all members
165 Wrapper for one specific plot.
179 Create a new Plot object and fill all members
203 Wrapper for NTuple lists. This
is not a graphical plot, but a list of
207 def __init__(self, is_expert=False, description=None, check=None):
209 Create a new NTuple object and fill all members
223 Wrapper for user HTML Content. This
is not a graphical plot but HTML
224 code which will be directly output on the validation website.
228 def __init__(self, is_expert=False, description=None, check=None):
230 Create a new NTuple object and fill all members
244 One high-level package of the validation suites which contains a set of
245 scripts and output plot files
248 def __init__(self, name, plotfiles=None, scriptfiles=None, fail_count=0):
250 Create a new NTuple object and fill all members
273 Enum to classify the comparison result of two validation plots
278 NotCompared = "not_compared"
281 NotSupported =
"not_supported"
284 FailureTechnical =
"technical_failure"
287 FailureStastical =
"statistical_failure"
296 Contains the comparison result of two plots
301 Create a new ComparisonResult object and fill all members
313 Contains information about a file containing plots and the comparison which
314 have been performed
for the content of this file
322 compared_revisions=None,
330 Create a new ComparisonPlotFile object and fill all members
341 package, title, rootfile, plots, description=description
355 [plt
for plt
in self.
plots if plt.comparison_result ==
"error"]
361 for plt
in self.
plots
362 if (
not plt.is_expert)
and plt.comparison_result ==
"error"
367 [plt
for plt
in self.
plots if plt.comparison_result ==
"warning"]
374 for plt
in self.
plots
375 if (
not plt.is_expert)
and plt.comparison_result ==
"warning"
381 [
not tuple.is_expert
for tuple
in self.
ntuples]
393 One individual plot including its comparison outcome.
399 comparison_result=None,
407 comparison_text=None,
413 Create a new ComparisonPlot object and fill all members
419 description=description,
453 Comparison outcome for NTuples
466 Create a new ComparisonNTuple object and fill all members
471 is_expert=is_expert, description=description, check=check
485 Compiled HTLM Content
498 Create a new ComparisonNTuple object and fill all members
503 is_expert=is_expert, description=description, check=check
517 Information about a Package which was used in a comparison operation
521 self, name, plotfiles=None, scriptfiles=None, ntuplefiles=None
524 Create a new ComparisonPackage object and fill all members
534 super().
__init__(name, plotfiles=plotfiles, scriptfiles=scriptfiles)
540 [pf.comparison_error_shifter
for pf
in plotfiles]
544 [pf.comparison_warning
for pf
in plotfiles]
549 [pf.comparison_warning_shifter
for pf
in plotfiles]
556 Revision information enriched by the information gained during
560 def __init__(self, label, git_hash=None, creation_date=None, color=None):
562 Create a new ComparisonRevision object and fill all members
566 super().
__init__(label, git_hash=git_hash, creation_date=
None)
575 Contains information and plots generated
for comparisons
581 Create a new ComparisonRevision object and fill all members
593 sorted_revs = sorted(revisions, key=
lambda x: x.label)
596 lambda x, y: x +
"_" + y.label, sorted_revs,
""
605def dump(file_name, obj):
607 Output a tree of objects into a json file
610 with open(file_name,
"w+")
as f:
611 json.dump(dump_rec(obj), f, sort_keys=
True, indent=4)
616 Convert a tree of python objects into a json file
620 return json.dumps(kk, sort_keys=
True, indent=4)
623def dump_rec(top_object):
625 Recursive generating of dictionary from a tree
631 for (k, v)
in top_object.__dict__.items():
634 if isinstance(v, list):
639 if isinstance(it, JsonBase):
641 obj_list.append(dump_rec(it))
647 this_dict[k] = obj_list
650 elif isinstance(v, JsonBase):
651 this_dict[k] = dump_rec(v)
653 elif isinstance(v, enum.Enum):
654 this_dict[k] = v.value
title
Text used as title for the ntuple item.
def __init__(self, title, contact=None, description=None, check=None, is_expert=None, html_content=None)
contact
name of contact person
html_content
path to the json file which contains the individual numbers of the ntuple
title
Text used as title for the ntuple item.
contact
name of contact person
json_file_path
path to the json file which contains the individual numbers of the ntuple (must be relative to html d...
def __init__(self, title, contact=None, description=None, check=None, is_expert=None, json_file_path=None)
comparison_warning_shifter
the number of comparisons of shifter plots which resulted in a warning
comparison_error
the number of failed comparisons in this package
def __init__(self, name, plotfiles=None, scriptfiles=None, ntuplefiles=None)
comparison_error_shifter
the number of failed comparisons of shifter plots in this package
comparison_warning
the number of comparisons which resulted in a warning
has_reference
true if a reference file is available for this plot file
def __init__(self, package, title, rootfile, compared_revisions=None, plots=None, has_reference=False, ntuples=None, html_content=None, description=None)
comparison_warning_shifter
the number of comparisons of shifter plots in this file which resulted in a warning
comparison_error
the number of failed comparisons in this file
show_shifter
Show to shifter, i.e.
comparison_error_shifter
the number of failed comparisons of shifter plots in this file
ntuples
the ntuples which were compared
comparison_warning
the number of comparisons which resulted in a warning
compared_revision
label of the revision which were used in this comparison
html_content
user's html content
n_shifter_ntuples
Number of shifter ntuples.
title
tile used to display this plot
pdf_filename
the filename of the pdf file plotted with the comparison graphs
warnings
Warnings ("no contact" person etc.)
comparison_result
text string for the comparison outcome
plot_path
path were the png and pdf files are located (relative to the html directory; has to end with trailing...
def __init__(self, title, comparison_result=None, png_filename=None, pdf_filename=None, contact=None, description=None, check=None, is_expert=None, plot_path=None, comparison_text=None, height=None, width=None, warnings=None)
png_filename
the filename of the png file plotted with the comparison graphs
comparison_text
verbose text describing the outcome of the comparison
chi2
the chi2 value computed during the comparison
state
a string containing a description of the comparison's outcome
def __init__(self, state, chi2)
color
the color which was used for this revision in the comparison plots
def __init__(self, label, git_hash=None, creation_date=None, color=None)
label
the unique label of this comparison
packages
the list of packages looked at in this comparison
revisions
the list of revisions used in this comparison
def __init__(self, revisions=None, packages=None)
description
telling description for this HTML code
def __init__(self, is_expert=False, description=None, check=None)
is_expert
true if this is marked as an expert-only HTML code
check
what should be checked for in this HTML code
description
telling description for this ntuple
def __init__(self, is_expert=False, description=None, check=None)
is_expert
true if this is marked as an expert-only ntuple list
check
what should be checked for in this ntuple ?
visible
true if this package is displayed on the default validation website
def __init__(self, name, plotfiles=None, scriptfiles=None, fail_count=0)
plotfiles
list of plotfiles which were produced by the scripts in this package
scriptfiles
scripts which were run or skipped as this package was executed
fail_count
contains the number how many scripts failed to execute with error
title
Display name of this file.
description
Description of plot file.
plots
list of plots which are contained inside this plot file
n_shifter_plots
Number of shifter plots.
package
name of the package which created this file
rootfile
filename of the root file
def __init__(self, package, title, rootfile, plots, description="")
description
telling description for this plot
contact
Who is the contact person for this plot ?
height
height of the plot in pixels
width
width of the plot in pixels
def __init__(self, is_expert=False, description=None, check=None, contact=None, width=None, height=None, issue=None)
is_expert
true if this is marked as an expert-only plot
check
What should be checked for in this plot ?
label
label (or tag) used to display this revision
packages
list of packages contained in this revision
def __init__(self, label, git_hash=None, creation_date=None, packages=None, creation_timezone=None)
most_recent
is this the most recent revision in the list this revision is contained ?
git_hash
The git commit hash which has the HEAD while the validation scripts were executed.
creation_date
date when the validation output of this revision was created, as datetime object
creation_timezone
timezone used by the creation date
def __init__(self, revisions)
status
Output status of the script execution, can be one of the strings "failed", "finished",...
input
input files for the script as declared in the header
path
path the script file is located
return_code
integer which is the return code of the script execution
name
the name of the script file
def __init__(self, name, path, status, log_url=None, return_code=None, input=None, output=None, issues=None)
log_url
location where the log output of the script execution can be found
output
output files produced by the script as declared in the header