From 386c65280e3e5beeffcccc6f6c3bef3065ab119b Mon Sep 17 00:00:00 2001 From: 30hours Date: Thu, 7 Dec 2023 11:15:04 +0000 Subject: [PATCH] Fix Doppler detections and add delay-Doppler --- api/detection.js | 2 +- html/controller/index.html | 1 + .../detection/delay-doppler/index.html | 106 ++++++++++++++ html/display/detection/delay/index.html | 9 +- html/display/detection/doppler/index.html | 9 +- ...t_detection_delay.js => plot_detection.js} | 12 +- html/js/plot_detection_doppler.js | 130 ------------------ 7 files changed, 130 insertions(+), 139 deletions(-) create mode 100644 html/display/detection/delay-doppler/index.html rename html/js/{plot_detection_delay.js => plot_detection.js} (93%) delete mode 100644 html/js/plot_detection_doppler.js diff --git a/api/detection.js b/api/detection.js index b4ab1b8..2d7d4a3 100644 --- a/api/detection.js +++ b/api/detection.js @@ -49,7 +49,7 @@ function update_data() { for (var j = 0; j < map[i].delay.length; j++) { delay.push(map[i].delay[j]); - doppler.push(map[i].delay[j]); + doppler.push(map[i].doppler[j]); timestamp.push(map[i].timestamp); } } diff --git a/html/controller/index.html b/html/controller/index.html index 4282143..01769bf 100644 --- a/html/controller/index.html +++ b/html/controller/index.html @@ -107,6 +107,7 @@
  • Max-hold delay Doppler map
  • Detections in delay over time
  • Detections in Doppler over time
  • +
  • Detections in delay-Doppler over time
  • diff --git a/html/display/detection/delay-doppler/index.html b/html/display/detection/delay-doppler/index.html new file mode 100644 index 0000000..8e322f3 --- /dev/null +++ b/html/display/detection/delay-doppler/index.html @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + blah2 + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + + + + + + + + diff --git a/html/display/detection/delay/index.html b/html/display/detection/delay/index.html index ec3d5d9..496dc3b 100644 --- a/html/display/detection/delay/index.html +++ b/html/display/detection/delay/index.html @@ -94,6 +94,13 @@ - + + + diff --git a/html/display/detection/doppler/index.html b/html/display/detection/doppler/index.html index 75d4f5f..c03c32a 100644 --- a/html/display/detection/doppler/index.html +++ b/html/display/detection/doppler/index.html @@ -94,6 +94,13 @@ - + + + diff --git a/html/js/plot_detection_delay.js b/html/js/plot_detection.js similarity index 93% rename from html/js/plot_detection_delay.js rename to html/js/plot_detection.js index 4a7b971..a5e8b83 100644 --- a/html/js/plot_detection_delay.js +++ b/html/js/plot_detection.js @@ -40,7 +40,7 @@ var layout = { displayModeBar: false, xaxis: { title: { - text: 'Timestamp', + text: xTitle, font: { size: 24 } @@ -51,7 +51,7 @@ var layout = { }, yaxis: { title: { - text: 'Bistatic Delay (km)', + text: yTitle, font: { size: 24 } @@ -98,8 +98,8 @@ var intervalId = window.setInterval(function () { nRows = data.nRows; var trace1 = { - x: data.timestamp, - y: data.delay, + x: data[xVariable], + y: data[yVariable], mode: 'markers', type: 'scatter' }; @@ -110,8 +110,8 @@ var intervalId = window.setInterval(function () { // case update plot else { var trace_update = { - x: [data.timestamp], - y: [data.delay] + x: [data[xVariable]], + y: [data[yVariable]] }; Plotly.update('data', trace_update); } diff --git a/html/js/plot_detection_doppler.js b/html/js/plot_detection_doppler.js deleted file mode 100644 index c123bd8..0000000 --- a/html/js/plot_detection_doppler.js +++ /dev/null @@ -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);