Skip to content

Plotting Tools

Steven A White edited this page Dec 10, 2021 · 1 revision

Plotting

There are a few ways to plot results .csv files generated by running a biogears scenario: 

Running verification through the project window in Visual Studio  Using the python plotting tool Visual Studio

To run a batch job of all verification scenario you need to build the verification project through the visual studio IDE. This will run the java scenario driver/plotting tool and output the graphs in ./Scenarios

Figure 1: These validation project will run all associated scenarios and plot output. Right click and select build to batch run (and plot

Python Plotting Tool: 

The python plotting tool, allows for specific scenario plotting. If you just want to run one scenario (instead of in batch, as above) run the scenario either through the command line. Once the scenario has generated the appropriate *results.csv file, open a command line and navigate to the /runtime directory and point the python tool to the generated results file: 

python ../../share/python/bg-plotter.py --root Scenarios EnergyEnvironment/ExerciseSustainedResults.csv

This is running the python script bg-plotter.py, specifying the --root directory to be the Scenarios folder (where output is dumped) and the second argument is the scenario results file you are interested in (in this case it is the ExerciseSustainedResults.csv file). Other arguments include; 

--baselines: to set an alternative baselines directory for comparison plotting 
--outdir: specify where the plots folder will generate 
--skip: skipping lines to increase speed of plotting (will skip data)
-v: adjust how much is output to the console window
-r: recursively plot into a folder hierarchy (say you want to plot the entire Scenarios folder) 
-c: remove output directories before plotting (clean) 

Figure 2: Example use case to plot an exercise scenario

In general you might want to plot your current simulation against the baseline values found in the verification folder (should be done before submitting pull requests). To do this (assuming you are running in the runtime directory). the command would be: 

python ../../share/python/bg-plotter.py --root Scenarios --baselines ../../../verification/core/Scenarios EnergyEnvironment/ExerciseSustainedResults.csv

Note: verification also contains a lite folder for BG lite baselines

Ex: Plotting the entire patient folder with baselines:

python ../../share/python/bg-plotter.py -r --root Scenarios --baselines ../../../verification/core/Scenarios Patient/

Python Rebase Tool: 

The python rebase tool, allows for easy scenario zip and rebase. 

bg-rebase-py -v --outdir <path> archive -r Scenarios

It is important to pay attention to the path with the new lite baselines being tracked as well. Be sure to identify which set of baselines is being overwritten.

``