Skip to content

Commit

Permalink
use new Point2D component all the way through for Python stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jul 21, 2023
1 parent 38c85b9 commit b3ba377
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 114 deletions.
114 changes: 30 additions & 84 deletions crates/re_arrow_store/tests/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ fn all_components() {
];

let components_b = &[
ColorRGBA::name(), // added by test, timeless
Point2D::name(), // added by test
Rect2D::name(), // added by test
cluster_key, // always here
ColorRGBA::name(), // added by test, timeless
Point2D::name(), // added by test
Rect2D::name(), // added by test
cluster_key, // always here
];

let row = test_row!(ent_path @ [] => 2; [build_some_colors(2)]);
Expand Down Expand Up @@ -148,10 +148,10 @@ fn all_components() {
];

let components_b = &[
ColorRGBA::name(), // added by test, timeless
Rect2D::name(), // ⚠ inherited before the buckets got split apart!
Point2D::name(), // added by test
cluster_key, // always here
ColorRGBA::name(), // added by test, timeless
Rect2D::name(), // ⚠ inherited before the buckets got split apart!
Point2D::name(), // added by test
cluster_key, // always here
];

let row = test_row!(ent_path @ [] => 2; [build_some_colors(2)]);
Expand Down Expand Up @@ -209,10 +209,10 @@ fn all_components() {
];

let components_b = &[
ColorRGBA::name(), // added by test, timeless
Point2D::name(), // added by test but not contained in the second bucket
Rect2D::name(), // added by test
cluster_key, // always here
ColorRGBA::name(), // added by test, timeless
Point2D::name(), // added by test but not contained in the second bucket
Rect2D::name(), // added by test
cluster_key, // always here
];

let row = test_row!(ent_path @ [] => 2; [build_some_colors(2)]);
Expand Down Expand Up @@ -511,10 +511,7 @@ fn range_impl(store: &mut DataStore) {
&[
(
Some(frame0),
&[
(ColorRGBA::name(), &row4_3),
(Point2D::name(), &row4_4),
],
&[(ColorRGBA::name(), &row4_3), (Point2D::name(), &row4_4)],
), // timeless
(
Some(frame1),
Expand Down Expand Up @@ -566,10 +563,7 @@ fn range_impl(store: &mut DataStore) {
),
(
Some(frame4),
&[
(ColorRGBA::name(), &row4_3),
(Point2D::name(), &row4_25),
], // !!!
&[(ColorRGBA::name(), &row4_3), (Point2D::name(), &row4_25)], // !!!
),
],
);
Expand All @@ -579,10 +573,7 @@ fn range_impl(store: &mut DataStore) {
&[
(
Some(frame4),
&[
(ColorRGBA::name(), &row4_3),
(Point2D::name(), &row4_4),
], // !!!
&[(ColorRGBA::name(), &row4_3), (Point2D::name(), &row4_4)], // !!!
), //
],
);
Expand All @@ -595,10 +586,7 @@ fn range_impl(store: &mut DataStore) {
&[
(
Some(frame0),
&[
(Point2D::name(), &row4_4),
(ColorRGBA::name(), &row4_3),
],
&[(Point2D::name(), &row4_4), (ColorRGBA::name(), &row4_3)],
), // timeless
],
);
Expand Down Expand Up @@ -643,17 +631,11 @@ fn range_impl(store: &mut DataStore) {
),
(
Some(frame4),
&[
(Point2D::name(), &row4_25),
(ColorRGBA::name(), &row4_2),
],
&[(Point2D::name(), &row4_25), (ColorRGBA::name(), &row4_2)],
),
(
Some(frame4),
&[
(Point2D::name(), &row4_4),
(ColorRGBA::name(), &row4_3),
],
&[(Point2D::name(), &row4_4), (ColorRGBA::name(), &row4_3)],
),
],
);
Expand All @@ -663,10 +645,7 @@ fn range_impl(store: &mut DataStore) {
&[
(
Some(frame4),
&[
(Point2D::name(), &row4_4),
(ColorRGBA::name(), &row4_3),
],
&[(Point2D::name(), &row4_4), (ColorRGBA::name(), &row4_3)],
), //
],
);
Expand All @@ -679,10 +658,7 @@ fn range_impl(store: &mut DataStore) {
&[
(
Some(frame0),
&[
(ColorRGBA::name(), &row4_3),
(Point2D::name(), &row4_4),
],
&[(ColorRGBA::name(), &row4_3), (Point2D::name(), &row4_4)],
), // timeless
(
Some(frame1),
Expand All @@ -701,10 +677,7 @@ fn range_impl(store: &mut DataStore) {
),
(
Some(frame4),
&[
(ColorRGBA::name(), &row4_3),
(Point2D::name(), &row4_25),
], // !!!
&[(ColorRGBA::name(), &row4_3), (Point2D::name(), &row4_25)], // !!!
),
],
);
Expand All @@ -717,10 +690,7 @@ fn range_impl(store: &mut DataStore) {
&[
(
Some(frame0),
&[
(Point2D::name(), &row4_4),
(ColorRGBA::name(), &row4_3),
],
&[(Point2D::name(), &row4_4), (ColorRGBA::name(), &row4_3)],
), // timeless
(
Some(frame2),
Expand All @@ -732,17 +702,11 @@ fn range_impl(store: &mut DataStore) {
),
(
Some(frame4),
&[
(Point2D::name(), &row4_25),
(ColorRGBA::name(), &row4_2),
],
&[(Point2D::name(), &row4_25), (ColorRGBA::name(), &row4_2)],
),
(
Some(frame4),
&[
(Point2D::name(), &row4_4),
(ColorRGBA::name(), &row4_3),
],
&[(Point2D::name(), &row4_4), (ColorRGBA::name(), &row4_3)],
),
],
);
Expand All @@ -764,10 +728,7 @@ fn range_impl(store: &mut DataStore) {
),
(
None,
&[
(ColorRGBA::name(), &row4_3),
(Point2D::name(), &row4_25),
], // !!!
&[(ColorRGBA::name(), &row4_3), (Point2D::name(), &row4_25)], // !!!
),
(
Some(frame1),
Expand All @@ -786,10 +747,7 @@ fn range_impl(store: &mut DataStore) {
),
(
Some(frame4),
&[
(ColorRGBA::name(), &row4_3),
(Point2D::name(), &row4_25),
], // !!!
&[(ColorRGBA::name(), &row4_3), (Point2D::name(), &row4_25)], // !!!
),
],
);
Expand All @@ -810,17 +768,11 @@ fn range_impl(store: &mut DataStore) {
),
(
None,
&[
(Point2D::name(), &row4_25),
(ColorRGBA::name(), &row4_2),
],
&[(Point2D::name(), &row4_25), (ColorRGBA::name(), &row4_2)],
),
(
None,
&[
(Point2D::name(), &row4_4),
(ColorRGBA::name(), &row4_3),
],
&[(Point2D::name(), &row4_4), (ColorRGBA::name(), &row4_3)],
),
(
Some(frame2),
Expand All @@ -832,17 +784,11 @@ fn range_impl(store: &mut DataStore) {
),
(
Some(frame4),
&[
(Point2D::name(), &row4_25),
(ColorRGBA::name(), &row4_2),
],
&[(Point2D::name(), &row4_25), (ColorRGBA::name(), &row4_2)],
),
(
Some(frame4),
&[
(Point2D::name(), &row4_4),
(ColorRGBA::name(), &row4_3),
],
&[(Point2D::name(), &row4_4), (ColorRGBA::name(), &row4_3)],
),
],
);
Expand Down
15 changes: 12 additions & 3 deletions crates/re_components/tests/data_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ fn data_table_sizes_basics() {
5_260_064, // expected_num_bytes
);
expect(
DataCell::from_arrow(re_components::LegacyPoint2D::name(), cell.to_arrow().sliced(1, 1)),
DataCell::from_arrow(
re_components::LegacyPoint2D::name(),
cell.to_arrow().sliced(1, 1),
),
10_000, // num_rows
5_100_064, // expected_num_bytes
);
Expand All @@ -120,7 +123,10 @@ fn data_table_sizes_basics() {
4_080_064, // expected_num_bytes
);
expect(
DataCell::from_arrow(re_components::LegacyPoint2D::name(), cell.to_arrow().sliced(1, 1)),
DataCell::from_arrow(
re_components::LegacyPoint2D::name(),
cell.to_arrow().sliced(1, 1),
),
10_000, // num_rows
3_920_064, // expected_num_bytes
);
Expand All @@ -141,7 +147,10 @@ fn data_table_sizes_basics() {
6_120_064, // expected_num_bytes
);
expect(
DataCell::from_arrow(re_components::LegacyPoint2D::name(), cell.to_arrow().sliced(1, 1)),
DataCell::from_arrow(
re_components::LegacyPoint2D::name(),
cell.to_arrow().sliced(1, 1),
),
10_000, // num_rows
5_560_064, // expected_num_bytes
);
Expand Down
10 changes: 6 additions & 4 deletions crates/re_query/tests/visit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,12 @@ fn joint_visit() {
let mut colors_out = Vec::<Option<ColorRGBA>>::new();

entity_view
.visit2(|_: InstanceKey, point: LegacyPoint2D, color: Option<ColorRGBA>| {
points_out.push(point);
colors_out.push(color);
})
.visit2(
|_: InstanceKey, point: LegacyPoint2D, color: Option<ColorRGBA>| {
points_out.push(point);
colors_out.push(color);
},
)
.ok()
.unwrap();

Expand Down
4 changes: 2 additions & 2 deletions rerun_py/rerun_sdk/rerun/_rerun2/datatypes/fuzzy.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def _native_to_pa_array(data: AffixFuzzer2ArrayLike, data_type: pa.DataType) ->

@define
class AffixFuzzer3:
inner: Union[float, list[datatypes.AffixFuzzer1], npt.NDArray[np.float32]] = field()
inner: float | list[datatypes.AffixFuzzer1] | npt.NDArray[np.float32] = field()
"""
degrees (float):
Expand Down Expand Up @@ -323,7 +323,7 @@ def _native_to_pa_array(data: AffixFuzzer3ArrayLike, data_type: pa.DataType) ->

@define
class AffixFuzzer4:
inner: Union[datatypes.AffixFuzzer3, list[datatypes.AffixFuzzer3]] = field()
inner: datatypes.AffixFuzzer3 | list[datatypes.AffixFuzzer3] = field()
"""
single_required (datatypes.AffixFuzzer3):
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class Rotation3D:
"""A 3D rotation."""

inner: Union[datatypes.Quaternion, datatypes.RotationAxisAngle] = field(converter=rotation3d_inner_converter)
inner: datatypes.Quaternion | datatypes.RotationAxisAngle = field(converter=rotation3d_inner_converter)
"""
Quaternion (datatypes.Quaternion):
Rotation defined by a quaternion.
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Scale3D:
```
"""

inner: Union[datatypes.Vec3D, float] = field(converter=scale3d_inner_converter)
inner: datatypes.Vec3D | float = field(converter=scale3d_inner_converter)
"""
ThreeD (datatypes.Vec3D):
Individual scaling factors for each axis, distorting the original object.
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class Transform3D:
"""Representation of a 3D affine transform."""

inner: Union[datatypes.TranslationAndMat3x3, datatypes.TranslationRotationScale3D] = field()
inner: datatypes.TranslationAndMat3x3 | datatypes.TranslationRotationScale3D = field()
"""
TranslationAndMat3x3 (datatypes.TranslationAndMat3x3):
Expand Down
Loading

0 comments on commit b3ba377

Please sign in to comment.