-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fill out archetype docs: Transform3d, Pinhole, Scalar, TextEntry (#2473)
Simple first pass on adding python examples for archetypes: - [x] Transform3d - [x] Pinhole - [x] Scalar - [x] TextEntry --------- Co-authored-by: Jeremy Leibs <jeremy@rerun.io>
- Loading branch information
1 parent
0620a9b
commit 049bce2
Showing
8 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""Log a pinhole and a random image.""" | ||
import numpy as np | ||
import rerun as rr | ||
|
||
rr.init("pinhole", spawn=True) | ||
rng = np.random.default_rng(12345) | ||
|
||
image = rng.uniform(0, 255, size=[3, 3, 3]) | ||
intrinsics = np.array([[3, 0, 1.5], [0, 3, 1.5], [0, 0, 1]]) | ||
|
||
rr.log_pinhole("world/image", child_from_parent=intrinsics, width=3, height=3) | ||
rr.log_image("world/image", image=image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Log a scalar over time.""" | ||
import numpy as np | ||
import rerun as rr | ||
|
||
rr.init("scalar", spawn=True) | ||
rng = np.random.default_rng(12345) | ||
|
||
value = 1.0 | ||
for step in range(100): | ||
rr.set_time_sequence("step", step) | ||
|
||
value += rng.normal() | ||
rr.log_scalar("scalar", value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Log some text entries.""" | ||
import logging | ||
|
||
import rerun as rr | ||
|
||
rr.init("text_entry", spawn=True) | ||
|
||
# Log a direct entry directly | ||
rr.log_text_entry("logs", "this entry has loglevel TRACE", level=rr.LogLevel.TRACE) | ||
|
||
# Or log via a logging handler | ||
logging.getLogger().addHandler(rr.LoggingHandler("logs/handler")) | ||
logging.getLogger().setLevel(-1) | ||
logging.info("This log got added through a `LoggingHandler`") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Log different transforms between three arrows.""" | ||
import rerun as rr | ||
|
||
rr.init("transform", spawn=True) | ||
|
||
origin = [0, 0, 0] | ||
base_vector = [0, 1, 0] | ||
|
||
rr.log_arrow("base", origin=origin, vector=base_vector) | ||
|
||
rr.log_transform3d("base/translated", rr.Translation3D([1, 0, 0])) | ||
|
||
rr.log_arrow("base/translated", origin=origin, vector=base_vector) | ||
|
||
rr.log_transform3d( | ||
"base/rotated_scaled", | ||
rr.TranslationRotationScale3D(rotation=rr.RotationAxisAngle(axis=[0, 0, 1], radians=3.14 / 4), scale=rr.Scale3D(2)), | ||
) | ||
|
||
rr.log_arrow("base/rotated_scaled", origin=origin, vector=base_vector) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters