Skip to content

Commit 4c958eb

Browse files
Add altitude plot in positions_vs_time, add dataset name in title of auv_path and positions_vs_time plots, add altitude to tooltips in auv_path plot
1 parent 85a042a commit 4c958eb

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

src/auv_nav/plot/plot_process_data.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ def plot_positions_vs_time(
385385
ekf_list,
386386
camera1_ekf_list,
387387
output_folder: Path,
388+
title: Optional[str] = None,
388389
):
389390
Console.info("Plotting positions_vs_time...")
390391

@@ -397,17 +398,20 @@ def plot_positions_vs_time(
397398
dr_n = [i.northings for i in dead_reckoning_dvl_list]
398399
dr_e = [i.eastings for i in dead_reckoning_dvl_list]
399400
dr_d = [i.depth for i in dead_reckoning_dvl_list]
401+
dr_a = [i.altitude for i in dead_reckoning_dvl_list]
400402

401403
ekf_t = [datetime.datetime.fromtimestamp(t.epoch_timestamp, datetime.timezone.utc) for t in ekf_list]
402404
ekf_n = [i.northings for i in ekf_list]
403405
ekf_e = [i.eastings for i in ekf_list]
404406
ekf_d = [i.depth for i in ekf_list]
407+
ekf_a = [i.altitude for i in ekf_list]
405408

406409
cam1_te = [i.epoch_timestamp for i in camera1_ekf_list]
407410
cam1_t = [datetime.datetime.fromtimestamp(t, datetime.timezone.utc) for t in cam1_te]
408411
cam1_n = [i.northings for i in camera1_ekf_list]
409412
cam1_e = [i.eastings for i in camera1_ekf_list]
410413
cam1_d = [i.depth for i in camera1_ekf_list]
414+
cam1_a = [i.altitude for i in camera1_ekf_list]
411415
cam1_filenames = [i.filename for i in camera1_ekf_list]
412416

413417
tr_usbl_n = create_trace(usbl_t, usbl_n, "USBL", "pink", legendgroup="group_usbl")
@@ -416,9 +420,11 @@ def plot_positions_vs_time(
416420
tr_dr_n = create_trace(dr_t, dr_n, "DVL Dead Reckoning", "purple", legendgroup="group_dr")
417421
tr_dr_e = create_trace(dr_t, dr_e, "DVL Dead Reckoning", "purple", legendgroup="group_dr", showlegend=False)
418422
tr_dr_d = create_trace(dr_t, dr_d, "DVL Dead Reckoning", "purple", legendgroup="group_dr", showlegend=False)
423+
tr_dr_a = create_trace(dr_t, dr_a, "DVL Dead Reckoning", "purple", legendgroup="group_dr", showlegend=False)
419424
tr_ekf_n = create_trace(ekf_t, ekf_n, "EKF", "orange", legendgroup="group_ekf")
420425
tr_ekf_e = create_trace(ekf_t, ekf_e, "EKF", "orange", legendgroup="group_ekf", showlegend=False)
421426
tr_ekf_d = create_trace(ekf_t, ekf_d, "EKF", "orange", legendgroup="group_ekf", showlegend=False)
427+
tr_ekf_a = create_trace(ekf_t, ekf_a, "EKF", "orange", legendgroup="group_ekf", showlegend=False)
422428
hoverinfo = "x+y+text"
423429
cam1_hovertext = [
424430
f"timestamp: {t} (epoch)<br>"
@@ -454,11 +460,21 @@ def plot_positions_vs_time(
454460
hovertext=cam1_hovertext,
455461
showlegend=False
456462
)
463+
tr_cam1_ekf_a = create_trace(
464+
cam1_t,
465+
cam1_a,
466+
"Camera1 EKF",
467+
"red",
468+
legendgroup="group_cam1_ekf",
469+
hoverinfo=hoverinfo,
470+
hovertext=cam1_hovertext,
471+
showlegend=False
472+
)
457473

458474
fig = subplots.make_subplots(
459475
rows=2,
460476
cols=2,
461-
subplot_titles=("Northing", "Easting", "Depth"),
477+
subplot_titles=("Northing", "Easting", "Depth", "Altitude"),
462478
print_grid=False,
463479
)
464480
fig.append_trace(tr_usbl_n, 1, 1)
@@ -476,14 +492,20 @@ def plot_positions_vs_time(
476492
fig.append_trace(tr_ekf_d, 2, 1)
477493
fig.append_trace(tr_cam1_ekf_d, 2, 1)
478494

495+
fig.append_trace(tr_dr_a, 2, 2)
496+
fig.append_trace(tr_ekf_a, 2, 2)
497+
fig.append_trace(tr_cam1_ekf_a, 2, 2)
498+
479499
fig["layout"]["xaxis1"].update(title="Date - Time (UTC)")
480500
fig["layout"]["xaxis2"].update(title="Date - Time (UTC)")
481501
fig["layout"]["xaxis3"].update(title="Date - Time (UTC)")
502+
fig["layout"]["xaxis4"].update(title="Date - Time (UTC)")
482503
fig["layout"]["yaxis1"].update(title="Northing, m")
483504
fig["layout"]["yaxis2"].update(title="Easting, m")
484505
fig["layout"]["yaxis3"].update(title="Depth, m", autorange="reversed")
506+
fig["layout"]["yaxis4"].update(title="Altitude, m")
485507
fig["layout"].update(
486-
title="Position vs. Time",
508+
title=(title + " " if title is not None else "") + "Position vs. Time",
487509
dragmode="pan",
488510
hovermode="closest",
489511
)
@@ -1433,6 +1455,7 @@ def plot_2d_deadreckoning(
14331455
usbl_list_no_dist_filter,
14341456
usbl_list,
14351457
plotlypath,
1458+
title: Optional[str] = None,
14361459
):
14371460
# DR plotly slider *include toggle button that switches between lat lon
14381461
# and north east
@@ -1467,8 +1490,9 @@ def plot_2d_deadreckoning(
14671490
figure = {"data": [], "layout": {}, "frames": []}
14681491

14691492
# fill in most of layout
1470-
figure["layout"]["xaxis"] = {"title": "Eastings,m"}
1471-
figure["layout"]["yaxis"] = {"title": "Northings,m", "scaleanchor": "x"}
1493+
figure["layout"]["title"] = title + " AUV Path" if title else "AUV Path"
1494+
figure["layout"]["xaxis"] = {"title": "Eastings, m"}
1495+
figure["layout"]["yaxis"] = {"title": "Northings, m", "scaleanchor": "x"}
14721496
figure["layout"]["hovermode"] = "closest"
14731497
figure["layout"]["dragmode"] = "pan"
14741498

@@ -1495,6 +1519,7 @@ def plot_2d_deadreckoning(
14951519
)[:-3]
14961520
+ " (UTC)"
14971521
+ f"<br>depth: {j.depth} m"
1522+
+ ("" if "usbl" in i[0] else f"<br>altitude: {j.altitude} m")
14981523
+ (f"<br>filename: {j.filename}" if hasattr(j, "filename") else "")
14991524
for j in i[1]
15001525
]

src/auv_nav/process.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,7 @@ def process(
16511651
ekf_list,
16521652
camera1_ekf_list,
16531653
plotlypath,
1654+
filepath.name,
16541655
],
16551656
)
16561657
t.start()
@@ -1711,6 +1712,7 @@ def process(
17111712
usbl_list_no_dist_filter,
17121713
usbl_list,
17131714
plotlypath,
1715+
filepath.name,
17141716
],
17151717
)
17161718
t.start()

0 commit comments

Comments
 (0)