visualdynamics.core.channel_table¶
channel_table
¶
Channel table: per-channel test metadata (sensor, DOF, engineering units).
One fixed set of columns, each with a type and a rule, rather than whatever a source happened to carry. The table used to be a pandas frame that took anything — a Rattlesnake import arrived with thirteen columns of controller settings riding behind the ones visualdynamics reads — and "anything" is exactly what a column cannot have logic about. Now every column says what it holds, so a direction can be a drop-down, a unit can be narrowed by the channel's type, and an expiration can be a date.
Two strictnesses, on purpose, and they are not the same:
- A file is read leniently. A value that will not coerce is blanked
rather than refused, because refusing the import leaves the user
nothing to fix, and the whole point of this table is that it is the
place to fix it. (
validate.dofsmakes the same trade for DOFs.) - An edit is refused. Once a person is typing, invalid state is rejected at entry with the reason, never written and complained about afterwards.
Classes:
| Name | Description |
|---|---|
Spec |
What one column holds, and what it will accept. |
ChannelTable |
Per-channel metadata, one fixed column set, each column typed. |
Functions:
| Name | Description |
|---|---|
title_of |
The header a column wears, wherever it is shown — the table in |
COLUMNS_KIND |
What kind of value a column holds. |
CHOICES_FOR |
The values a column limits itself to, empty when it does not. |
canonical_name |
A source's column name as this schema spells it. |
Classes¶
Spec
¶
Bases: NamedTuple
What one column holds, and what it will accept.
ChannelTable
¶
Per-channel metadata, one fixed column set, each column typed.
Attributes:
frame: The table, one row per channel, columns in SCHEMA
order. Every cell is text except channel and node,
which are integers — a serial number that happens to be all
digits is not a number, and a column read back as int64
would lose its leading zero and come out of a round trip a
different string.
Methods:
| Name | Description |
|---|---|
set_cell |
Write one cell; a value the column cannot hold is refused. |
units_for |
The units this channel could be in, given its declared type. |
delete_channels |
Remove the given rows in place; the last one is refused. |
dof_strings |
Each channel's degree of freedom, as '101Z+' strings. |
rename_dof |
Give the channel at coordinate |
roles |
Each channel's declared role, '' where undeclared. |
controls |
Which channels are control channels, as booleans. |
types |
What each channel measures, '' where undeclared. |
sensitivities |
mV per engineering unit, NaN where undeclared. |
ranges |
The instrumentation voltage limit, per channel. |
save |
Write the table to a file of its own. |
Attributes:
| Name | Type | Description |
|---|---|---|
num_channels |
int
|
How many channels the table describes — one per row. |
column_names |
list[str]
|
The table's column headings, in order. |
Source code in src/visualdynamics/core/channel_table.py
Attributes¶
Methods:¶
set_cell
¶
Write one cell; a value the column cannot hold is refused.
Strict where _typed is lenient: a person typing gets the
reason, where a file gets the benefit of the doubt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The column to write. |
required |
row
|
int
|
Which channel. |
required |
value
|
object
|
The value, refused if the column cannot hold it. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/visualdynamics/core/channel_table.py
units_for
¶
The units this channel could be in, given its declared type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Which channel. |
required |
Returns:
| Type | Description |
|---|---|
list of str
|
The units this channel could be in, given its declared type. |
Source code in src/visualdynamics/core/channel_table.py
delete_channels
¶
Remove the given rows in place; the last one is refused.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices
|
sequence of int
|
Which rows to remove. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/visualdynamics/core/channel_table.py
dof_strings
¶
Each channel's degree of freedom, as '101Z+' strings.
rename_dof
¶
Give the channel at coordinate old the coordinate new,
in place — its node and direction cells rewritten, since a DOF
string is those two concatenated. The same correction a data
array's rename_dof makes, for the table that names the
channels (Brandon, 2026-09-06), and the same rule: the channel
moves, not every channel at the point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old
|
str
|
The coordinate as the table has it, '101Z+'. |
required |
new
|
str
|
The coordinate to give it: a node number then a direction, normalised the way every DOF is, and refused when it is not one — a table row may lack a node or a direction, but a correction typed by a person is whole. |
required |
quantity
|
str
|
Which channel at |
None
|
Returns:
| Type | Description |
|---|---|
int
|
How many channels changed. |
Source code in src/visualdynamics/core/channel_table.py
roles
¶
controls
¶
types
¶
sensitivities
¶
mV per engineering unit, NaN where undeclared.
ranges
¶
save
¶
Write the table to a file of its own.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or PathLike
|
Where to write it. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/visualdynamics/core/channel_table.py
Functions:¶
title_of
¶
The header a column wears, wherever it is shown — the table in the window and the table in the report are the same table.
COLUMNS_KIND
¶
CHOICES_FOR
¶
The values a column limits itself to, empty when it does not.
'control' is a choice in every sense a spreadsheet cares about, though the schema calls it a flag.
Source code in src/visualdynamics/core/channel_table.py
canonical_name
¶
A source's column name as this schema spells it.
Tidy first — case, spaces, hyphens, a trailing colon someone typed, and a parenthetical unit — then the alias table for words that genuinely differ. The parenthetical matters twice over: it is how this schema writes its own headers ('Sensitivity (mV/Unit)'), so a spreadsheet exported from here has to read back in; and it is how a calibration lab writes theirs ('Sensitivity (mV/g)'), which lands in the same column for the same reason.