Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
robotics
embodied-ai
human-demonstration
egocentric-video
bimanual-manipulation
tactile-sensing
License:
MultimodalData / player /runtime /python /Lib /site-packages /rerun /components /interpolation_mode.py
Download player/runtime/python/Lib/site-packages/rerun/components/interpolation_mode.py from alinarus/MultimodalData: direct link, hf CLI and curl.
- Browser
- Download file 3.17 kB
-
https://huggingface.co/datasets/alinarus/MultimodalData/resolve/main/player/runtime/python/Lib/site-packages/rerun/components/interpolation_mode.py
- Command line
-
hf download hf://datasets/alinarus/MultimodalData/player/runtime/python/Lib/site-packages/rerun/components/interpolation_mode.py
-
curl -L -o interpolation_mode.py https://huggingface.co/datasets/alinarus/MultimodalData/resolve/main/player/runtime/python/Lib/site-packages/rerun/components/interpolation_mode.py
3.17 kB
| # DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs | |
| # Based on "crates/build/re_type_definitions/rerun/components/interpolation_mode.def.rs". | |
| # You can extend this class by creating a "InterpolationModeExt" class in "interpolation_mode_ext.py". | |
| from __future__ import annotations | |
| from collections.abc import Sequence | |
| from typing import Literal | |
| import pyarrow as pa | |
| from .._baseclasses import ( | |
| BaseBatch, | |
| ComponentBatchMixin, | |
| ) | |
| __all__ = ["InterpolationMode", "InterpolationModeArrayLike", "InterpolationModeBatch", "InterpolationModeLike"] | |
| from enum import Enum | |
| class InterpolationMode(Enum): | |
| """**Component**: Specifies how values between data points are interpolated in time series.""" | |
| Linear = 1 | |
| """Connect data points with straight line segments.""" | |
| StepAfter = 2 | |
| """ | |
| Hold the previous value until the next data point, then jump. | |
| The step occurs at the end of the interval. | |
| """ | |
| StepBefore = 3 | |
| """ | |
| Jump to the new value immediately, then hold until the next data point. | |
| The step occurs at the beginning of the interval. | |
| """ | |
| StepMid = 4 | |
| """ | |
| Hold the previous value until the midpoint between data points, then jump to the new value. | |
| The step occurs at the midpoint of the interval. | |
| """ | |
| def auto(cls, val: str | int | InterpolationMode) -> InterpolationMode: | |
| """Best-effort converter, including a case-insensitive string matcher.""" | |
| if isinstance(val, InterpolationMode): | |
| return val | |
| if isinstance(val, int): | |
| return cls(val) | |
| try: | |
| return cls[val] | |
| except KeyError: | |
| val_lower = val.lower() | |
| for variant in cls: | |
| if variant.name.lower() == val_lower: | |
| return variant | |
| raise ValueError(f"Cannot convert {val} to {cls.__name__}") | |
| def __str__(self) -> str: | |
| """Returns the variant name.""" | |
| return self.name | |
| InterpolationModeLike = ( | |
| InterpolationMode | |
| | Literal["Linear", "StepAfter", "StepBefore", "StepMid", "linear", "stepafter", "stepbefore", "stepmid"] | |
| | int | |
| ) | |
| """A type alias for any InterpolationMode-like object.""" | |
| InterpolationModeArrayLike = ( | |
| InterpolationMode | |
| | Literal["Linear", "StepAfter", "StepBefore", "StepMid", "linear", "stepafter", "stepbefore", "stepmid"] | |
| | int | |
| | Sequence[InterpolationModeLike] | |
| ) | |
| """A type alias for any InterpolationMode-like array object.""" | |
| class InterpolationModeBatch(BaseBatch[InterpolationModeArrayLike], ComponentBatchMixin): | |
| _ARROW_DATATYPE = pa.uint8() | |
| _COMPONENT_TYPE: str = "rerun.components.InterpolationMode" | |
| def _native_to_pa_array(data: InterpolationModeArrayLike, data_type: pa.DataType) -> pa.Array: | |
| items: Sequence[InterpolationModeLike | str] = ( | |
| [data] if isinstance(data, (InterpolationMode, int, str)) else data | |
| ) | |
| pa_data = [InterpolationMode.auto(v).value if v is not None else None for v in items] # type: ignore[redundant-expr] | |
| return pa.array(pa_data, type=data_type) | |