{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Combining Interfaces\n\nThis example demonstrates the power of `arguslib`'s interface system by\nstacking multiple interfaces together. We will create a complex visualization\nthat includes:\n\n1. A `CameraArray` to show multiple camera views simultaneously.\n2. A `RadarInterface` to overlay radar data on top of the camera array.\n3. An `AircraftInterface` to plot flight tracks over both the cameras and radar data.\n\nThis showcases how different data sources can be combined into a single,\ncomprehensive plot.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import datetime\nfrom arguslib.aircraft import AircraftInterface\nfrom arguslib.radar.radar import Radar\nfrom arguslib.camera.camera_array import CameraArray\nfrom arguslib.camera.undistorted_camera import UndistortedCamera\nfrom arguslib.radar.radar_interface import RadarInterface" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Stacking Interfaces for a Composite View\n\nWe can combine multiple cameras with flight tracks and radar data using nested\ninterfaces. Here, we build up the final visualization step-by-step.\n\nFirst, we define the core instruments: a `Radar` and a `CameraArray` composed\nof `UndistortedCamera` instances to provide a wide, distortion-free field of view.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "dt = datetime.datetime(2025, 5, 1, 7, 30, 23)\nradar = Radar.from_config(\"COBALT\")\nmulticam = CameraArray.from_config(\"COBALTArray\", camera_class=UndistortedCamera)\n#\n# Next, we wrap the `CameraArray` with a `RadarInterface` to overlay the radar\n# data.\ncri = RadarInterface(radar, multicam)\n#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, we wrap the `RadarInterface` with an `AircraftInterface`. This allows\nus to load flight data and plot aircraft tracks on top of the combined\nradar-on-camera view.\n\nThe `show()` method on the outermost interface renders the entire scene,\nshowing the aircraft tracks and their intersection with the radar scan over\nthe multi-camera background.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "ai_on_ri_on_multicam = AircraftInterface(cri)\nai_on_ri_on_multicam.load_flight_data(dt)\nax = ai_on_ri_on_multicam.show(\n dt,\n tlen=45 * 60,\n color_icao=True,\n)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.5" } }, "nbformat": 4, "nbformat_minor": 0 }