Complete reference for every public class and method in instrumation-report 0.0.1.
Dataclass. A single measured value with optional pass/fail evaluation.
| Field | Type | Default | Description |
|---|---|---|---|
| name | str | required | Label for the measurement row. |
| value | float | required | Measured numeric value. |
| unit | str | "" | Unit string, e.g. "V", "Hz", "dB". |
| condition | tuple | callable | float | None | None | Pass/fail rule. See Condition types. |
| test_number | str | "" | Procedure reference, e.g. "1.1.3". |
| expected | str | "" | Human-readable expected value, e.g. "3.2–3.4 V". |
| notes | str | "" | Short annotation shown in the Notes column. |
| description | str | "" | Longer description (not shown in table by default). |
Properties
True, False, or None (no condition).
"PASS", "FAIL", or "N/A" based on evaluate().
Dataclass. UUT metadata shown in the report header block.
| Field | Type | Default | Description |
|---|---|---|---|
| title | str | required | Main report title. |
| subtitle | str | "" | Secondary line shown below the title. |
| engineer | str | "" | Engineer / tester name. |
| uut_name | str | "" | Name of the unit under test. |
| uut_serial | str | "" | Serial number of the UUT. |
| revision | str | "" | Hardware or firmware revision. |
| date | str | today (ISO) | Test date. Defaults to datetime.date.today().isoformat(). |
| extra_fields | dict | {} | Arbitrary key/value pairs added to the header grid. |
Dataclass. A numbered table of measurements inside a Section.
| Field | Type | Default | Description |
|---|---|---|---|
| title | str | required | Table heading. |
| sub_number | str | required | Sub-section identifier, e.g. "1.1". |
| measurements | list[Measurement] | [] | Populated via add(). |
Dataclass. A top-level section containing one or more TestTables.
| Field | Type | Default | Description |
|---|---|---|---|
| number | str | required | Section number, e.g. "1", "2". |
| title | str | required | Section heading. |
| subtitle | str | "" | Optional sub-heading shown below the section title. |
| tables | list[TestTable] | [] | Populated via add_table(). |
Main class. Holds the header, sections, and flat measurements. Drives output generation.
Constructor —
Report(header: ReportHeader = None)
If header is omitted, a default header with title "Measurement Report" and today's date is used.
jinja2.
.xlsx report with coloured rows. Dependencies: openpyxl.
pip install "instrumation-report[pdf]" and system Pango libraries. Raises ImportError if weasyprint is not installed.
The condition argument on Measurement accepts four forms:
| Type | Example | Passes when | Notes |
|---|---|---|---|
| Range tuple | (3.2, 3.4) |
lo <= value <= hi |
Inclusive on both ends |
| Lambda | lambda v: v > 1000 |
Callable returns truthy | Any callable float → bool |
| Threshold float | 15.0 |
value >= threshold |
Useful for minimum specs |
| None | omit argument | N/A — no evaluation | Good for informational rows |
condition raises TypeError at evaluation time.