Skip to content

Commit

Permalink
Add main page acceleration plots
Browse files Browse the repository at this point in the history
  • Loading branch information
JHartzer committed Sep 28, 2024
1 parent b57786b commit a8ef1c3
Show file tree
Hide file tree
Showing 10 changed files with 234 additions and 22 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*/__pycache__/

# Generated Docs
docs/doxygen/html
docs/doxygen/html/*
!docs/doxygen/html/images
!docs/doxygen/html/includes
docs/doxygen/latex
docs/software/cloc.md

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ To run and plot in sequence, utilize [evaluate.py](eval/evaluate.py)
python3 eval/evaluate.py config/example.yaml
```

This will generate and run the requested number of simulation runs for the specified run time and
produce plots of the Monte Carlo data.
This will generate and run the requested number of simulation runs for the specified run time and produce plots of the Monte Carlo data. For example, the report generates plots of the body acceleration estimates and the true error in those acceleration estimates.

![acceleration](docs/doxygen/html/images/acceleration.png)
![acceleration-error](docs/doxygen/html/images/acceleration-error.png)

### Launch ROS2 Node

Expand Down
Binary file added docs/doxygen/html/images/acceleration-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/doxygen/html/images/acceleration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions docs/doxygen/html/includes/Body_Acceleration.html

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions docs/doxygen/html/includes/Body_Acceleration_Error.html

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions docs/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ To run and plot in sequence, utilize [evaluate.py](../../../eval/evaluate.py)
python3 eval/evaluate.py config/example.yaml
```

This will generate and run the requested number of simulation runs for the specified run time and
produce plots of the Monte Carlo data.
This will generate and run the requested number of simulation runs for the specified run time and produce plots of the Monte Carlo data. For example, the report generates plots of the body acceleration estimates and the true error in those acceleration estimates.

\htmlonly
<embed type="text/html" src="includes/Body_Acceleration.html" width="100%" height="320pt">
<embed type="text/html" src="includes/Body_Acceleration_Error.html" width="100%" height="320pt">
\endhtmlonly

### Launch ROS2 Node

Expand Down
40 changes: 23 additions & 17 deletions eval/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
import os

from bokeh.embed import components
from bokeh.models import BoxZoomTool, FullscreenTool, PanTool, ResetTool, \
from bokeh.models import BoxZoomTool, FullscreenTool, PanTool, Paragraph, ResetTool, \
SaveTool, Spacer, Tabs, WheelZoomTool
from bokeh.plotting import curdoc, figure, save
from bokeh.themes import Theme
from input_parser import InputParser
from tab_body import tab_body
from tab_fiducial import tab_fiducial
Expand Down Expand Up @@ -112,6 +113,25 @@ def plot_sim_results(config_sets, args):
]
if (fig.legend):
fig.legend.click_policy = 'hide'
if not args.light:
theme = Theme(os.path.join(os.path.dirname(
os.path.abspath(__file__)), 'theme-dark.yaml'))
template = """
{% block preamble %}
<style>
body {
background: #1C1D1F;
color: #fff;
}
</style>
{% endblock %}
"""
else:
theme = Theme(os.path.join(os.path.dirname(
os.path.abspath(__file__)), 'theme-light.yaml'))
template = """"""

curdoc().theme = theme

if (args.embed):
if not os.path.exists(os.path.join(plot_dir, 'js')):
Expand All @@ -121,30 +141,16 @@ def plot_sim_results(config_sets, args):
for tab in tabs:
for row in tab.child.children:
for fig in row.children:
if isinstance(fig, Spacer):
if isinstance(fig, Spacer) or isinstance(fig, Paragraph):
continue
title = fig.title.text.replace(' ', '_')
script, div = components(fig, wrap_script=False)
script, div = components(fig, wrap_script=False, theme=theme)
with open(os.path.join(plot_dir, 'js', f'{title}.js'), 'w') as f:
f.write(script)

with open(os.path.join(plot_dir, 'html', f'{title}.html'), 'w') as f:
f.write(div)
else:
if not args.light:
curdoc().theme = 'dark_minimal'

template = """
{% block preamble %}
<style>
body {
background: #15191c;
color: #fff;
}
</style>
{% endblock %}
"""

save(
obj=Tabs(tabs=tabs, sizing_mode='stretch_width'),
filename=os.path.join(plot_dir, f'{config_name}-report.html'),
Expand Down
51 changes: 51 additions & 0 deletions eval/theme-dark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
attrs:
Plot:
background_fill_color: '#20262B'
# border_fill_color: '#15191C'
border_fill_color: '#1C1D1F'
outline_line_color: '#E0E0E0'
outline_line_alpha: 0.25
Grid:
grid_line_color: '#E0E0E0'
grid_line_alpha: 0.25
Axis:
major_tick_line_alpha: 0
major_tick_line_color: '#E0E0E0'
minor_tick_line_alpha: 0
minor_tick_line_color: '#E0E0E0'
axis_line_alpha: 0
axis_line_color: '#E0E0E0'
major_label_text_color: '#E0E0E0'
major_label_text_font: 'Helvetica'
major_label_text_font_size: '1.025em'
axis_label_standoff: 10
axis_label_text_color: '#E0E0E0'
axis_label_text_font: 'Helvetica'
axis_label_text_font_size: '1.25em'
axis_label_text_font_style: 'normal'
Legend:
spacing: 8
glyph_width: 15
label_standoff: 8
label_text_color: '#E0E0E0'
label_text_font: 'Helvetica'
label_text_font_size: '1.025em'
border_line_alpha: 0
background_fill_alpha: 0.25
background_fill_color: '#20262B'
BaseColorBar:
title_text_color: '#E0E0E0'
title_text_font: 'Helvetica'
title_text_font_size: '1.025em'
title_text_font_style: 'normal'
major_label_text_color: '#E0E0E0'
major_label_text_font: 'Helvetica'
major_label_text_font_size: '1.025em'
# background_fill_color: '#15191C'
background_fill_color: '#15191C'
major_tick_line_alpha: 0
bar_line_alpha: 0
Title:
text_color: '#E0E0E0'
text_font: 'Helvetica'
text_font_size: '1.15em'
49 changes: 49 additions & 0 deletions eval/theme-light.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
attrs:
Axis:
major_tick_line_alpha: 0
major_tick_line_color: '#5B5B5B'
minor_tick_line_alpha: 0
minor_tick_line_color: '#5B5B5B'
axis_line_alpha: 0
axis_line_color: '#5B5B5B'
major_label_text_color: '#5B5B5B'
major_label_text_font: 'Helvetica'
major_label_text_font_size: '1.025em'
axis_label_standoff: 10
axis_label_text_color: '#5B5B5B'
axis_label_text_font: 'Helvetica'
axis_label_text_font_size: '1.25em'
axis_label_text_font_style: 'normal'
Legend:
spacing: 8
glyph_width: 15
label_standoff: 8
label_text_color: '#5B5B5B'
label_text_font: 'Helvetica'
label_text_font_size: '1.025em'
border_line_alpha: 0
background_fill_alpha: 0.25
# background_fill_color: '#20262B'
BaseColorBar:
title_text_color: '#5B5B5B'
title_text_font: 'Helvetica'
title_text_font_size: '1.025em'
title_text_font_style: 'normal'
major_label_text_color: '#5B5B5B'
major_label_text_font: 'Helvetica'
major_label_text_font_size: '1.025em'
# background_fill_color: '#15191C'
major_tick_line_alpha: 0
bar_line_alpha: 0
Title:
text_color: '#5B5B5B'
text_font: 'Helvetica'
text_font_size: '1.15em'
# Plot:
# background_fill_color: '#20262B'
# border_fill_color: '#15191C'
# outline_line_color: '#E0E0E0'
# outline_line_alpha: 0.25
# Grid:
# grid_line_color: '#E0E0E0'
# grid_line_alpha: 0.25

0 comments on commit a8ef1c3

Please sign in to comment.