QualityReports#

class pypillometry.QualityReports(data=None, headers=None, tooltips=None, item='recording')[source]#

Bases: dict

Quality reports of several recordings (e.g., of a dataset).

A dict key -> QualityReport, made by Dataset.quality_report (key: (subject, task), or the subject if the dataset has no tasks). It is shown as a summary table, one row per recording, with the overall label and the worst label of each section; the individual reports are its values (reports["002"]).

Parameters:
  • data (dict, optional) – key -> QualityReport

  • headers (dict, optional) – key -> header shown above the report in to_text() and to_html() (default: the name of the row)

  • tooltips (dict, optional) – key -> text shown when hovering over the row in to_html()

  • item (str) – what a row is, in the summary table (default "recording")

Methods

clear

Remove all items from the dict.

copy

Return a shallow copy of the dict.

fromkeys

Create a new dictionary with keys from iterable and values set to value.

get

Return the value for key if key is in the dictionary, else default.

items

Return a set-like object providing a view on the dict's items.

keys

Return a set-like object providing a view on the dict's keys.

pop

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem

Remove and return a (key, value) pair as a 2-tuple.

setdefault

Insert key with a value of default if key is not in the dictionary.

to_html

Write the reports to an HTML page: the summary table, linked to the individual reports below it (as pypilinfo --html).

to_pandas

All measures as a pandas.DataFrame.

to_text

The summary table (for more than one report) and the reports as text.

update

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values

Return an object providing a view on the dict's values.

Details

classmethod fromkeys(iterable, value=None, /)#

Create a new dictionary with keys from iterable and values set to value.

clear(/)#

Remove all items from the dict.

copy(/)#

Return a shallow copy of the dict.

get(key, default=None, /)#

Return the value for key if key is in the dictionary, else default.

items(/)#

Return a set-like object providing a view on the dict’s items.

keys(/)#

Return a set-like object providing a view on the dict’s keys.

pop(key, default=<unrepresentable>, /)#

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(/)#

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)#

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

to_html(fname)[source]#

Write the reports to an HTML page: the summary table, linked to the individual reports below it (as pypilinfo --html).

Return type:

None

to_pandas(long=False)[source]#

All measures as a pandas.DataFrame.

Parameters:

long (bool) – If False (default), one row per recording, with columns as in QualityReport.to_dict() with flat=True (e.g., "pupil.left.missing_pct" and its label). If True, one row per measure and recording, with columns subject (and task), section, group (the eye, or "all"), measure, value, unit and label; e.g. df.query("section == 'calibration'").

Return type:

DataFrame

to_text(reports=True, color=None, descriptions=False)[source]#

The summary table (for more than one report) and the reports as text.

Parameters:
Return type:

str

update([E, ]**F) → None.  Update D from mapping/iterable E and F.#

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values(/)#

Return an object providing a view on the dict’s values.