customise max tof for graph
This commit is contained in:
parent
232e90984f
commit
ed7aaf787b
@ -1,4 +1,4 @@
|
||||
from flask import Flask, render_template, Response
|
||||
from flask import Flask, render_template, Response, request
|
||||
from flask_sock import Sock
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
@ -88,10 +88,10 @@ def add_data(
|
||||
del subscriber_settings[subscriber]
|
||||
|
||||
|
||||
def make_heatmap():
|
||||
def make_heatmap(max_tof: float):
|
||||
fig = plt.figure()
|
||||
ax = fig.add_axes([0, 0, 1, 1], polar=True)
|
||||
r = np.linspace(0, 1e-7, 100) # Radius values
|
||||
r = np.linspace(0, max_tof, 100) # Radius values
|
||||
theta = np.linspace(0, np.pi, 50) # Angle values
|
||||
R, Theta = np.meshgrid(r, theta) # Create a 2D grid of r and theta
|
||||
|
||||
@ -107,18 +107,25 @@ def make_heatmap():
|
||||
return buf
|
||||
|
||||
|
||||
def gather_aoa():
|
||||
def gather_aoa(max_tof: float):
|
||||
while True:
|
||||
# time.sleep(0.05)
|
||||
logger.info("Got AoA heatmap")
|
||||
buf = make_heatmap()
|
||||
buf = make_heatmap(max_tof)
|
||||
yield (b"--frame\r\nContent-Type: image/jpeg\r\n\r\n" + buf.read() + b"\r\n")
|
||||
buf.close()
|
||||
|
||||
|
||||
@app.route("/aoa_tof")
|
||||
def aoa_tof():
|
||||
return Response(gather_aoa(), mimetype="multipart/x-mixed-replace; boundary=frame")
|
||||
max_tof_str = request.args.get("max_tof")
|
||||
try:
|
||||
max_tof = float(max_tof_str)
|
||||
except Exception as e:
|
||||
max_tof = 5e-8
|
||||
return Response(
|
||||
gather_aoa(max_tof), mimetype="multipart/x-mixed-replace; boundary=frame"
|
||||
)
|
||||
|
||||
|
||||
def start():
|
||||
|
||||
Loading…
Reference in New Issue
Block a user