-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a release checklist for overrides, including VisualizerOverrides
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
tests/python/release_checklist/check_blueprint_overrides.py
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,71 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
from argparse import Namespace | ||
from uuid import uuid4 | ||
|
||
import rerun as rr | ||
import rerun.blueprint as rrb | ||
|
||
README = """\ | ||
# Blueprint overrides | ||
This checks that overrides work as expected when sent via blueprint APIs. | ||
Expected behavior: | ||
* The `sin` plot should be a blue line (set via defaults) | ||
* The `cos` plot should be a green points with cross markers (set via overrides) | ||
""" | ||
|
||
|
||
def log_readme() -> None: | ||
rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True) | ||
|
||
|
||
def log_plots() -> None: | ||
from math import cos, sin, tau | ||
|
||
for t in range(0, int(tau * 2 * 10.0)): | ||
rr.set_time_sequence("frame_nr", t) | ||
|
||
sin_of_t = sin(float(t) / 10.0) | ||
rr.log("plots/sin", rr.Scalar(sin_of_t)) | ||
|
||
cos_of_t = cos(float(t) / 10.0) | ||
rr.log("plots/cos", rr.Scalar(cos_of_t)) | ||
|
||
rr.send_blueprint( | ||
rrb.Blueprint( | ||
rrb.Grid( | ||
rrb.TextDocumentView(origin="readme", name="Instructions"), | ||
rrb.TimeSeriesView( | ||
name="Plots", | ||
defaults=[rr.components.Color([0, 0, 255])], | ||
overrides={ | ||
"plots/cos": [ | ||
rrb.VisualizerOverrides("SeriesPoint"), | ||
rr.components.Color([0, 255, 0]), | ||
# TODDO(#6670): This should just be rr.components.MarkerShape.Cross | ||
rr.components.MarkerShapeBatch("cross"), | ||
], | ||
}, | ||
), | ||
) | ||
) | ||
) | ||
|
||
|
||
def run(args: Namespace) -> None: | ||
rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) | ||
|
||
log_readme() | ||
log_plots() | ||
|
||
|
||
if __name__ == "__main__": | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description="Interactive release checklist") | ||
rr.script_add_args(parser) | ||
args = parser.parse_args() | ||
run(args) |