Skip to content

Commit

Permalink
add roundtrip tests for Python
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jul 21, 2023
1 parent 1b3fb89 commit bfe850d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/python/roundtrips/points2d/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Logs a `Points2D` archetype for roundtrip checks."""

#!/usr/bin/env python3

"""Logs a `Points2D` archetype for roundtrip checks."""

from __future__ import annotations

import argparse
Expand Down
53 changes: 53 additions & 0 deletions tests/python/roundtrips/points3d/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python3

"""Logs a `Points3D` archetype for roundtrip checks."""

from __future__ import annotations

import argparse

import numpy as np
import rerun as rr
import rerun.experimental as rr_exp


def main() -> None:
points = np.array([1, 2, 3, 4, 5, 6], dtype=np.float32)
radii = np.array([0.42, 0.43], dtype=np.float32)
colors = np.array(
[
0xAA0000CC,
0x00BB00DD,
],
dtype=np.uint32,
)
labels = ["hello", "friend"]
draw_order = 300
class_ids = np.array([126, 127], dtype=np.uint64)
keypoint_ids = np.array([2, 3], dtype=np.uint64)
instance_keys = np.array([66, 666], dtype=np.uint64)

points3d = rr_exp.Points3D(
points,
radii=radii,
colors=colors,
labels=labels,
draw_order=draw_order,
class_ids=class_ids,
keypoint_ids=keypoint_ids,
instance_keys=instance_keys,
)

parser = argparse.ArgumentParser(description="Logs rich data using the Rerun SDK.")
rr.script_add_args(parser)
args = parser.parse_args()

rr.script_setup(args, "roundtrip_points3d")

rr_exp.log_any("points3d", points3d)

rr.script_teardown(args)


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions tests/python/roundtrips/transform3d/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Logs a `Transform3D` archetype for roundtrip checks."""

#!/usr/bin/env python3

"""Logs a `Transform3D` archetype for roundtrip checks."""

from __future__ import annotations

import argparse
Expand Down

0 comments on commit bfe850d

Please sign in to comment.