Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
robotics
embodied-ai
human-demonstration
egocentric-video
bimanual-manipulation
tactile-sensing
License:
File size: 3,170 Bytes
9ff4bea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | # 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.
"""
@classmethod
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"
@staticmethod
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)
|