hertzforge.core.scan_sensors¶
scan_sensors
¶
A geometry and a channel table from accelerometers fitted to measured
points (core.scan_fit).
Each accelerometer becomes one node at the center of its body, measured in a coordinate system of its own whose axes are the accelerometer's. A tri-axial accelerometer gives three channels, X+, Y+ and Z+, whatever faces were measured; a uni-axial one gives one, on the axis its top was labelled with. A uni-axial accelerometer that is a block (a catalog model whose body is a box) is measured by its flat faces as a tri-axial one is, with X along its length toward its cable and Z its sensing axis, and gives the one channel Z+.
The center is half the body's size back from each measured face, so it
needs the size. What is chosen for a sensor is its node, its model, and
its size: a cube's side, or a round body's diameter and length. A size
typed is used. Otherwise the size is the model's, when the model is in
the catalog or is itself a size (Block 17.5 mm); otherwise that of the
smallest tri-axial catalog model the measured points fit in; otherwise
what was measured: a block's least side, or a cylinder's diameter and,
for its length, twice how far its top lies from the middle of the
points on its side. A sensor with no model named takes
its size written where its model would be, which is how the 3-D view
draws it at that size.
Classes:
| Name | Description |
|---|---|
Placed |
One accelerometer as it would be placed, or why it is not. |
Functions:
| Name | Description |
|---|---|
typed_choice |
The kept choice ( |
kept_as_typed |
A sensor's kept choices named as they are typed ( |
guess_model |
The smallest tri-axial model in the catalog a fitted block fits in. |
resolve |
Each measured sensor as it would be placed: its node, model, shape |
assemble |
The geometry and channel table of fitted accelerometers. |
Classes¶
Placed
dataclass
¶
Placed(sensor: str, kind: str, node: int | None, model: str, table_model: str, shape: str, size: float | None, length: float | None, body: tuple[float, float, float] | None, sized_by: str, channel_type: str, problem: str, channels: tuple[int, ...] = (), directions: tuple[str, ...] = ())
One accelerometer as it would be placed, or why it is not.
Attributes:
sensor: The sensor's name in the features.
kind: 'triax' or 'uniaxial', as it was measured.
node: Its node in the geometry; None when it has none.
model: The model named or guessed for it, '' for none.
table_model: What its rows name as the model: model, or its
size written as one.
shape: 'Cube', 'Cylinder', or a catalog body's shape.
size: A cube's side or a round body's diameter, in the fits'
unit; None when nothing was measured.
length: A round body's length along its sensing axis; None for a
cube.
body: The body's size along its X, Y and Z, in the fits' unit.
sized_by: Where the size came from: 'given' (typed), 'model',
'guess' (the catalog model the points fit in) or 'measured';
'' when it has no size.
channel_type: 'acceleration', or 'force' for a force transducer.
problem: Why it is not placed; '' when it is.
channels: Its channel numbers in the table, once assembled.
directions: The channels it gives: X+, Y+ and Z+ for a tri-axial
accelerometer, one for a uni-axial one.
Attributes:
| Name | Type | Description |
|---|---|---|
placed |
bool
|
Whether the sensor becomes a node and channels. |
Functions:¶
typed_choice
¶
The kept choice (CHOICES) a typed one (TYPED) is for a sensor
measured as kind: a cube's length is its size, a cylinder's
diameter its size.
Raises:
| Type | Description |
|---|---|
ValueError
|
For a diameter typed for a cube, which has none. |
kept_as_typed
¶
A sensor's kept choices named as they are typed (typed_choice).
guess_model
¶
guess_model(fit: SensorFit, meters: float) -> SensorModel | None
The smallest tri-axial model in the catalog a fitted block fits in.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fit
|
SensorFit
|
A tri-axial accelerometer's fit. |
required |
meters
|
float
|
How many meters one unit of the fit's lengths is. |
required |
Returns:
| Type | Description |
|---|---|
SensorModel or None
|
The first model, in catalog order, of the smallest body whose
every side is at least the furthest the measured points reach
behind a face (less |
resolve
¶
resolve(fits: Sequence[SensorFit], choices: Mapping[Any, Mapping[str, Any]] | None = None, meters: float = 1.0) -> tuple[list[Placed], list[str]]
Each measured sensor as it would be placed: its node, model, shape and size, from what was chosen for it and what its fit gives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fits
|
sequence of SensorFit
|
The fits. |
required |
choices
|
mapping
|
By the sensor's name, a mapping with any of |
None
|
meters
|
float
|
How many meters one unit of the fits' lengths is. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
placed |
list of Placed
|
One per fit, in order. One with a |
notes |
list of str
|
The sizes that were assumed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
assemble
¶
assemble(fits: Sequence[SensorFit], length_unit: str, *, meters: float = 1.0, choices: Mapping[Any, Mapping[str, Any]] | None = None) -> tuple[Geometry, ChannelTable, list[Placed], list[str]]
The geometry and channel table of fitted accelerometers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fits
|
sequence of SensorFit
|
The fits; those that cannot be placed are left out and named in the notes. |
required |
length_unit
|
str
|
The length unit of the geometry made, the one the points were measured in. |
required |
meters
|
float
|
How many meters one unit of the fits' lengths is. |
1.0
|
choices
|
mapping
|
What was chosen for each sensor ( |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
geometry |
Geometry
|
One node per accelerometer at the center of its body, placed in
the global system and measured in a cartesian system of its own
at the node, named |
channels |
ChannelTable
|
Channels numbered from 1 in the sensors' order: X+, Y+, Z+ for a tri-axial accelerometer and the one labelled axis for a uni-axial one, acceleration in g, or force in N for a force transducer, with the make and model. |
placed |
list of Placed
|
Every sensor measured, placed or not, with its channels. |
notes |
list of str
|
The sensors left out and the sizes that were assumed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When nothing can be placed, or |