visualdynamics.core.run_log_export¶
run_log_export
¶
Views of a run log for other readers: plain text, CSV, and the machine log.
The .vdlog file is its own JSON export, and it is the one format the
log is read back from. These views are written out only:
- Plain text (
to_text): every entry in the order written, for printing or attaching to a report. A corrected entry is marked with the corrections that changed it, and each correction says what it changed and what the value was; a late entry is marked with when it was entered. The chains' heads and whatRunLog.verifyfound close it. - CSV (
to_csv): one row per entry as stored, corrections included, with the corrected-by and corrects columns, a late column, the time on the recorders' clock, and the fields as JSON. - The machine log (
machine_log_csv): the entries a lab's own machine log keeps (trips and aborts, setting changes, clock checks, people in and out, restarts, and the tests opened and closed, which say what was running), corrected, one row each, in columns a spreadsheet or a machine log takes as they are.
Each takes test: 'all' (the whole log, the default), a test's number,
or None for the entries between tests.
Functions:
| Name | Description |
|---|---|
to_text |
The log as plain text, every entry in the order written. |
to_csv |
The log as CSV: a header row of |
machine_log_csv |
The trips and machine events of the log, for the lab's own |
export |
Write one view of the log to |
Classes¶
Functions:¶
to_text
¶
to_text(log: RunLog, *, test: int | str | None = ALL, late_after: timedelta = LATE_AFTER) -> str
The log as plain text, every entry in the order written.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log
|
RunLog
|
The log. |
required |
test
|
(int, None or 'all')
|
Which entries: the whole log, one test, or (None) those between tests. |
ALL
|
late_after
|
timedelta
|
How long after its event an entry is entered to be marked late. |
LATE_AFTER
|
Returns:
| Type | Description |
|---|---|
str
|
The text, a line or more per entry, then the lines that could not be read, the chains' heads, and what verifying found. |
Source code in src/visualdynamics/core/run_log_export.py
to_csv
¶
to_csv(log: RunLog, *, test: int | str | None = ALL, late_after: timedelta = LATE_AFTER) -> str
The log as CSV: a header row of CSV_COLUMNS, then one row per
entry as stored, corrections included.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log
|
RunLog
|
The log. |
required |
test
|
(int, None or 'all')
|
Which entries: the whole log, one test, or (None) those between tests. |
ALL
|
late_after
|
timedelta
|
How long after its event an entry is entered to be marked late. |
LATE_AFTER
|
Returns:
| Type | Description |
|---|---|
str
|
The CSV text. Times are ISO 8601 with their UTC offsets; |
Source code in src/visualdynamics/core/run_log_export.py
machine_log_csv
¶
machine_log_csv(log: RunLog, *, test: int | str | None = ALL) -> str
The trips and machine events of the log, for the lab's own
machine log: a header row of MACHINE_COLUMNS, then one row per
entry of a kind KINDS marks machine, in the corrected view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log
|
RunLog
|
The log. |
required |
test
|
(int, None or 'all')
|
Which entries: the whole log, one test, or (None) those between tests. |
ALL
|
Returns:
| Type | Description |
|---|---|
str
|
The CSV text: the event's local date, time and UTC offset, its time on the recorders' clock where a clock check is in force, the event in words ('Abort or trip'), its details, the test that was running and its title, the axis and run, the author, the entry's id, and 'corrected' when a correction changed it. |
Source code in src/visualdynamics/core/run_log_export.py
export
¶
export(log: RunLog, path: str | PathLike, view: str = 'text', *, test: int | str | None = ALL) -> str
Write one view of the log to path, in UTF-8, and return the
path written.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log
|
RunLog
|
The log. |
required |
path
|
str or PathLike
|
Where to write; given the view's extension ( |
required |
view
|
str
|
'text' ( |
'text'
|
test
|
(int, None or 'all')
|
Which entries. |
ALL
|
Returns:
| Type | Description |
|---|---|
str
|
The path written. |
Raises:
| Type | Description |
|---|---|
RunLogError
|
For a view that is not one of |