Repository navigation
Make synthetic weather deterministic (#43) - #99
Srikar-Kolli wants to merge 2 commits into
Conversation
Seed a local RandomState in generate_synthetic_data (default seed 7, matching the sweeps) instead of using global np.random. Thread synthetic_weather_seed through LapsRaceSimulator and the sweeps. Fix zero-division when the race starts at 13:00, short-window smoothing length mismatch, and add a clear error for empty race windows. Add tests/test_weather.py and fix stale test_csv tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Great work on the deterministic weather implementation and thorough test coverage! The changes look good overall, but there's a merge conflict with the newer time-step functionality on Changes needed:
After updating the branch with The goal is to integrate the deterministic weather improvements without regressing the recently merged time-step functionality. Once that's resolved and tests pass, this should be ready to merge! |
Keep resample_to_time_step() from main alongside the seeded RandomState and _moving_average(); generate_synthetic_data() now returns through the resampler. Take main's test_csv fixes, let the stub simulators accept synthetic_weather_seed, and add time-step tests to tests/test_weather.py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Summary
Makes
WeatherService.generate_synthetic_data()deterministic so tests and comparisons get the same weather every run.np.random.RandomState(seed)instead of the globalnp.random. The default seed is 7, the same as the sweeps used, so existing sweep output is unchanged.synthetic_weather_seedtoLapsRaceSimulatorand passes it throughrun_fixed_speed_sweepandrun_strategy_sweep. The sweeps no longer callnp.random.seed.ZeroDivisionError._moving_averagehelper fixes this and gives the same values as before for normal windows.ValueError.tests/planning/test_csv.pytests that were already failing onmain. They used the oldlap_distance_kmfield and fake args that no longer matchmain.py.Testing
pytest tests: 143 passed, 0 failed.tests/test_weather.py(44 tests) covers:np.random.seed(7)output.python3 -m compileall simpasses.