@@ -105,13 +105,15 @@ class _JointMotionProfile:
105105def _joint_motion_profile (
106106 episode : Episode , topic : str , field : str | None
107107) -> _JointMotionProfile | None :
108- """``None`` when the channel has fewer than two messages ( no motion to
109- profile) ; callers record the message count and stop."""
108+ """``None`` when there are fewer than two messages or no selected
109+ components ; callers record the message count and stop."""
110110 channel = episode .channel (topic )
111111 stamps_ns = channel .timestamps
112112 if len (stamps_ns ) < 2 :
113113 return None
114114 positions = channel .to_numpy (field )
115+ if positions .size == 0 :
116+ return None
115117 if positions .ndim == 1 :
116118 positions = positions [:, np .newaxis ]
117119 deltas_s = np .diff (stamps_ns ) / 1e9
@@ -437,7 +439,8 @@ async def joint_discontinuity(
437439 them dilute the percentage denominator) fails the gate open (#546).
438440 Every percentage and maximum here covers measurable steps only, and a
439441 stream with nothing measurable reports its counts and withholds the
440- verdict-shaped keys rather than emitting 0% or NaN.
442+ verdict-shaped keys rather than emitting 0% or NaN. An empty selected
443+ field records only ``velocity_sample_count``, without motion evidence.
441444 """
442445 return await run_blocking (
443446 _measure_joint_discontinuity ,
@@ -812,7 +815,8 @@ async def idle_fraction(
812815 numerator nor the denominator: they had no velocity to be idle under, and
813816 counting their time as "moving" understates the fraction (#546). A stream
814817 with nothing measurable reports its counts and withholds
815- ``idle_fraction`` rather than storing 0.0 for a dead channel.
818+ ``idle_fraction`` rather than storing 0.0 for a dead channel. An empty
819+ selected field records only ``idle_sample_count``.
816820 """
817821 return await run_blocking (
818822 _measure_idle_fraction ,
@@ -1373,7 +1377,8 @@ async def trajectory_metrics(
13731377 ratio is undefined (zero denominator), so only ``{topic}/final_pose_speed``
13741378 appears. Curation queries joining on ``final_pose_unsettled_ratio`` will
13751379 silently exclude motionless episodes; use ``final_pose_speed`` when you need
1376- all episodes regardless of mean motion.
1380+ all episodes regardless of mean motion. An empty selected field records
1381+ only ``trajectory_sample_count``; it is not a stationary trajectory.
13771382
13781383 Evidence only, and this one ships no recommended gate at all: these are
13791384 motion-smoothness metrics, which are known to invert on real defects
@@ -1485,7 +1490,8 @@ async def trajectory_segments(
14851490 episode compare", this one answers "when, inside it, did things happen".
14861491 Emits ``motionless:<topic>``, ``trajectory_change:<topic>``, and
14871492 ``peak_velocity:<topic>`` intervals in log time, which is what a timeline
1488- view renders and what an operator scrubs to.
1493+ view renders and what an operator scrubs to. An empty selected field
1494+ records only ``segment_sample_count`` and produces no intervals.
14891495
14901496 The change threshold is derived from the episode's own curvature
14911497 distribution -- a duration-weighted median plus two robust sigmas, sigma
@@ -1779,7 +1785,8 @@ async def action_integrity(
17791785 runs this looks for, and NaN != NaN correctly breaks a run rather than
17801786 extending it. Run this on raw channels only -- a resampled channel carrying
17811787 a hold policy manufactures exactly-repeated samples, which is a fabricated
1782- frozen run rather than a recorded one.
1788+ frozen run rather than a recorded one. An empty selected field records
1789+ only ``integrity_sample_count``; absent components are not frozen values.
17831790 """
17841791 return await run_blocking (
17851792 _measure_action_integrity ,
@@ -1805,6 +1812,8 @@ def _measure_action_integrity(
18051812 return CheckResult (measurements = {f"{ topic } /integrity_sample_count" : len (stamps_ns )})
18061813
18071814 samples = channel .to_numpy (field )
1815+ if samples .size == 0 :
1816+ return CheckResult (measurements = {f"{ topic } /integrity_sample_count" : len (stamps_ns )})
18081817 if samples .ndim == 1 :
18091818 samples = samples [:, np .newaxis ]
18101819 sample_count , dimension_count = samples .shape
@@ -1895,6 +1904,8 @@ def _trajectory_profile(
18951904 if len (stamps_ns ) < 2 :
18961905 return None
18971906 samples = channel .to_numpy (field )
1907+ if samples .size == 0 :
1908+ return None
18981909 if samples .ndim == 1 :
18991910 samples = samples [:, np .newaxis ]
19001911
0 commit comments