the behemoth
This commit is contained in:
BIN
scripts/__pycache__/enrich_telemetry.cpython-312.pyc
Normal file
BIN
scripts/__pycache__/enrich_telemetry.cpython-312.pyc
Normal file
Binary file not shown.
BIN
scripts/__pycache__/simulate_pi_stream.cpython-312.pyc
Normal file
BIN
scripts/__pycache__/simulate_pi_stream.cpython-312.pyc
Normal file
Binary file not shown.
@@ -24,6 +24,8 @@ def main():
|
||||
parser = argparse.ArgumentParser(description="Enrich telemetry JSON lines with HPC-style metrics")
|
||||
parser.add_argument("--input", "-i", help="Input file path (JSON lines). Reads stdin if omitted.")
|
||||
parser.add_argument("--output", "-o", help="Output file path (JSON lines). Writes stdout if omitted.")
|
||||
parser.add_argument("--full-context", action="store_true",
|
||||
help="Output full enriched telemetry with race context (for AI layer)")
|
||||
args = parser.parse_args()
|
||||
|
||||
enricher = Enricher()
|
||||
@@ -33,8 +35,14 @@ def main():
|
||||
|
||||
try:
|
||||
for rec in iter_json_lines(fin):
|
||||
enriched = enricher.enrich(rec)
|
||||
print(json.dumps(enriched), file=fout)
|
||||
if args.full_context:
|
||||
# Output enriched telemetry + race context
|
||||
result = enricher.enrich_with_context(rec)
|
||||
else:
|
||||
# Legacy mode: output only enriched metrics
|
||||
result = enricher.enrich(rec)
|
||||
|
||||
print(json.dumps(result), file=fout)
|
||||
fout.flush()
|
||||
finally:
|
||||
if fin is not sys.stdin:
|
||||
|
||||
@@ -45,7 +45,13 @@ def row_to_json(row: pd.Series) -> Dict[str, Any]:
|
||||
'tire_compound': str(row['tire_compound']) if pd.notna(row['tire_compound']) else 'UNKNOWN',
|
||||
'tire_life_laps': float(row['tire_life_laps']) if pd.notna(row['tire_life_laps']) else 0.0,
|
||||
'track_temperature': float(row['track_temperature']) if pd.notna(row['track_temperature']) else 0.0,
|
||||
'rainfall': bool(row['rainfall'])
|
||||
'rainfall': bool(row['rainfall']),
|
||||
|
||||
# Additional race context fields
|
||||
'track_name': 'Monza', # From ALONSO_2023_MONZA_RACE
|
||||
'driver_name': 'Alonso',
|
||||
'current_position': 5, # Mock position, could be varied
|
||||
'fuel_level': max(0.1, 1.0 - (float(row['lap_number']) / float(row['total_laps']) * 0.8)) if pd.notna(row['lap_number']) and pd.notna(row['total_laps']) else 0.5,
|
||||
}
|
||||
return data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user