[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72073":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":16,"starSnapshotCount":16,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},72073,"f1-race-replay","IAmTomShaw\u002Ff1-race-replay","IAmTomShaw","An interactive Formula 1 race visualisation and data analysis tool built with Python! 🏎️","",null,"Python",5926,792,60,36,0,33,61,160,99,39.7,false,"main",true,[26,27,28],"f1","formula1","formula1-data-analysis","2026-06-12 02:02:58","# F1 Race Replay 🏎️ 🏁\n\nA Python application for visualizing Formula 1 race telemetry and replaying race events with interactive controls and a graphical interface.\n\n![Race Replay Preview](.\u002Fresources\u002Fpreview.png)\n\n> **HUGE NEWS:** The telemetry stream feature is now in a usable state. See the [telemetry demo documentation](.\u002Ftelemetry.md) for access instructions, data format details, and usage ideas.\n\n## Features\n\n- **Race Replay Visualization:** Watch the race unfold with real-time driver positions on a rendered track.\n- **Safety Car Visualization:** See the Safety Car deploy from pit lane, lead the field, and return to pits — with animated transitions and pulsing glow effects.\n- **Insights Menu:** Floating menu for quick access to telemetry analysis tools (launches automatically with replay).\n- **Leaderboard:** See live driver positions and current tyre compounds.\n- **Lap & Time Display:** Track the current lap and total race time.\n- **Driver Status:** Drivers who retire or go out are marked as \"OUT\" on the leaderboard.\n- **Interactive Controls:** Pause, rewind, fast forward, and adjust playback speed using on-screen buttons or keyboard shortcuts.\n- **Legend:** On-screen legend explains all controls.\n- **Driver Telemetry Insights:** View speed, gear, DRS status, and current lap for selected drivers when selected on the leaderboard.\n\n## Controls\n\n- **Pause\u002FResume:** SPACE or Pause button\n- **Rewind\u002FFast Forward:** ← \u002F → or Rewind\u002FFast Forward buttons\n- **Playback Speed:** ↑ \u002F ↓ or Speed button (cycles through 0.5x, 1x, 2x, 4x)\n- **Set Speed Directly:** Keys 1–4\n- **Restart**: **R** to restart replay\n- **Toggle DRS Zone**: **D** to hide\u002Fshow DRS Zone\n- **Toggle Progress Bar**: **B** to hide\u002Fshow progress bar\n- **Toggle Driver Names**: **L** to hide\u002Fshow driver names on track\n- **Select driver\u002Fdrivers**: Click to select driver or shift click to select multiple drivers\n\n\n## Safety Car\n\nThe replay includes a **simulated Safety Car** that appears on track whenever the F1 data indicates a Safety Car deployment (track status code `4`). Since the F1 API does not provide GPS telemetry for the actual Safety Car, its position is simulated based on the race leader's position.\n\n### How it works\n\n- **Data source:** The Safety Car deployment timing comes from the real F1 track status data via FastF1 (`session.track_status`).\n- **Position simulation:** The SC is placed ~500 meters ahead of the race leader on the track reference polyline. This approximates where the real SC would be relative to the field.\n- **Three animation phases:**\n  - **Deploying** — The SC animates from the pit lane onto the track over ~3 seconds, with a pulsing glow and \"SC DEPLOYING\" label.\n  - **On Track** — The SC drives ahead of the leader with a steady amber glow and \"SC\" label.\n  - **Returning** — The SC animates back to the pit lane over ~3 seconds, with a fading pulsing glow and \"SC IN\" label.\n- **Visual appearance:** The SC is drawn as a larger orange\u002Famber circle (8px radius vs 6px for regular cars) with an orange outline ring and always-visible \"SC\" label.\n\n### Technical details\n\nThe SC position computation happens in `_compute_safety_car_positions()` in `src\u002Ff1_data.py`. Each frame gets a `safety_car` field:\n\n```json\n{\n  \"safety_car\": {\n    \"x\": 1234.56,\n    \"y\": 7890.12,\n    \"phase\": \"on_track\",\n    \"alpha\": 1.0\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `x`, `y` | World coordinates of the SC |\n| `phase` | `\"deploying\"`, `\"on_track\"`, or `\"returning\"` |\n| `alpha` | Opacity value from `0.0` (invisible) to `1.0` (fully visible), used for fade in\u002Fout animation |\n\n> **Note:** If you have existing cached `.pkl` files from previous runs, you must re-run with `--refresh-data` to generate SC position data. Older cached files will simply show no Safety Car.\n\n## Qualifying Session Support (in development)\n\nRecently added support for Qualifying session replays with telemetry visualization including speed, gear, throttle, and brake over the lap distance. This feature is still being refined.\n\n## Requirements\n\n- Python 3.11+\n- [FastF1](https:\u002F\u002Fgithub.com\u002FtheOehrly\u002FFast-F1)\n- [Arcade](https:\u002F\u002Fapi.arcade.academy\u002Fen\u002Flatest\u002F)\n- numpy\n\nInstall dependencies:\n```bash\npip install -r requirements.txt\n```\n\nFastF1 cache folder will be created automatically on first run. If it is not created, you can manually create a folder named `.fastf1-cache` in the project root.\n\n## Environment Setup\n\nTo get started with this project locally, you can follow these steps:\n\n1. **Clone the Repository:**\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002FIAmTomShaw\u002Ff1-race-replay\n    cd f1-race-replay\n    ```\n2. **Create a Virtual Environment:**\n    This process differs based on your operating system.\n    - On macOS\u002FLinux:\n      ```bash\n      python3 -m venv venv\n      source venv\u002Fbin\u002Factivate\n      ```\n    - On Windows:\n      ```bash\n      python -m venv venv\n      .\\venv\\Scripts\\activate\n      ```\n3. **Install Dependencies:**\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n4. **Run the Application:**\n    You can now run the application using the instructions in the Usage section below.\n## Troubleshooting\nIf the pull data proccess fails, run:\n```bash\npip install --upgrade fastf1\n```\n\n## Usage\n\n**DEFAULT GUI MENU:** To use the new GUI menu system, you can simply run:\n```bash\npython main.py\n```\n\n![GUI Menu Preview](.\u002Fresources\u002Fgui-menu.png)\n\nThis will open a graphical interface where you can select the year and round of the race weekend you want to replay. This is still a new feature, so please report any issues you encounter.\n\n**OPTIONAL CLI MENU:** To use the CLI menu system, you can simply run:\n```bash\npython main.py --cli\n```\n\n![CLI Menu Preview](.\u002Fresources\u002Fcli-menu.gif)\n\nThis will prompt you with series of questions and a list of options to make your choice from using the arrow keys and enter key.\n\nIf you would already know the year and round number of the session you would like to watch, you run the commands directly as follows:\n\nRun the main script and specify the year and round:\n```bash\npython main.py --viewer --year 2025 --round 12\n```\n\nTo run without HUD:\n```bash\npython main.py --viewer --year 2025 --round 12 --no-hud\n```\n\nTo run a Sprint session (if the event has one), add `--sprint`:\n```bash\npython main.py --viewer --year 2025 --round 12 --sprint\n```\n\nThe application will load a pre-computed telemetry dataset if you have run it before for the same event. To force re-computation of telemetry data, use the `--refresh-data` flag:\n```bash\npython main.py --viewer --year 2025 --round 12 --refresh-data\n```\n\n### Qualifying Session Replay\n\nTo run a Qualifying session replay, use the `--qualifying` flag:\n```bash\npython main.py --viewer --year 2025 --round 12 --qualifying\n```\n\nTo run a Sprint Qualifying session (if the event has one), add `--sprint`:\n```bash\npython main.py --viewer --year 2025 --round 12 --qualifying --sprint\n```\n\n## File Structure\n\n```\nf1-race-replay\u002F\n├── main.py                    # Entry point, handles session loading and starts the replay\n├── requirements.txt           # Python dependencies\n├── README.md                  # Project documentation\n├── roadmap.md                 # Planned features and project vision\n├── resources\u002F\n│   └── preview.png           # Race replay preview image\n├── src\u002F\n│   ├── f1_data.py            # Telemetry loading, processing, frame generation & SC position simulation\n│   ├── arcade_replay.py      # Visualization and UI logic\n│   └── ui_components.py      # UI components like buttons and leaderboard\n│   ├── interfaces\u002F\n│   │   └── qualifying.py     # Qualifying session interface and telemetry visualization\n│   │   └── race_replay.py    # Race replay interface, SC rendering & telemetry visualization\n│   └── lib\u002F\n│       └── tyres.py          # Type definitions for telemetry data structures\n│       └── time.py           # Time formatting utilities\n└── .fastf1-cache\u002F            # FastF1 cache folder (created automatically upon first run)\n└── computed_data\u002F            # Computed telemetry data (created automatically upon first run)\n```\n\n## Building Custom Telemetry Windows\n\nWhen you start a race replay, an **Insights Menu** automatically appears, providing quick access to various telemetry analysis tools. You can easily create custom insight windows that receive live telemetry data using the `PitWallWindow` base class:\n\n```python\nfrom src.gui.pit_wall_window import PitWallWindow\n\nclass MyInsightWindow(PitWallWindow):\n    def setup_ui(self):\n        # Create your custom UI\n        pass\n    \n    def on_telemetry_data(self, data):\n        # Process telemetry data\n        pass\n```\n\nThe `PitWallWindow` base class handles all telemetry stream connection logic automatically, allowing you to focus solely on your window's functionality.\n\n**Key Features:**\n- Automatic connection to telemetry stream\n- Built-in status bar with connection state\n- Proper cleanup on window close\n- Simple API - just implement `setup_ui()` and `on_telemetry_data()`\n\n**Documentation & Examples:**\n- See [docs\u002FPitWallWindow.md](.\u002Fdocs\u002FPitWallWindow.md) for complete guide\n- See [docs\u002FInsightsMenu.md](.\u002Fdocs\u002FInsightsMenu.md) for adding insights to the menu\n- Run the example: `python -m src.gui.example_pit_wall_window`\n- Test the menu: `python -m src.gui.insights_menu`\n\n## Customization\n\n- Change track width, colors, and UI layout in `src\u002Farcade_replay.py`.\n- Adjust telemetry processing in `src\u002Ff1_data.py`.\n- Create custom telemetry windows using `PitWallWindow` base class (see above).\n\n## Contributing\n\nThere have been several contributions from the community that have helped enhance this project. I have added a [contributors.md](.\u002Fcontributors.md) file to acknowledge those who have contributed features and improvements.\n\nIf you would like to contribute, feel free to:\n\n- Open pull requests for UI improvements or new features.\n- Report issues on GitHub.\n\nPlease see [roadmap.md](.\u002Froadmap.md) for planned features and project vision.\n\n# Known Issues\n\n- The leaderboard appears to be inaccurate for the first few corners of the race. The leaderboard is also temporarily affected by a driver going in the pits. At the end of the race, the leaderboard is sometimes affected by the drivers' final x,y positions being further ahead than other drivers. These are known issues caused by inaccuracies in the telemetry and are being worked on for future releases. It's likely that these issues will be fixed in stages as improving the leaderboard accuracy is a complex task.\n\n## 📝 License\n\nThis project is licensed under the MIT License.\n\n## ⚠️ Disclaimer\n\nNo copyright infringement intended. Formula 1 and related trademarks are the property of their respective owners. All data used is sourced from publicly available APIs and is used for educational and non-commercial purposes only.\n\n---\n\nBuilt with ❤️ by [Tom Shaw](https:\u002F\u002Ftomshaw.dev)\n","F1 Race Replay 是一个使用Python构建的交互式一级方程式赛车可视化和数据分析工具。它能够通过实时驾驶员位置在渲染赛道上重播比赛事件，并提供一系列互动控制与图形界面。核心功能包括比赛回放可视化、安全车部署动画模拟、洞察菜单、实时排行榜以及驾驶员状态显示等，支持暂停、快进、调整播放速度等交互操作。此项目特别适合于赛车爱好者和技术分析师用于分析比赛策略、理解赛事动态或进行相关研究。",2,"2026-06-11 03:40:13","high_star"]