This script is a basic demonstration of a script that can be used to plot Monte Carlo data with bokeh and datashaders. These tools are very efficient to plot large amounts of simulation data that is likely to occur with Monte Carlo sensitivity analysis studies. For example, running this script will create an HTML interactive view of the simulation data. Instead of seeing a fixed resolution, the user can zoom into the data dynamically to see more detail. This process recreates a newly render view of the simulation data.

The following two plots illustrate what this particular simulation setup will yield.


Figure 1: Full view of the attitude error plot data


Figure 2: Zoomed in and nearly rendered view of the attitude error data details

The next plot illustrates the output if you run with more simulation cases, 40 in this plot.


Figure 3: Larger simulation run with 40 simulation cases shown

Configuring a Python Environment For this Script


Running this script is different from running other BSK scripts. There are very particular python package requirements that must be carefully followed. It is recommended the user create a virtual python environment as discussed in the installation setup. This environment might have to be specific to running this script because of these dependency challenges.

The setup steps are as follows:

  1. The datashaders etc. require that this script be run with Python 3.7, not higher

  2. Create dedicated virtual environment and compile Basilisk for this environment

  3. Install this particular version of panel package first. It must be done alone as it upgrades bokeh to a version that is too new:

    pip3 install --upgrade panel==0.9.7
  4. Next, install the following particular python package versions:

    pip3 install --upgrade bokeh==1.2.0 holoviews==1.12.3 param==1.9.3 hvplot==0.6.0

How to Run the Script


Read all three steps before advancing.

The next steps outline how to run this script.

  1. This script can only be run once there exists data produced by the script.

  2. At the bottom of this script, comment out the name guard and associated run() statement, and un-comment the following run() statement before this script can run. These lines are provided in their commented/uncommented form to ensure that the sphinx documentation generation process does not run this script automatically.

  3. This script must be called from command line using:

    /$path2bin/bokeh serve --show /$path2script/

This will process the data created with and open a browser window showing Figure 1 above. To end the script you need to press the typical key strokes to interrupt a process as the bokeh server will keep running until stopped.


This is the function to populate with all of the plots to be generated using datashaders and bokeh. Each variable requires a call to pull_and_format_df() to ensure the dataframe will be compatible with the developed datashader utilities.


dataDir – (str) directory containing all of the dataframes created from the Monte Carlo run

Returns: List of DS_Plots[source]

This script is meant to be configured based on the user’s needs. It can be configured using the following three booleans:

First, set show_all_data = True to get a broad view of the data and find a time window to investigate closer.

Once the data is characterized, the user can set show_extreme_data = True to look at specific run cases within the window.

Finally, the user can set show_optional_data = True to look at any extra data to determine why the extrema cases exist.

  • show_all_data – plot all MC runs for the plots specified in the plotSuite method

  • show_extreme_data – call plotSuite method for user-defined number of extrema MC runs

  • optional_plots – plots additional user-defined plots