Files
StarPilot/openpilot/starpilot/flm/evidence_phases.py
T
firestar5683 200632aabd StarPilot Auto Learn
Learn bounded feed-forward corrections on eligible torque controllers behind Use StarPilot Auto Learn, preserving installed tunes and native safety limits.
Co-authored-by: Danny <dannyirwin31@yahoo.com>
Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>
Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com>
Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu>
Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>

Co-authored-by: Intelli <contact@intelli.software>
Co-authored-by: haraschax <6804392+haraschax@users.noreply.github.com>
Co-authored-by: pharmacomaniac <blittle65@gmail.com>

Co-authored-by: whoisdomi <dcantu83@gmail.com>
2026-10-14 20:02:39 -05:00

23 lines
1.0 KiB
Python

"""Whole-block causal phase selection in the optional fitter process."""
def stage_blocks(raw, split, calibration_response_end_ns):
"""Keep original rows and clocks; quarantine whole boundary maneuvers.
Response lag can put early commands of the next maneuver before the end of
calibration responses. Such a block is retained in the raw replay recording,
but cannot become stage training or heldout evidence. Never slice its rows.
"""
admitted, boundary = [], []
for block in raw[split:]:
if not block['samples']:
raise ValueError('empty phase block')
support = tuple((point['control_ns'], point['apply_ns'], point['mono_ns']) for point in block['samples'])
if any(not 0 < command <= applied <= response for command, applied, response in support):
raise ValueError('phase source chronology')
if min(command for command, _, _ in support) <= calibration_response_end_ns:
boundary.append(block['block_id'])
else:
admitted.append(block)
return tuple(admitted), tuple(boundary)