From 32401c9031bb434fd2cd4ad80a37863a3bd1eb1e Mon Sep 17 00:00:00 2001 From: 30hours Date: Sun, 11 Feb 2024 03:03:23 +0000 Subject: [PATCH] Rename main.py to api.py and minor changes --- api/Dockerfile | 2 +- api/main.py | 6 +++++- event/algorithm/associator/AdsbAssociator.py | 5 +++-- event/event.py | 16 ++++++++++++++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index ac2a767..08a2c06 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -10,7 +10,7 @@ RUN pip install --no-cache-dir -r requirements.txt EXPOSE 5000 # define environment variable -ENV FLASK_APP=main.py +ENV FLASK_APP=api.py # run Gunicorn instead of the default Flask development server CMD ["gunicorn", "--bind", "0.0.0.0:5000", "main:app"] diff --git a/api/main.py b/api/main.py index ed77115..3032b3b 100644 --- a/api/main.py +++ b/api/main.py @@ -1,4 +1,8 @@ -# main.py +""" +@file api.py +@brief API for 3lips. +@author 30hours +""" from flask import Flask, Response, render_template, request, redirect, jsonify, send_from_directory import os diff --git a/event/algorithm/associator/AdsbAssociator.py b/event/algorithm/associator/AdsbAssociator.py index 763fb03..7202881 100644 --- a/event/algorithm/associator/AdsbAssociator.py +++ b/event/algorithm/associator/AdsbAssociator.py @@ -7,8 +7,9 @@ class AdsbAssociator: """ @class AdsbAssociator - @brief A class for associating a detection with ADS-B truth. - @details Uses radar detection data from a blah2 server. + @brief A class for associating detections of the same target. + @details Girst associate ADS-B truth with each radar detection. + Then associate over multiple radars. @see blah2 at https://github.com/30hours/blah2. Uses truth data in delay-Doppler space from an adsb2dd server. @see adsb2dd at https://github.com/30hours/adsb2dd. diff --git a/event/event.py b/event/event.py index 2b4f6b8..94c426e 100644 --- a/event/event.py +++ b/event/event.py @@ -81,9 +81,21 @@ async def event(): # main processing for item in api_event: - for radar in item["server"]: + # associator selection + if item["associator"] == "adsb-associator": + associator = adsbAssociator + else: + print("Error: Associator invalid.") + return - print(radar, flush=True) + # coord reg selection + if item["coordreg"] == "ellipse-parametric": + coordreg = ellipseParametric + else: + print("Error: Coord reg invalid.") + return + + print(radar, flush=True) # delete old API requests api_event = [