plesty.lib.report.tables

Tables built from what a data kind declares about its arrays.

data_table() reads columns and lays the one-dimensional arrays out as columns — label and unit in the header, value ± error in each cell, meanings under the table. It is what an analyzer’s default report is made of, and a starting point for one that is written by hand.

Attributes

MAX_ROWS

Functions

heading(→ str)

Return a column heading: the label, and the unit in parentheses.

data_table(→ Optional[plesty.lib.report.blocks.Table])

Tabulate a piece of data from its kind's declared columns.

array_table(→ Optional[plesty.lib.report.blocks.Table])

Tabulate one one-dimensional array as a single column.

Module Contents

plesty.lib.report.tables.MAX_ROWS = 200
plesty.lib.report.tables.heading(label: str, unit: str | None) → str

Return a column heading: the label, and the unit in parentheses.

Parameters:
  • label (str)

  • unit (Optional[str])

Return type:

str

plesty.lib.report.tables.data_table(data: plesty.lib.data.experiment_data.ExperimentData, title: str = '', *, result_only: bool = True, max_rows: int = MAX_ROWS) → plesty.lib.report.blocks.Table | None

Tabulate a piece of data from its kind’s declared columns.

Only the declared, one-dimensional arrays of one common length are tabulated, in declaration order. An array named as another’s error is shown in that column rather than as its own.

Parameters:
Returns:

The table, or None when the kind declares no columns or none of them can be tabulated.

Return type:

Optional[plesty.lib.report.blocks.Table]

plesty.lib.report.tables.array_table(array: plesty.lib.data.array.PlestyArray, title: str = '', *, max_rows: int = MAX_ROWS) → plesty.lib.report.blocks.Table | None

Tabulate one one-dimensional array as a single column.

Parameters:
  • array (plesty.lib.data.array.PlestyArray) – The array; its name, unit and description head the column.

  • title (str) – The table’s title.

  • max_rows (int) – Refuse arrays longer than this.

Returns:

The table, or None for an array that is not 1-D or too long.

Return type:

Optional[plesty.lib.report.blocks.Table]