eqiora.data
Explicit numeric adapters and canonical resolved-array artifacts.
View sourceExample: explicitly mapped measurement columns
Section titled “Example: explicitly mapped measurement columns”from pathlib import Pathimport eqiorafrom eqiora import data, units as u
text = "elapsed_ms,force_mN\n0,0\n500,2000\n1000,0\n"array, dimensions = data.csv_array(text, columns=( ("elapsed_ms", u.s.prefixed("m")), ("force_mN", u.N.prefixed("m")),))assert dimensions == (eqiora.Dimension(time=1), eqiora.Dimension(mass=1, length=1, time=-2))Path("force_samples.json").write_bytes(array.to_bytes())reopened = data.ResolvedArray.from_bytes(Path("force_samples.json").read_bytes())assert reopened.digest == array.digestUse the file as a package’s data/force_samples.json asset. Its property
release declares the time and force dimensions, validity, interpolation and
extrapolation policy. CSV conversion preserves row order and rejects missing
selected cells; the property-table owner rejects duplicate or unordered times.
See numeric inputs.
ResolvedArray
Section titled “ResolvedArray”Immutable row-major values with the native resolved-array identity and codec.
@finalclass ResolvedArray: @staticmethod def from_f64(shape: Sequence[int], values: Sequence[float]) -> ResolvedArray: ... @staticmethod def from_u64(shape: Sequence[int], values: Sequence[int]) -> ResolvedArray: ... @staticmethod def from_bytes(data: bytes) -> ResolvedArray: ... def to_bytes(self) -> bytes: ... @property def digest(self) -> str: ... @property def scalar(self) -> Literal['f64', 'u64']: ... @property def shape(self) -> tuple[int, ...]: ... @property def values(self) -> tuple[float, ...] | tuple[int, ...]: ...csv_array
Section titled “csv_array”Map numeric CSV columns explicitly through exact Unit normalization.
def csv_array(text: str, *, columns: Sequence[tuple[str, Unit]], delimiter: str=',') -> tuple[ResolvedArray, tuple[Dimension, ...]]: ...export_observations_csv
Section titled “export_observations_csv”Write selected typed observation components through the shared native exporter.
def export_observations_csv(path: str | PathLike[str], observations: Iterable[Observation], *, unit: Unit, projection: str='real', component: int=0, decimal_places: int=6, locale: str='C') -> None: ...