Commit 981a4123 by Corey Koval

Supports multi-user map interaction

parent c9abfe67
## Recent Changes: ## Recent Changes:
- The LOB for each receiver on the map is now red for low confidence LOBs and green - Changed the way ellipse and clustering parameters are handled. This allows for
for high confidence LOBs. multi-user map interaction.
- Receivers on map update every 2.5 Seocnds. - Updated to Cesium 1.79
- To customize this change `refreshrate` at the top of `static/receiver_configurator.js`.
## Previous Changes ## Previous Changes
- The LOB for each receiver on the map changes color based on the power and
confidence thresholds.
- Green when both power and confidence are above their thresholds
- Orange when just power is above it's threshold.
- Red when power is below it's minimum threshold.
- Receivers on map update every 2.5 Seocnds.
- To customize this change `refreshrate` at the top of `static/receiver_configurator.js`.
- Your old database files will not work directly with this latest commit. Several changes have been made - Your old database files will not work directly with this latest commit. Several changes have been made
to the database structure to accomodate new features. to the database structure to accomodate new features.
- Now introducing Single Receiver Mode! This will give you functionality similar to, but better than - Now introducing Single Receiver Mode! This will give you functionality similar to, but better than
......
# DF Aggregator # DF Aggregator
## Recent Changes: ## Recent Changes:
- The LOB for each receiver on the map changes color based on the power and - Changed the way ellipse and clustering parameters are handled. This allows for
confidence thresholds. multi-user map interaction.
- Green when both power and confidence are above their thresholds
- Orange when just power is above it's threshold.
- Red when power is below it's minimum threshold.
- Receivers on map update every 2.5 Seocnds.
- To customize this change `refreshrate` at the top of `static/receiver_configurator.js`.
- For previous changes see the [Change Log](CHANGELOG.md). - For previous changes see the [Change Log](CHANGELOG.md).
## Installing: ## Installing:
......
...@@ -214,9 +214,9 @@ def plot_intersects(lat_a, lon_a, doa_a, lat_b, lon_b, doa_b, max_distance = 100 ...@@ -214,9 +214,9 @@ def plot_intersects(lat_a, lon_a, doa_a, lat_b, lon_b, doa_b, max_distance = 100
# We start this in it's own process do it doesn't eat all of your RAM. # We start this in it's own process do it doesn't eat all of your RAM.
# This becomes noticable at over 10k intersections. # This becomes noticable at over 10k intersections.
####################################################################### #######################################################################
def do_dbscan(X): def do_dbscan(X, epsilon, minsamp):
DBSCAN_WAIT_Q.put(True) DBSCAN_WAIT_Q.put(True)
db = DBSCAN(eps=ms.eps, min_samples=ms.min_samp).fit(X) db = DBSCAN(eps=epsilon, min_samples=minsamp).fit(X)
DBSCAN_Q.put(db.labels_) DBSCAN_Q.put(db.labels_)
if not DBSCAN_WAIT_Q.empty(): if not DBSCAN_WAIT_Q.empty():
DBSCAN_WAIT_Q.get() DBSCAN_WAIT_Q.get()
...@@ -225,7 +225,7 @@ def do_dbscan(X): ...@@ -225,7 +225,7 @@ def do_dbscan(X):
# Computes DBSCAN Alorithm is applicable, # Computes DBSCAN Alorithm is applicable,
# finds the mean of a cluster of intersections. # finds the mean of a cluster of intersections.
############################################### ###############################################
def process_data(database_name): def process_data(database_name, epsilon, min_samp):
n_std=3.0 n_std=3.0
intersect_list = [] intersect_list = []
likely_location = [] likely_location = []
...@@ -245,7 +245,7 @@ def process_data(database_name): ...@@ -245,7 +245,7 @@ def process_data(database_name):
WHERE aoi_id=? ORDER BY confidence LIMIT 25000''', [aoi]) WHERE aoi_id=? ORDER BY confidence LIMIT 25000''', [aoi])
intersect_array = np.array(curs.fetchall()) intersect_array = np.array(curs.fetchall())
if intersect_array.size != 0: if intersect_array.size != 0:
if ms.eps > 0: if epsilon > 0:
X = StandardScaler().fit_transform(intersect_array[:,0:2]) X = StandardScaler().fit_transform(intersect_array[:,0:2])
n_points = len(X) n_points = len(X)
size_x = sys.getsizeof(X)/1024 size_x = sys.getsizeof(X)/1024
...@@ -255,7 +255,7 @@ def process_data(database_name): ...@@ -255,7 +255,7 @@ def process_data(database_name):
print("Waiting for my turn...") print("Waiting for my turn...")
time.sleep(1) time.sleep(1)
starttime = time.time() starttime = time.time()
db = Process(target=do_dbscan,args=(X,)) db = Process(target=do_dbscan,args=(X,epsilon,min_samp))
db.daemon = True db.daemon = True
db.start() db.start()
try: try:
...@@ -443,7 +443,7 @@ def write_geojson(best_point, all_the_points): ...@@ -443,7 +443,7 @@ def write_geojson(best_point, all_the_points):
############################################### ###############################################
# Writes output.czml used by the WebUI # Writes output.czml used by the WebUI
############################################### ###############################################
def write_czml(best_point, all_the_points, ellipsedata): def write_czml(best_point, all_the_points, ellipsedata, plotallintersects, eps):
point_properties = { point_properties = {
"pixelSize":5.0, "pixelSize":5.0,
"heightReference":"CLAMP_TO_GROUND", "heightReference":"CLAMP_TO_GROUND",
...@@ -475,7 +475,7 @@ def write_czml(best_point, all_the_points, ellipsedata): ...@@ -475,7 +475,7 @@ def write_czml(best_point, all_the_points, ellipsedata):
best_point_packets = [] best_point_packets = []
ellipse_packets = [] ellipse_packets = []
if len(all_the_points) > 0 and (ms.plotintersects or ms.eps == 0): if len(all_the_points) > 0 and (plotallintersects or eps == 0):
all_the_points = np.array(all_the_points) all_the_points = np.array(all_the_points)
scaled_time = minmax_scale(all_the_points[:,-1]) scaled_time = minmax_scale(all_the_points[:,-1])
all_the_points = np.column_stack((all_the_points, scaled_time)) all_the_points = np.column_stack((all_the_points, scaled_time))
...@@ -695,20 +695,20 @@ def cesium(): ...@@ -695,20 +695,20 @@ def cesium():
############################################### ###############################################
@get('/update') @get('/update')
def update_cesium(): def update_cesium():
ms.eps = float(request.query.eps) if request.query.eps else ms.eps # eps = float(request.query.eps) if request.query.eps else ms.eps
# min_samp = float(request.query.minpts) if request.query.minpts else ms.min_samp
ms.min_conf = float(request.query.minconf) if request.query.minconf else ms.min_conf ms.min_conf = float(request.query.minconf) if request.query.minconf else ms.min_conf
ms.min_power = float(request.query.minpower) if request.query.minpower else ms.min_power ms.min_power = float(request.query.minpower) if request.query.minpower else ms.min_power
ms.min_samp = float(request.query.minpts) if request.query.minpts else ms.min_samp
if request.query.rx == "true": if request.query.rx == "true":
ms.receiving = True ms.receiving = True
elif request.query.rx == "false": elif request.query.rx == "false":
ms.receiving = False ms.receiving = False
if request.query.plotpts == "true": # if request.query.plotpts == "true":
ms.plotintersects = True # ms.plotintersects = True
elif request.query.plotpts == "false": # elif request.query.plotpts == "false":
ms.plotintersects = False # ms.plotintersects = False
return "OK" return "OK"
...@@ -736,8 +736,16 @@ def rx_params(): ...@@ -736,8 +736,16 @@ def rx_params():
############################################### ###############################################
@get('/output.czml') @get('/output.czml')
def tx_czml_out(): def tx_czml_out():
eps = float(request.query.eps) if request.query.eps else ms.eps
min_samp = float(request.query.minpts) if request.query.minpts else ms.min_samp
if request.query.plotpts == "true":
plotallintersects = True
elif request.query.plotpts == "false":
plotallintersects = False
else:
plotallintersects = ms.plotintersects
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0') response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0')
output = write_czml(*process_data(database_name)) output = write_czml(*process_data(database_name, eps, min_samp), plotallintersects, eps)
return str(output) return str(output)
############################################### ###############################################
......
...@@ -238,10 +238,31 @@ ...@@ -238,10 +238,31 @@
} }
function loadTxCzml() { function loadTxCzml() {
let parameter = "";
let spinner = document.getElementById("loader"); let spinner = document.getElementById("loader");
spinner.style.visibility = "visible"; spinner.style.visibility = "visible";
spinner.style.zIndex = "10"; spinner.style.zIndex = "10";
let promise1 = transmittersDataSource.load('/output.czml');
const epsslider = document.getElementById("epsilonRange");
const minpointslider = document.getElementById("minpointRange");
const intersect_en = document.getElementById("intersect_en");
if(minpointslider !== null) {
parameter += "minpts="+minpointslider.value+"&";
}
if(epsslider !== null) {
parameter += "eps="+epsslider.value+"&";
}
if (intersect_en !== null) {
if (intersect_en.checked) {
parameter += "plotpts=true"+"&";
} else {
parameter += "plotpts=false"+"&";
}
}
console.log(parameter);
let promise1 = transmittersDataSource.load('/output.czml?'+parameter);
Cesium.when(promise1, function(dataSource1){ Cesium.when(promise1, function(dataSource1){
spinner.style.visibility = "hidden"; spinner.style.visibility = "hidden";
spinner.style.zIndex = "0"; spinner.style.zIndex = "0";
...@@ -426,7 +447,7 @@ ...@@ -426,7 +447,7 @@
epsoutput.innerHTML = this.value; epsoutput.innerHTML = this.value;
} }
epsslider.onpointerup = function() { epsslider.onpointerup = function() {
updateParams("eps="+this.value); updateParams("");
} }
powerslider.oninput = function() { powerslider.oninput = function() {
poweroutput.innerHTML = this.value; poweroutput.innerHTML = this.value;
...@@ -444,7 +465,7 @@ ...@@ -444,7 +465,7 @@
minpointoutput.innerHTML = this.value; minpointoutput.innerHTML = this.value;
} }
minpointslider.onpointerup = function() { minpointslider.onpointerup = function() {
updateParams("minpts="+this.value); updateParams("");
} }
rx_enable.onchange = function() { rx_enable.onchange = function() {
...@@ -456,11 +477,12 @@ ...@@ -456,11 +477,12 @@
} }
intersect_en.onchange = function() { intersect_en.onchange = function() {
if (intersect_en.checked) { updateParams("");
updateParams("plotpts=true"); // if (intersect_en.checked) {
} else { // updateParams("plotpts=true");
updateParams("plotpts=false"); // } else {
} // updateParams("plotpts=false");
// }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment