QualityReport#
- class pypillometry.QualityReport(name, class_name, sections, thresholds)[source]#
Bases:
objectData-quality report for an eyedata object.
Created by
quality_report(). The report can beshown as text (
print(report); labels are colored if the terminal supports it),shown as HTML in a Jupyter notebook (just display the object),
converted to a dict (
to_dict()), e.g., to collect the reports of several datasets in apandas.DataFrame.
Individual measures can be accessed like a dict:
report["pupil"]["left"]["missing_pct"]is aQualityMetric.- Attributes:
- namestr
name of the dataset
- class_namestr
class of the dataset (e.g., “EyeData”)
- sectionsdict
{section: {group: {metric_name: QualityMetric}}}, where the group is usually the eye (e.g., “left”)- thresholdsdict
thresholds used for the labels
overallstr or NoneWorst label of all measures (None if no measure has a label).
Methods
Return the measures with a label of min_label or worse.
Return the available sections.
Return the worst label for each section and group.
Iterate over all measures as
(section, group, QualityMetric).Return the report as a dictionary.
Return the report as a (multi-line) text.
Details
- labels()[source]#
Return the worst label for each section and group.
- Return type:
- Returns:
{section: {group: label}}(sections without labels are left out)
- to_dict(flat=False)[source]#
Return the report as a dictionary.
- Parameters:
flat (
bool) – If False (default), return a nested dict{"name", "class", "overall", <section>: {<group>: {<metric>: {...}}}}, where each metric is a dict with value, unit, label and description. If True, return a flat dict with keys like"pupil.left.missing_pct"(the value) and"pupil.left.missing_pct.label"(the label); convenient for creating apandas.DataFramefrom the reports of several datasets.- Return type:
- to_text(color=None, descriptions=False, width=80)[source]#
Return the report as a (multi-line) text.
- Parameters:
color (
Optional[bool]) – color the labels with ANSI escape codes; if None (default), colors are used if the output supports it (terminal or Jupyter; disable by setting the environment variableNO_COLOR)descriptions (
bool) – if True, explain each measure (and its thresholds) below its rowwidth (
int) – maximum line width for the descriptions (default 80)
- Return type: