Skip to content

Commit 938bef0

Browse files
convert lxd like dataset without map available
1 parent dcefbff commit 938bef0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

omega_prime/converters/lxd.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import numpy as np
77
from lxd_io import Dataset
88
import polars as pl
9+
from warnings import warn
910

1011
vct = betterosi.MovingObjectVehicleClassificationType
1112
vehicles = {
@@ -125,4 +126,9 @@ def to_omega_prime_recording(self, recording) -> Recording:
125126
)
126127

127128
xodr_path = recording.opendrive_map_file
128-
return Recording(df=tracks, map=MapOdr.from_file(xodr_path), validate=False)
129+
if xodr_path is not None:
130+
map = MapOdr.from_file(xodr_path)
131+
else:
132+
map = None
133+
warn(f"No map associated with recording {recording}")
134+
return Recording(df=tracks, map=map, validate=False)

omega_prime/recording.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,9 @@ def plot_altair(
752752
*[
753753
o
754754
for o in [
755-
None if not plot_map else self.map.plot_altair(recording=self, plot_polys=plot_map_polys),
755+
None
756+
if not plot_map or self.map is None
757+
else self.map.plot_altair(recording=self, plot_polys=plot_map_polys),
756758
alt.Chart(mv_dict)
757759
.mark_geoshape()
758760
.encode(

0 commit comments

Comments
 (0)