Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
df-aggregator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
df-aggregator
Commits
e29153fc
Commit
e29153fc
authored
May 28, 2021
by
Corey Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AutoEps and AutoSamp fully functional
parent
e1337ee6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
39 deletions
+72
-39
df-aggregator.py
df-aggregator.py
+19
-11
cesium.tpl
views/cesium.tpl
+53
-28
No files found.
df-aggregator.py
View file @
e29153fc
...
@@ -283,18 +283,26 @@ def process_data(database_name, epsilon, min_samp):
...
@@ -283,18 +283,26 @@ def process_data(database_name, epsilon, min_samp):
WHERE aoi_id=? ORDER BY confidence DESC LIMIT 25000'''
,
[
aoi
])
WHERE aoi_id=? ORDER BY confidence DESC 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
((
epsilon
.
isnumeric
()
and
float
(
epsilon
)
>
0
)
if
epsilon
!=
"0"
:
or
epsilon
==
"auto"
):
X
=
StandardScaler
()
.
fit_transform
(
intersect_array
[:,
0
:
2
])
X
=
StandardScaler
()
.
fit_transform
(
intersect_array
[:,
0
:
2
])
n_points
=
len
(
X
)
n_points
=
len
(
X
)
min_samp
=
max
(
3
,
round
(
0.05
*
n_points
,
0
))
if
min_samp
==
"auto"
:
min_samp
=
max
(
3
,
round
(
0.05
*
n_points
,
0
))
elif
min_samp
.
isnumeric
():
min_samp
=
int
(
min_samp
)
else
:
break
if
epsilon
==
"auto"
:
if
epsilon
==
"auto"
:
epsilon
=
autoeps_calc
(
X
)
epsilon
=
autoeps_calc
(
X
)
print
(
f
"min_samp: {min_samp}, eps: {epsilon}"
)
print
(
f
"min_samp: {min_samp}, eps: {epsilon}"
)
elif
epsilon
.
isnumeric
():
epsilon
=
float
(
epsilon
)
else
:
else
:
epsilon
=
ms
.
eps
try
:
epsilon
=
float
(
epsilon
)
except
ValueError
:
break
# size_x = sys.getsizeof(X)/1024
# size_x = sys.getsizeof(X)/1024
# print(f"The dataset is {size_x} kilobytes")
# print(f"The dataset is {size_x} kilobytes")
print
(
f
"Computing Clusters from {n_points} intersections."
)
print
(
f
"Computing Clusters from {n_points} intersections."
)
...
@@ -522,7 +530,7 @@ def write_czml(best_point, all_the_points, ellipsedata, plotallintersects, eps):
...
@@ -522,7 +530,7 @@ def write_czml(best_point, all_the_points, ellipsedata, plotallintersects, eps):
best_point_packets
=
[]
best_point_packets
=
[]
ellipse_packets
=
[]
ellipse_packets
=
[]
if
len
(
all_the_points
)
>
0
and
(
plotallintersects
or
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
))
...
@@ -784,7 +792,7 @@ def rx_params():
...
@@ -784,7 +792,7 @@ def rx_params():
@get
(
'/output.czml'
)
@get
(
'/output.czml'
)
def
tx_czml_out
():
def
tx_czml_out
():
eps
=
request
.
query
.
eps
if
request
.
query
.
eps
else
str
(
ms
.
eps
)
eps
=
request
.
query
.
eps
if
request
.
query
.
eps
else
str
(
ms
.
eps
)
min_samp
=
float
(
request
.
query
.
minpts
)
if
request
.
query
.
minpts
else
ms
.
min_samp
min_samp
=
request
.
query
.
minpts
if
request
.
query
.
minpts
else
str
(
ms
.
min_samp
)
if
request
.
query
.
plotpts
==
"true"
:
if
request
.
query
.
plotpts
==
"true"
:
plotallintersects
=
True
plotallintersects
=
True
elif
request
.
query
.
plotpts
==
"false"
:
elif
request
.
query
.
plotpts
==
"false"
:
...
@@ -1233,14 +1241,14 @@ if __name__ == '__main__':
...
@@ -1233,14 +1241,14 @@ if __name__ == '__main__':
parser
.
add_option
(
"-d"
,
"--database"
,
dest
=
"database_name"
,
help
=
"REQUIRED Database File"
,
metavar
=
"FILE"
)
parser
.
add_option
(
"-d"
,
"--database"
,
dest
=
"database_name"
,
help
=
"REQUIRED Database File"
,
metavar
=
"FILE"
)
parser
.
add_option
(
"-r"
,
"--receivers"
,
dest
=
"rx_file"
,
help
=
"List of receiver URLs"
,
metavar
=
"FILE"
)
parser
.
add_option
(
"-r"
,
"--receivers"
,
dest
=
"rx_file"
,
help
=
"List of receiver URLs"
,
metavar
=
"FILE"
)
parser
.
add_option
(
"-g"
,
"--geofile"
,
dest
=
"geofile"
,
help
=
"GeoJSON Output File"
,
metavar
=
"FILE"
)
parser
.
add_option
(
"-g"
,
"--geofile"
,
dest
=
"geofile"
,
help
=
"GeoJSON Output File"
,
metavar
=
"FILE"
)
parser
.
add_option
(
"-e"
,
"--epsilon"
,
dest
=
"eps"
,
help
=
"Max Clustering Distance, Default
\"
auto
\"
.
0 to disable clustering.
"
,
parser
.
add_option
(
"-e"
,
"--epsilon"
,
dest
=
"eps"
,
help
=
"Max Clustering Distance, Default
\"
auto
\"
."
,
metavar
=
"NUMBER or
\"
auto
\"
"
,
default
=
"auto"
)
metavar
=
"NUMBER or
\"
auto
\"
"
,
default
=
"auto"
)
parser
.
add_option
(
"-c"
,
"--confidence"
,
dest
=
"conf"
,
help
=
"Minimum confidence value, default 10"
,
parser
.
add_option
(
"-c"
,
"--confidence"
,
dest
=
"conf"
,
help
=
"Minimum confidence value, default 10"
,
metavar
=
"NUMBER"
,
type
=
"int"
,
default
=
10
)
metavar
=
"NUMBER"
,
type
=
"int"
,
default
=
10
)
parser
.
add_option
(
"-p"
,
"--power"
,
dest
=
"pwr"
,
help
=
"Minimum power value, default 10"
,
parser
.
add_option
(
"-p"
,
"--power"
,
dest
=
"pwr"
,
help
=
"Minimum power value, default 10"
,
metavar
=
"NUMBER"
,
type
=
"int"
,
default
=
10
)
metavar
=
"NUMBER"
,
type
=
"int"
,
default
=
10
)
parser
.
add_option
(
"-m"
,
"--min-samples"
,
dest
=
"minsamp"
,
help
=
"Minimum samples per cluster. Default
20
"
,
parser
.
add_option
(
"-m"
,
"--min-samples"
,
dest
=
"minsamp"
,
help
=
"Minimum samples per cluster. Default
:
\"
auto
\"
"
,
metavar
=
"NUMBER
"
,
type
=
"int"
,
default
=
20
)
metavar
=
"NUMBER
or
\"
auto
\"
"
,
default
=
"auto"
)
parser
.
add_option
(
"--plot_intersects"
,
dest
=
"plotintersects"
,
help
=
"""Plots all the intersect points in a cluster.
parser
.
add_option
(
"--plot_intersects"
,
dest
=
"plotintersects"
,
help
=
"""Plots all the intersect points in a cluster.
Only applies when clustering is turned on. This creates larger CZML files."""
,
action
=
"store_true"
)
Only applies when clustering is turned on. This creates larger CZML files."""
,
action
=
"store_true"
)
parser
.
add_option
(
"-o"
,
"--offline"
,
dest
=
"disable"
,
help
=
"Starts program with receiver turned off."
,
parser
.
add_option
(
"-o"
,
"--offline"
,
dest
=
"disable"
,
help
=
"Starts program with receiver turned off."
,
...
...
views/cesium.tpl
View file @
e29153fc
...
@@ -250,11 +250,19 @@
...
@@ -250,11 +250,19 @@
const
clustering_en
=
document
.
getElementById
(
"clustering_en"
);
const
clustering_en
=
document
.
getElementById
(
"clustering_en"
);
if
(
minpointslider
!==
null
)
{
if
(
minpointslider
!==
null
)
{
parameter
+=
"minpts="
+
minpointslider
.
value
+
"&"
;
if
(
minpointslider
.
value
>
0
)
{
parameter
+=
"minpts="
+
minpointslider
.
value
+
"&"
;
}
else
{
parameter
+=
"minpts=auto&"
;
}
}
}
if
(
clustering_en
!==
null
)
{
if
(
clustering_en
!==
null
)
{
if
(
clustering_en
.
checked
)
{
if
(
clustering_en
.
checked
)
{
parameter
+=
"eps=auto&"
;
if
(
epsslider
.
value
==
0
)
{
parameter
+=
"eps=auto&"
;
}
else
{
parameter
+=
"eps="
+
epsslider
.
value
+
"&"
;
}
}
else
{
}
else
{
parameter
+=
"eps=0&"
;
parameter
+=
"eps=0&"
;
}
}
...
@@ -400,22 +408,22 @@
...
@@ -400,22 +408,22 @@
</span>
</span>
<span
class=
"slidevalue"
id=
"confidence"
></span>
<span
class=
"slidevalue"
id=
"confidence"
></span>
</div>
</div>
<
!-- <
div class="tooltip">
<div
class=
"tooltip"
>
<span
class=
"tooltiptext"
>
Epsilon:
<br>
<span
class=
"tooltiptext"
>
Epsilon:
<br>
Maximum distance between neighboring points in a cluster.
Set to 0 to disable clustering.
<br>
Maximum distance between neighboring points in a cluster.
<br>
Disabling clustering will plot all intersections and may cause longer load times.
</span>
</span>
<span
class=
"slidespan"
>
<span
class=
"slidespan"
>
<input name="epsilonValue" type="range" min="0" max="2" step="0.01" value="{
{
epsilon
}
}" class="slider" id="epsilonRange">
<input
name=
"epsilonValue"
type=
"range"
min=
"0"
max=
"2"
step=
"0.01"
value=
"{
{
0
if
epsilon
==
"auto"
else
epsilon
}
}"
class=
"slider"
id=
"epsilonRange"
>
</span>
</span>
<span
class=
"slidevalue"
id=
"epsilon"
></span>
<span
class=
"slidevalue"
id=
"epsilon"
></span>
</div>
</div>
<div
class=
"tooltip"
>
<div
class=
"tooltip"
>
<span class="tooltiptext">Minimum points per
cluster
</span>
<span
class=
"tooltiptext"
>
Minimum points per
sample in a cluster.
</span>
<span
class=
"slidespan"
>
<span
class=
"slidespan"
>
<input name="minpointValue" type="range" min="0" max="300" step="5" value="{
{
minpoints
}
}" class="slider" id="minpointRange">
<input
name=
"minpointValue"
type=
"range"
min=
"0"
max=
"300"
step=
"5"
value=
"{
{
0
if
minpoints
==
"auto"
else
minpoints
}
}"
class=
"slider"
id=
"minpointRange"
>
</span>
</span>
<span
class=
"slidevalue"
id=
"minpoints"
></span>
<span
class=
"slidevalue"
id=
"minpoints"
></span>
</div>
-->
</div>
<div
style=
"width: 600px"
>
<div
style=
"width: 600px"
>
<span
class=
"tooltip"
>
<span
class=
"tooltip"
>
<span
class=
"slidetitle"
><h4>
Clustering:
</h4></span>
<span
class=
"slidetitle"
><h4>
Clustering:
</h4></span>
...
@@ -424,7 +432,8 @@
...
@@ -424,7 +432,8 @@
<input
id=
"clustering_en"
name=
"clustering_en"
{
{
"checked"
if
epsilon
==
"auto"
else
""
}
}
type=
"checkbox"
onchange=
"updateParams()"
>
<input
id=
"clustering_en"
name=
"clustering_en"
{
{
"checked"
if
epsilon
==
"auto"
else
""
}
}
type=
"checkbox"
onchange=
"updateParams()"
>
<span
class=
"switchslider round"
></span>
<span
class=
"switchslider round"
></span>
</label></span>
</label></span>
<span
class=
"tooltiptext"
>
Turns clustering on or off. Clustering On will draw ellipses.
</span>
<span
class=
"tooltiptext"
>
Turns clustering on or off. Clustering On will draw ellipses.
Disabling clustering will plot all intersections and may cause longer load times.
</span>
</span>
</span>
</div>
</div>
<div
style=
"width: 600px"
>
<div
style=
"width: 600px"
>
...
@@ -452,13 +461,21 @@
...
@@ -452,13 +461,21 @@
var
confoutput
=
document
.
getElementById
(
"confidence"
);
var
confoutput
=
document
.
getElementById
(
"confidence"
);
confoutput
.
innerHTML
=
confslider
.
value
;
confoutput
.
innerHTML
=
confslider
.
value
;
// var epsslider = document.getElementById("epsilonRange");
var
epsslider
=
document
.
getElementById
(
"epsilonRange"
);
// var epsoutput = document.getElementById("epsilon");
var
epsoutput
=
document
.
getElementById
(
"epsilon"
);
// epsoutput.innerHTML = epsslider.value;
if
(
epsslider
.
value
==
0
)
{
epsoutput
.
innerHTML
=
"Auto"
;
}
else
{
epsoutput
.
innerHTML
=
epsslider
.
value
;
}
// var minpointslider = document.getElementById("minpointRange");
var
minpointslider
=
document
.
getElementById
(
"minpointRange"
);
// var minpointoutput = document.getElementById("minpoints");
var
minpointoutput
=
document
.
getElementById
(
"minpoints"
);
// minpointoutput.innerHTML = minpointslider.value;
if
(
minpointslider
.
value
==
0
)
{
minpointoutput
.
innerHTML
=
"Auto"
;
}
else
{
minpointoutput
.
innerHTML
=
minpointslider
.
value
;
}
var
rx_enable
=
document
.
getElementById
(
"rx_en"
);
var
rx_enable
=
document
.
getElementById
(
"rx_en"
);
...
@@ -466,12 +483,16 @@
...
@@ -466,12 +483,16 @@
// var clustering_en = document.getElementById("clustering_en");
// var clustering_en = document.getElementById("clustering_en");
// Update the current slider value (each time you drag the slider handle)
// Update the current slider value (each time you drag the slider handle)
// epsslider.oninput = function() {
epsslider
.
oninput
=
function
()
{
// epsoutput.innerHTML = this.value;
if
(
this
.
value
>
0
)
{
// }
epsoutput
.
innerHTML
=
this
.
value
;
// epsslider.onpointerup = function() {
}
else
{
// updateParams("");
epsoutput
.
innerHTML
=
"Auto"
;
// }
}
}
epsslider
.
onpointerup
=
function
()
{
updateParams
(
""
);
}
powerslider
.
oninput
=
function
()
{
powerslider
.
oninput
=
function
()
{
poweroutput
.
innerHTML
=
this
.
value
;
poweroutput
.
innerHTML
=
this
.
value
;
}
}
...
@@ -484,12 +505,16 @@
...
@@ -484,12 +505,16 @@
confslider
.
onpointerup
=
function
()
{
confslider
.
onpointerup
=
function
()
{
updateParams
(
"minconf="
+
this
.
value
);
updateParams
(
"minconf="
+
this
.
value
);
}
}
// minpointslider.oninput = function() {
minpointslider
.
oninput
=
function
()
{
// minpointoutput.innerHTML = this.value;
if
(
this
.
value
>
0
)
{
// }
minpointoutput
.
innerHTML
=
this
.
value
;
// minpointslider.onpointerup = function() {
}
else
{
// updateParams("");
minpointoutput
.
innerHTML
=
"Auto"
;
// }
}
}
minpointslider
.
onpointerup
=
function
()
{
updateParams
(
""
);
}
rx_enable
.
onchange
=
function
()
{
rx_enable
.
onchange
=
function
()
{
if
(
rx_enable
.
checked
)
{
if
(
rx_enable
.
checked
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment