Observations¶
The numeric layer: radial signal data in one of two explicit modes. See Per-scan radius axes.
Observations
¶
xarray-backed radial signal store (shared or per-scan radius axes).
Prefer the :meth:from_shared_axis and :meth:from_per_scan factories.
The constructor accepts a pre-built :class:xarray.Dataset and validates it,
which supports round-tripping and defensive checks on hand-built datasets.
Source code in src/openauc/models/observations.py
from_shared_axis
classmethod
¶
from_shared_axis(
*,
radius: Sequence[float] | NDArray[float64],
signal: Sequence[Sequence[float]] | NDArray[float64],
scan_ids: Sequence[str],
signal_unit: Unit = Unit.UNKNOWN,
radius_unit: Unit = Unit.CENTIMETRE,
) -> Observations
Build shared-axis observations from one radius axis and a 2-D signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
Sequence[float] | NDArray[float64]
|
1-D shared radius axis of length |
required |
signal
|
Sequence[Sequence[float]] | NDArray[float64]
|
2-D signal of shape |
required |
scan_ids
|
Sequence[str]
|
|
required |
signal_unit
|
Unit
|
Declared signal unit (retained, not converted). |
UNKNOWN
|
radius_unit
|
Unit
|
Declared radius unit (default centimetres). |
CENTIMETRE
|
Source code in src/openauc/models/observations.py
from_per_scan
classmethod
¶
from_per_scan(
*,
radii: Sequence[Sequence[float] | NDArray[float64]],
signals: Sequence[Sequence[float] | NDArray[float64]],
scan_ids: Sequence[str],
signal_unit: Unit = Unit.UNKNOWN,
radius_unit: Unit = Unit.CENTIMETRE,
) -> Observations
Build per-scan observations, padding to a rectangle with a mask.
Each scan's radius/signal vectors may differ in length. They are stored
in (scan, point) arrays padded with NaN; the accompanying mask
marks the real observations. No interpolation is performed.
Source code in src/openauc/models/observations.py
points_per_scan
¶
Count of real observations per scan (mask sum, or width if shared).
Source code in src/openauc/models/observations.py
valid_radius_values
¶
All real radius observations, flattened (padding excluded).
Source code in src/openauc/models/observations.py
radius_range
¶
(min, max) over real radius observations, or None if empty.
Source code in src/openauc/models/observations.py
scan_vectors
¶
The (radius, signal) vectors of one scan, padding excluded.
Values and their order are returned exactly as stored — nothing is
sorted, resampled or interpolated. In shared mode the shared radius axis
is returned for every scan; in per-scan mode each scan's own axis is
returned, with positions whose mask entry is False removed.
Raises:
| Type | Description |
|---|---|
KeyError
|
if |
Source code in src/openauc/models/observations.py
iter_scan_vectors
¶
Yield (scan_id, radius, signal) for every scan, in stored order.
Source code in src/openauc/models/observations.py
to_dict
¶
Serialise to plain JSON-friendly Python types.
Per-scan padding is written as None (JSON null) so it is never
mistaken for a measured value; the authoritative mask is written too.
Source code in src/openauc/models/observations.py
from_dict
classmethod
¶
Reconstruct from :meth:to_dict output.