Fix Doppler detections and add delay-Doppler

This commit is contained in:
30hours 2023-12-07 11:15:04 +00:00
parent f9daebb029
commit 386c65280e
7 changed files with 130 additions and 139 deletions

View file

@ -49,7 +49,7 @@ function update_data() {
for (var j = 0; j < map[i].delay.length; j++) for (var j = 0; j < map[i].delay.length; j++)
{ {
delay.push(map[i].delay[j]); delay.push(map[i].delay[j]);
doppler.push(map[i].delay[j]); doppler.push(map[i].doppler[j]);
timestamp.push(map[i].timestamp); timestamp.push(map[i].timestamp);
} }
} }

View file

@ -107,6 +107,7 @@
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/maxhold">Max-hold delay Doppler map</a></li> <li class="py-1"><a class="text-reset text-decoration-none" href="/display/maxhold">Max-hold delay Doppler map</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/detection/delay">Detections in delay over time</a></li> <li class="py-1"><a class="text-reset text-decoration-none" href="/display/detection/delay">Detections in delay over time</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/detection/doppler">Detections in Doppler over time</a></li> <li class="py-1"><a class="text-reset text-decoration-none" href="/display/detection/doppler">Detections in Doppler over time</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/detection/delay-Doppler">Detections in delay-Doppler over time</a></li>
</ul> </ul>
</div> </div>

View file

@ -0,0 +1,106 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>blah2</title>
<!-- load lib js -->
<script src="../../../lib/bootstrap-5.2.3.min.js"></script>
<script src="../../../lib/plotly-2.20.0.min.js"></script>
<script src="../../../lib/jquery-3.6.4.min.js"></script>
<!-- load lib css -->
<link rel="stylesheet" href="../../../lib/bootstrap-5.2.3.min.css">
<style>
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 3.5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 1rem;
}
@media (min-width: 768px) {
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 2.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
}
.navbar-nav {
flex-wrap: wrap;
}
div.plotly-notifier {
visibility: hidden;
}
</style>
</head>
<body style="background-color:#f78c58;">
<div style="height: 100vh; width: 95vw" class="container-fluid">
<div style="height: 100vh; width: 95vw" class="row d-flex">
<div class="justify-content-center" id="data"></div>
</div>
</body>
<script>
xTitle = "Bistatic Range (km)";
yTitle = "Bistatic Doppler (Hz)";
xVariable = "delay";
yVariable = "doppler";
</script>
<script src="../../../js/plot_detection.js"></script>
</html>

View file

@ -94,6 +94,13 @@
</body> </body>
<script src="../../../js/plot_detection_delay.js"></script> <script>
xTitle = "Timestamp";
yTitle = "Bistatic Range (km)";
xVariable = "timestamp";
yVariable = "delay";
</script>
<script src="../../../js/plot_detection.js"></script>
</html> </html>

View file

@ -94,6 +94,13 @@
</body> </body>
<script src="../../../js/plot_detection_doppler.js"></script> <script>
xTitle = "Timestamp";
yTitle = "Bistatic Doppler (Hz)";
xVariable = "timestamp";
yVariable = "doppler";
</script>
<script src="../../../js/plot_detection.js"></script>
</html> </html>

View file

@ -40,7 +40,7 @@ var layout = {
displayModeBar: false, displayModeBar: false,
xaxis: { xaxis: {
title: { title: {
text: 'Timestamp', text: xTitle,
font: { font: {
size: 24 size: 24
} }
@ -51,7 +51,7 @@ var layout = {
}, },
yaxis: { yaxis: {
title: { title: {
text: 'Bistatic Delay (km)', text: yTitle,
font: { font: {
size: 24 size: 24
} }
@ -98,8 +98,8 @@ var intervalId = window.setInterval(function () {
nRows = data.nRows; nRows = data.nRows;
var trace1 = { var trace1 = {
x: data.timestamp, x: data[xVariable],
y: data.delay, y: data[yVariable],
mode: 'markers', mode: 'markers',
type: 'scatter' type: 'scatter'
}; };
@ -110,8 +110,8 @@ var intervalId = window.setInterval(function () {
// case update plot // case update plot
else { else {
var trace_update = { var trace_update = {
x: [data.timestamp], x: [data[xVariable]],
y: [data.delay] y: [data[yVariable]]
}; };
Plotly.update('data', trace_update); Plotly.update('data', trace_update);
} }

View file

@ -1,130 +0,0 @@
var timestamp = -1;
var nRows = 3;
var host = window.location.hostname;
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
var range_x = [];
var range_y = [];
// setup API
var urlTimestamp = '';
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/api/timestamp?timestamp=' + Date.now();
} else {
urlTimestamp = '//' + host + '/api/timestamp?timestamp=' + Date.now();
}
var urlDetection = '';
if (isLocalHost) {
urlDetection = '//' + host + ':3000/stash/detection?timestamp=' + Date.now();
} else {
urlDetection = '//' + host + '/stash/detection?timestamp=' + Date.now();
}
// setup plotly
var layout = {
autosize: false,
margin: {
l: 50,
r: 50,
b: 50,
t: 10,
pad: 0
},
hoverlabel: {
namelength: 0
},
width: document.getElementById('data').offsetWidth,
height: document.getElementById('data').offsetHeight,
plot_bgcolor: "rgba(0,0,0,0)",
paper_bgcolor: "rgba(0,0,0,0)",
annotations: [],
displayModeBar: false,
xaxis: {
title: {
text: 'Timestamp',
font: {
size: 24
}
},
showgrid: false,
ticks: '',
side: 'bottom'
},
yaxis: {
title: {
text: 'Bistatic Doppler (Hz)',
font: {
size: 24
}
},
showgrid: false,
ticks: '',
ticksuffix: ' ',
autosize: false,
categoryorder: "total descending"
}
};
var config = {
displayModeBar: false,
scrollZoom: true
}
// setup plotly data
var data = [
{
z: [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
colorscale: 'Jet',
type: 'heatmap'
}
];
Plotly.newPlot('data', data, layout, config);
// callback function
var intervalId = window.setInterval(function () {
// check if timestamp is updated
var timestampData = $.get(urlTimestamp, function () { })
.done(function (data) {
if (timestamp != data) {
timestamp = data;
// get new data
var apiData = $.getJSON(urlDetection, function () { })
.done(function (data) {
// case draw new plot
if (data.nRows != nRows) {
nRows = data.nRows;
var trace1 = {
x: data.timestamp,
y: data.doppler,
mode: 'markers',
type: 'scatter'
};
var data_trace = [trace1];
Plotly.newPlot('data', data_trace, layout, config);
}
// case update plot
else {
var trace_update = {
x: [data.timestamp],
y: [data.doppler]
};
Plotly.update('data', trace_update);
}
})
.fail(function () {
})
.always(function () {
});
}
})
.fail(function () {
})
.always(function () {
});
}, 100);