Download Utils/data_processing/common/paths.py from vLAR/PhysInOne: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/datasets/vLAR/PhysInOne/resolve/main/Utils/data_processing/common/paths.py
- Command line
-
hf download hf://datasets/vLAR/PhysInOne/Utils/data_processing/common/paths.py
-
curl -L -o paths.py https://huggingface.co/datasets/vLAR/PhysInOne/resolve/main/Utils/data_processing/common/paths.py
1.72 kB
| """Path helpers for the public PhysInOne camera and rendering tools.""" | |
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| import re | |
| SCENE_PATTERN = re.compile( | |
| r"^/Game/PhysInOne/Scenes/(?P<split>Train|Val|Test)/" | |
| r"(?P<physics>SinglePhysics|DoublePhysics|TriplePhysics)/" | |
| r"(?P<scene>[^./]+)(?:\.(?P=scene))?$" | |
| ) | |
| class ScenePaths: | |
| split: str | |
| physics: str | |
| scene: str | |
| level_asset: str | |
| sequence_asset: str | |
| def render_directory(self, project_root: str | Path) -> Path: | |
| return ( | |
| Path(project_root) | |
| / "Rendered" | |
| / "Videos" | |
| / self.split | |
| / self.physics | |
| / f"{self.scene}_trajectory" | |
| ) | |
| def parse_scene_path(level_path: str) -> ScenePaths: | |
| """Parse a canonical PhysInOne UE level path. | |
| Accepted form: | |
| /Game/PhysInOne/Scenes/<Split>/<Physics>/<Scene>[.<Scene>] | |
| """ | |
| normalized = level_path.strip().replace("\\", "/") | |
| match = SCENE_PATTERN.fullmatch(normalized) | |
| if not match: | |
| raise ValueError( | |
| "Expected /Game/PhysInOne/Scenes/<Train|Val|Test>/" | |
| "<SinglePhysics|DoublePhysics|TriplePhysics>/<Scene>[.<Scene>], " | |
| f"got: {level_path!r}" | |
| ) | |
| split = match.group("split") | |
| physics = match.group("physics") | |
| scene = match.group("scene") | |
| base = f"/Game/PhysInOne" | |
| level_asset = f"{base}/Scenes/{split}/{physics}/{scene}.{scene}" | |
| sequence = f"{scene}_trajectory" | |
| sequence_asset = ( | |
| f"{base}/Trajectories/{split}/{physics}/{sequence}.{sequence}" | |
| ) | |
| return ScenePaths(split, physics, scene, level_asset, sequence_asset) | |