Skip to content

Commit 1b60382

Browse files
authored
Merge pull request #96 from Ipuch/mumu
fix: axis length of frames when using chunk view & feat: Yup by default. tests: no viz on CI pyorerun headless
2 parents cb89ca2 + 08248a5 commit 1b60382

File tree

5 files changed

+45
-7
lines changed

5 files changed

+45
-7
lines changed

.github/workflows/run_tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939

4040
- name: Run the actual tests
4141
run: pytest -v --color=yes --cov-report term-missing --cov=pyorerun tests
42+
env:
43+
PYORERUN_HEADLESS: "1"
4244

4345
- name: Upload coverage to Codecov
4446
run: codecov

pyorerun/model_components/local_frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def initialize(self):
2828
rr.Transform3D(
2929
translation=np.zeros(3),
3030
mat3x3=np.eye(3),
31+
axis_length=1,
3132
),
3233
)
3334

pyorerun/multi_frame_rate_phase_rerun.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import numpy as np
24
import rerun as rr
35

@@ -81,7 +83,8 @@ def rerun_by_frame(
8183
return
8284

8385
if init:
84-
rr.init(f"{name}_{0}", spawn=True if not notebook else False)
86+
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
87+
rr.init(f"{name}_{0}", spawn=spawn)
8588

8689
for phase_rerun in self.phase_reruns:
8790
frame = 0
@@ -115,7 +118,8 @@ def rerun(
115118
return
116119

117120
if init:
118-
rr.init(f"{name}_{0}", spawn=True if not notebook else False)
121+
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
122+
rr.init(f"{name}_{0}", spawn=spawn)
119123

120124
for phase_rerun in self.phase_reruns:
121125
frame = 0

pyorerun/multi_phase_rerun.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import numpy as np
24
import rerun as rr # NOTE: `rerun`, not `rerun-sdk`!
35
import rerun.blueprint as rrb
@@ -82,7 +84,8 @@ def all_windows(self) -> list[str]:
8284
return [windows for phase in self.rerun_biorbd_phases for windows in phase.keys()]
8385

8486
def rerun_by_frame(self, server_name: str = "multi_phase_animation", notebook=False) -> None:
85-
rr.init(server_name, spawn=True if not notebook else False)
87+
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
88+
rr.init(server_name, spawn=spawn)
8689
for i, phase in enumerate(self.rerun_biorbd_phases):
8790
for j, (window, rr_phase) in enumerate(phase.items()):
8891

@@ -95,7 +98,8 @@ def rerun_by_frame(self, server_name: str = "multi_phase_animation", notebook=Fa
9598
rr_phase.rerun_by_frame(init=False, clear_last_node=more_phases_after_this_one)
9699

97100
def rerun(self, server_name: str = "multi_phase_animation", notebook=False) -> None:
98-
rr.init(server_name, spawn=True if not notebook else False)
101+
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
102+
rr.init(server_name, spawn=spawn)
99103
for i, phase in enumerate(self.rerun_biorbd_phases):
100104
for j, (window, rr_phase) in enumerate(phase.items()):
101105

pyorerun/phase_rerun.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import os
2+
13
import numpy as np
24
import rerun as rr
5+
import rerun.blueprint as rrb
6+
37
from .pyomarkers import PyoMarkers
48
from .pyoemg import PyoMuscles
59

@@ -8,7 +12,7 @@
812
from .model_phase import ModelRerunPhase
913
from .timeless import Gravity, Floor, ForcePlate
1014
from .timeless_components import TimelessRerunPhase
11-
from .xp_components import MarkersXp, TimeSeriesQ, ForceVector, Video, VectorXp, PersistentMarkerOptions
15+
from .xp_components import MarkersXp, TimeSeriesQ, ForceVector, Video, VectorXp
1216
from .xp_phase import XpRerunPhase
1317
from .utils.markers_utils import check_and_adjust_markers
1418

@@ -237,7 +241,19 @@ def rerun_by_frame(
237241
self, name: str = "animation_phase", init: bool = True, clear_last_node: bool = False, notebook: bool = False
238242
) -> None:
239243
if init:
240-
rr.init(f"{name}_{self.phase}", spawn=True if not notebook else False)
244+
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
245+
rr.init(f"{name}_{self.phase}", spawn=spawn)
246+
rr.init(f"{name}_{self.phase}", spawn=spawn)
247+
rr.log("/", rr.ViewCoordinates.RIGHT_HAND_Y_UP, static=True)
248+
rr.send_blueprint(
249+
rrb.Blueprint(
250+
rrb.Spatial3DView(
251+
name="",
252+
origin=f"/",
253+
eye_controls=rrb.archetypes.EyeControls3D(eye_up=[0, 1, 0]), # Y-axis as up
254+
)
255+
)
256+
)
241257

242258
frame = 0
243259
rr.set_time("stable_time", duration=self.t_span[frame])
@@ -262,7 +278,18 @@ def rerun(
262278
self, name: str = "animation_phase", init: bool = True, clear_last_node: bool = False, notebook: bool = False
263279
) -> None:
264280
if init:
265-
rr.init(f"{name}_{self.phase}", spawn=True if not notebook else False)
281+
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
282+
rr.init(f"{name}_{self.phase}", spawn=spawn)
283+
rr.log("/", rr.ViewCoordinates.RIGHT_HAND_Y_UP, static=True)
284+
rr.send_blueprint(
285+
rrb.Blueprint(
286+
rrb.Spatial3DView(
287+
name="",
288+
origin=f"/",
289+
eye_controls=rrb.archetypes.EyeControls3D(eye_up=[0, 1, 0]), # Y-axis as up
290+
)
291+
)
292+
)
266293

267294
frame = 0
268295
rr.set_time("stable_time", duration=self.t_span[frame])

0 commit comments

Comments
 (0)