libxrk 0.7.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {libxrk-0.7.0 → libxrk-0.8.0}/PKG-INFO +1 -1
- {libxrk-0.7.0 → libxrk-0.8.0}/pyproject.toml +7 -2
- {libxrk-0.7.0 → libxrk-0.8.0}/src/libxrk/aim_xrk.pyx +38 -32
- {libxrk-0.7.0 → libxrk-0.8.0}/LICENSE +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/README.md +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/cython_build.py +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/src/libxrk/CLAUDE.md +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/src/libxrk/__init__.py +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/src/libxrk/aim_xrk.pyi +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/src/libxrk/base.py +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/src/libxrk/gps.py +0 -0
- {libxrk-0.7.0 → libxrk-0.8.0}/src/libxrk/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "libxrk"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.8.0"
|
|
4
4
|
description = "Library for reading AIM XRK files from AIM automotive data loggers"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Christopher Dewan",email = "chris.dewan@m3rlin.net"}
|
|
@@ -114,11 +114,12 @@ warn_unused_ignores = true
|
|
|
114
114
|
warn_no_return = true
|
|
115
115
|
strict_optional = true
|
|
116
116
|
|
|
117
|
-
# Exclude build artifacts and
|
|
117
|
+
# Exclude build artifacts, Cython files, and DLL comparison test utilities
|
|
118
118
|
exclude = [
|
|
119
119
|
"^build/",
|
|
120
120
|
"^dist/",
|
|
121
121
|
"\\.pyx$",
|
|
122
|
+
"^tests/reference_dll/",
|
|
122
123
|
]
|
|
123
124
|
|
|
124
125
|
[[tool.mypy.overrides]]
|
|
@@ -141,6 +142,10 @@ ignore_missing_imports = true
|
|
|
141
142
|
module = "parameterized.*"
|
|
142
143
|
ignore_missing_imports = true
|
|
143
144
|
|
|
145
|
+
[[tool.mypy.overrides]]
|
|
146
|
+
module = "aim_dll_wrapper"
|
|
147
|
+
ignore_missing_imports = true
|
|
148
|
+
|
|
144
149
|
[tool.poe.tasks]
|
|
145
150
|
format = "black ."
|
|
146
151
|
lint = "black --check ."
|
|
@@ -128,7 +128,7 @@ _logger_models = {
|
|
|
128
128
|
|
|
129
129
|
_unit_map = {
|
|
130
130
|
1: ('%', 2),
|
|
131
|
-
3: ('
|
|
131
|
+
3: ('g', 2),
|
|
132
132
|
4: ('deg', 1),
|
|
133
133
|
5: ('deg/s', 1),
|
|
134
134
|
6: ('', 0), # number
|
|
@@ -767,10 +767,33 @@ def _get_laps(lat_ch, lon_ch, msg_by_type, time_offset, last_time):
|
|
|
767
767
|
lap_nums = []
|
|
768
768
|
start_times = []
|
|
769
769
|
end_times = []
|
|
770
|
-
|
|
771
|
-
if lat_ch and lon_ch:
|
|
772
|
-
# If we have GPS, do gps lap insert.
|
|
773
770
|
|
|
771
|
+
# Prefer LAP messages when available (matches official DLL behavior)
|
|
772
|
+
if _tokdec('LAP') in msg_by_type:
|
|
773
|
+
for m in msg_by_type[_tokdec('LAP')]:
|
|
774
|
+
# 2nd byte is segment #, see M4GT4
|
|
775
|
+
segment, lap, duration, end_time = struct.unpack('xBHIxxxxxxxxI', m.content)
|
|
776
|
+
end_time -= time_offset
|
|
777
|
+
if segment:
|
|
778
|
+
continue
|
|
779
|
+
elif not lap_nums:
|
|
780
|
+
pass
|
|
781
|
+
elif lap_nums[-1] == lap:
|
|
782
|
+
continue
|
|
783
|
+
elif lap_nums[-1] + 1 == lap:
|
|
784
|
+
pass
|
|
785
|
+
elif lap_nums[-1] + 2 == lap:
|
|
786
|
+
# emit inferred lap
|
|
787
|
+
lap_nums.append(lap - 1)
|
|
788
|
+
start_times.append(end_times[-1])
|
|
789
|
+
end_times.append(end_time - duration)
|
|
790
|
+
else:
|
|
791
|
+
assert False, 'Lap gap from %d to %d' % (lap_nums[-1], lap)
|
|
792
|
+
lap_nums.append(lap)
|
|
793
|
+
start_times.append(end_time - duration)
|
|
794
|
+
end_times.append(end_time)
|
|
795
|
+
elif lat_ch and lon_ch:
|
|
796
|
+
# Fall back to GPS-based lap detection only when no LAP messages exist
|
|
774
797
|
track = msg_by_type[_tokdec('TRK')][-1].content
|
|
775
798
|
XYZ = np.column_stack(gps.lla2ecef(np.array(lat_ch.sampledata),
|
|
776
799
|
np.array(lon_ch.sampledata), 0))
|
|
@@ -781,38 +804,21 @@ def _get_laps(lat_ch, lon_ch, msg_by_type, time_offset, last_time):
|
|
|
781
804
|
# Use GPS channel's last timecode as session end (already adjusted)
|
|
782
805
|
# This avoids relying on last_time which may be 0 when no LAP messages exist
|
|
783
806
|
session_end = int(lat_ch.timecodes[-1]) if len(lat_ch.timecodes) else (last_time - time_offset if last_time else 0)
|
|
784
|
-
lap_markers = [0] + lap_markers + [session_end]
|
|
785
807
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
# otherwise, use the lap data provided.
|
|
792
|
-
if _tokdec('LAP') in msg_by_type:
|
|
793
|
-
for m in msg_by_type[_tokdec('LAP')]:
|
|
794
|
-
# 2nd byte is segment #, see M4GT4
|
|
795
|
-
segment, lap, duration, end_time = struct.unpack('xBHIxxxxxxxxI', m.content)
|
|
796
|
-
end_time -= time_offset
|
|
797
|
-
if segment:
|
|
798
|
-
continue
|
|
799
|
-
elif not lap_nums:
|
|
800
|
-
pass
|
|
801
|
-
elif lap_nums[-1] == lap:
|
|
802
|
-
continue
|
|
803
|
-
elif lap_nums[-1] + 1 == lap:
|
|
804
|
-
pass
|
|
805
|
-
elif lap_nums[-1] + 2 == lap:
|
|
806
|
-
# emit inferred lap
|
|
807
|
-
lap_nums.append(lap - 1)
|
|
808
|
-
start_times.append(end_times[-1])
|
|
809
|
-
end_times.append(end_time - duration)
|
|
810
|
-
else:
|
|
811
|
-
assert False, 'Lap gap from %d to %d' % (lap_nums[-1], lap)
|
|
808
|
+
# Only add session boundaries if we have detected lap crossings
|
|
809
|
+
# This creates laps from each crossing to the next
|
|
810
|
+
if lap_markers:
|
|
811
|
+
lap_markers = [0] + lap_markers + [session_end]
|
|
812
|
+
for lap, (start_time, end_time) in enumerate(zip(lap_markers[:-1], lap_markers[1:])):
|
|
812
813
|
lap_nums.append(lap)
|
|
813
|
-
start_times.append(
|
|
814
|
+
start_times.append(start_time)
|
|
814
815
|
end_times.append(end_time)
|
|
815
816
|
|
|
817
|
+
# Normalize lap numbers to 0-based indexing (matches DLL behavior)
|
|
818
|
+
if lap_nums:
|
|
819
|
+
min_lap = min(lap_nums)
|
|
820
|
+
lap_nums = [n - min_lap for n in lap_nums]
|
|
821
|
+
|
|
816
822
|
# Create PyArrow table
|
|
817
823
|
return pa.table({
|
|
818
824
|
'num': pa.array(lap_nums, type=pa.int32()),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|