Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
wendelin
Commits
4d1d87b5
Commit
4d1d87b5
authored
Aug 19, 2024
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_wendelin_drone: update to new timestamping format
parent
cec5d58c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
49 deletions
+45
-49
bt5/erp5_wendelin_drone/PathTemplateItem/portal_callables/DataAnalysisLine_convertDroneDataArrayToScoreArray.py
...les/DataAnalysisLine_convertDroneDataArrayToScoreArray.py
+45
-49
No files found.
bt5/erp5_wendelin_drone/PathTemplateItem/portal_callables/DataAnalysisLine_convertDroneDataArrayToScoreArray.py
View file @
4d1d87b5
...
...
@@ -39,7 +39,16 @@ def rated_value(next_value, previous_value, rate):
def
nparray_to_dataframe
(
nparray
):
return
pd
.
DataFrame
(
data
=
nparray
.
getArray
(),
columns
=
[
"timestamp (ms)"
,
"latitude ()"
,
"longitude ()"
,
"AMSL (m)"
,
"rel altitude (m)"
,
"yaw ()"
,
"ground speed (m/s)"
,
"climb rate (m/s)"
],
columns
=
[
'timestamp (ms)'
,
'latitude ()'
,
'longitude ()'
,
'AMSL (m)'
,
'rel altitude (m)'
,
'yaw ()'
,
'ground speed (m/s)'
,
'climb rate (m/s)'
,
],
)
...
...
@@ -95,70 +104,57 @@ if seen_sims is None:
simulated_flight_list
=
[]
simulated_flights_value_dict_list
=
[]
selected_simulation_data_dict_list
=
[]
if
len
([
x
for
x
in
sim_flight_names
if
x
not
in
seen_sims
])
==
0
:
return
not_seen_list
=
[
x
for
x
in
sim_flight_names
if
x
not
in
seen_sims
]
if
len
(
not_seen_list
)
==
0
:
return
distance_criterion_tuple
=
(
'latitude ()'
,
'longitude ()'
,
'AMSL (m)'
,
'ground speed (m/s)'
,
'climb rate (m/s)'
,
)
not_seen_list
=
[
x
for
x
in
sim_flight_names
if
x
not
in
seen_sims
]
for
name
in
not_seen_list
[:]:
for
name
in
not_seen_list
:
if
name
[:
14
]
==
'simulation_log'
:
splitted_filename
=
name
[:
-
4
].
split
(
'_'
)
distance_list_tuple
=
([],[],
[],
[],
[])
simulated_flight
=
nparray_to_dataframe
(
sim_array
.
get
(
name
))
simulated_flight
=
simulated_flight
.
applymap
(
lambda
value
:
np
.
format_float_scientific
(
float
(
value
))
if
isinstance
(
value
,
str
)
and
'e'
in
value
else
value
)
simulated_flight_list
.
append
(
simulated_flight
)
max_simulator_timestamp
=
simulated_flight
[
"timestamp (ms)"
].
max
()
min_simulator_timestamp
=
simulated_flight
[
"timestamp (ms)"
].
min
()
tmp_sim
=
{
'longitude'
:
[],
'latitude'
:
[],
'asml'
:
[],
'ground_speed'
:
[],
'climb_rate'
:
[]
}
tmp_real
=
{
'longitude'
:
[],
'latitude'
:
[],
'asml'
:
[],
'ground_speed'
:
[],
'climb_rate'
:
[]
}
timestamp_diff
=
simulated_flight
[
'timestamp (ms)'
].
min
()
-
real_flight
[
'timestamp (ms)'
].
min
()
max_simulator_timestamp
=
simulated_flight
[
'timestamp (ms)'
].
max
()
-
timestamp_diff
tmp_sim
=
{
k
:
[]
for
k
in
distance_criterion_tuple
}
tmp_real
=
{
k
:
[]
for
k
in
distance_criterion_tuple
}
for
idx
,
row
in
real_flight
.
iterrows
():
if
max_simulator_timestamp
<
row
[
"timestamp (ms)"
]:
if
max_simulator_timestamp
<
row
[
'timestamp (ms)'
]:
break
if
min_simulator_timestamp
>
row
[
"timestamp (ms)"
]:
try
:
under_timestamp
=
simulated_flight
[
simulated_flight
[
'timestamp (ms)'
]
-
timestamp_diff
<
row
[
'timestamp (ms)'
]].
tail
(
1
)
except
IndexError
:
continue
over_timestamp
=
simulated_flight
[
simulated_flight
[
"timestamp (ms)"
]
>=
row
[
"timestamp (ms)"
]].
head
(
1
)
under_timestamp
=
simulated_flight
[
simulated_flight
[
"timestamp (ms)"
]
<=
row
[
"timestamp (ms)"
]].
tail
(
1
)
rate
=
(
float
(
over_timestamp
[
"timestamp (ms)"
])
-
row
[
"timestamp (ms)"
])
/
(
float
(
over_timestamp
[
"timestamp (ms)"
])
-
float
(
under_timestamp
[
"timestamp (ms)"
]))
tmp_sim
[
"latitude"
].
append
(
rated_value
(
float
(
over_timestamp
[
"latitude ()"
]),
float
(
under_timestamp
[
"latitude ()"
]),
rate
))
tmp_sim
[
"longitude"
].
append
(
rated_value
(
float
(
over_timestamp
[
"longitude ()"
]),
float
(
under_timestamp
[
"longitude ()"
]),
rate
))
tmp_sim
[
"asml"
].
append
(
rated_value
(
float
(
over_timestamp
[
"AMSL (m)"
]),
float
(
under_timestamp
[
"AMSL (m)"
]),
rate
))
tmp_sim
[
"ground_speed"
].
append
(
rated_value
(
float
(
over_timestamp
[
"ground speed (m/s)"
]),
float
(
under_timestamp
[
"ground speed (m/s)"
]),
rate
))
tmp_sim
[
"climb_rate"
].
append
(
rated_value
(
float
(
over_timestamp
[
"climb rate (m/s)"
]),
float
(
under_timestamp
[
"climb rate (m/s)"
]),
rate
))
tmp_real
[
"latitude"
].
append
(
row
[
"latitude ()"
])
tmp_real
[
"longitude"
].
append
(
row
[
"longitude ()"
])
tmp_real
[
"asml"
].
append
(
row
[
"AMSL (m)"
])
tmp_real
[
"ground_speed"
].
append
(
row
[
"ground speed (m/s)"
])
tmp_real
[
"climb_rate"
].
append
(
row
[
"climb rate (m/s)"
])
over_timestamp
=
simulated_flight
[
simulated_flight
[
'timestamp (ms)'
]
-
timestamp_diff
>=
row
[
'timestamp (ms)'
]].
head
(
1
)
rate
=
(
float
(
over_timestamp
[
"timestamp (ms)"
])
-
timestamp_diff
-
row
[
"timestamp (ms)"
])
/
(
float
(
over_timestamp
[
"timestamp (ms)"
])
-
float
(
under_timestamp
[
"timestamp (ms)"
]))
for
criterion
in
distance_criterion_tuple
:
tmp_sim
[
criterion
].
append
(
rated_value
(
float
(
over_timestamp
[
criterion
]),
float
(
under_timestamp
[
criterion
]),
rate
))
tmp_real
[
criterion
].
append
(
row
[
criterion
])
for
index
,
value
in
enumerate
((
row
[
"timestamp (ms)"
]
/
1000
,
distance
(
row
[
"latitude ()"
],
row
[
"longitude ()"
],
rated_value
(
float
(
over_timestamp
[
"latitude ()"
]),
float
(
under_timestamp
[
"latitude ()"
]),
rate
),
rated_value
(
float
(
over_timestamp
[
"longitude ()"
]),
float
(
under_timestamp
[
"longitude ()"
]),
rate
),
row
[
'timestamp (ms)'
]
/
1000
,
distance
(
row
[
'latitude ()'
],
row
[
'longitude ()'
],
tmp_sim
[
'latitude ()'
][
-
1
],
tmp_sim
[
'longitude ()'
][
-
1
],
),
rated_value
(
float
(
over_timestamp
[
"AMSL (m)"
]),
float
(
under_timestamp
[
"AMSL (m)"
]),
rate
)
-
row
[
"AMSL (m)"
],
rated_value
(
float
(
over_timestamp
[
"ground speed (m/s)"
]),
float
(
under_timestamp
[
"ground speed (m/s)"
]),
rate
)
-
row
[
"ground speed (m/s)"
],
rated_value
(
float
(
over_timestamp
[
"climb rate (m/s)"
]),
float
(
under_timestamp
[
"climb rate (m/s)"
]),
rate
)
-
row
[
"climb rate (m/s)"
]
tmp_sim
[
'AMSL (m)'
][
-
1
],
tmp_sim
[
'ground speed (m/s)'
][
-
1
],
tmp_real
[
'climb rate (m/s)'
][
-
1
]
)):
distance_list_tuple
[
index
].
append
(
value
)
...
...
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