Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:

- name: Run the actual tests
run: pytest -v --color=yes --cov-report term-missing --cov=pyorerun tests
env:
PYORERUN_HEADLESS: "1"

- name: Upload coverage to Codecov
run: codecov
Expand Down
1 change: 1 addition & 0 deletions pyorerun/model_components/local_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def initialize(self):
rr.Transform3D(
translation=np.zeros(3),
mat3x3=np.eye(3),
axis_length=1,
),
)

Expand Down
8 changes: 6 additions & 2 deletions pyorerun/multi_frame_rate_phase_rerun.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import numpy as np
import rerun as rr

Expand Down Expand Up @@ -81,7 +83,8 @@ def rerun_by_frame(
return

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

for phase_rerun in self.phase_reruns:
frame = 0
Expand Down Expand Up @@ -115,7 +118,8 @@ def rerun(
return

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

for phase_rerun in self.phase_reruns:
frame = 0
Expand Down
8 changes: 6 additions & 2 deletions pyorerun/multi_phase_rerun.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import numpy as np
import rerun as rr # NOTE: `rerun`, not `rerun-sdk`!
import rerun.blueprint as rrb
Expand Down Expand Up @@ -82,7 +84,8 @@ def all_windows(self) -> list[str]:
return [windows for phase in self.rerun_biorbd_phases for windows in phase.keys()]

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

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

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

Expand Down
33 changes: 30 additions & 3 deletions pyorerun/phase_rerun.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import os

import numpy as np
import rerun as rr
import rerun.blueprint as rrb

from .pyomarkers import PyoMarkers
from .pyoemg import PyoMuscles

Expand All @@ -8,7 +12,7 @@
from .model_phase import ModelRerunPhase
from .timeless import Gravity, Floor, ForcePlate
from .timeless_components import TimelessRerunPhase
from .xp_components import MarkersXp, TimeSeriesQ, ForceVector, Video, VectorXp, PersistentMarkerOptions
from .xp_components import MarkersXp, TimeSeriesQ, ForceVector, Video, VectorXp
from .xp_phase import XpRerunPhase
from .utils.markers_utils import check_and_adjust_markers

Expand Down Expand Up @@ -237,7 +241,19 @@ def rerun_by_frame(
self, name: str = "animation_phase", init: bool = True, clear_last_node: bool = False, notebook: bool = False
) -> None:
if init:
rr.init(f"{name}_{self.phase}", spawn=True if not notebook else False)
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
rr.init(f"{name}_{self.phase}", spawn=spawn)
rr.init(f"{name}_{self.phase}", spawn=spawn)
rr.log("/", rr.ViewCoordinates.RIGHT_HAND_Y_UP, static=True)
rr.send_blueprint(
rrb.Blueprint(
rrb.Spatial3DView(
name="",
origin=f"/",
eye_controls=rrb.archetypes.EyeControls3D(eye_up=[0, 1, 0]), # Y-axis as up
)
)
)

frame = 0
rr.set_time("stable_time", duration=self.t_span[frame])
Expand All @@ -262,7 +278,18 @@ def rerun(
self, name: str = "animation_phase", init: bool = True, clear_last_node: bool = False, notebook: bool = False
) -> None:
if init:
rr.init(f"{name}_{self.phase}", spawn=True if not notebook else False)
spawn = not notebook and os.environ.get("PYORERUN_HEADLESS", "0").lower() not in ("1", "true", "yes")
rr.init(f"{name}_{self.phase}", spawn=spawn)
rr.log("/", rr.ViewCoordinates.RIGHT_HAND_Y_UP, static=True)
rr.send_blueprint(
rrb.Blueprint(
rrb.Spatial3DView(
name="",
origin=f"/",
eye_controls=rrb.archetypes.EyeControls3D(eye_up=[0, 1, 0]), # Y-axis as up
)
)
)

frame = 0
rr.set_time("stable_time", duration=self.t_span[frame])
Expand Down
Loading