FrickTobias / BLR

MIT License
6 stars 5 forks source link

Plot figures for summary report #199

Closed pontushojer closed 4 years ago

pontushojer commented 4 years ago

Added multiple figures for summary report under new cli tool plot. The idea behind it is to be generate plots separately from the data generation. The new plot script can easily be added to to either add new plot types or new data files.

Add new plots

To add a new plot for existing data add a section under the plot_* function for the requested data that follows the template below.

# Description of plot
# - x = description of value on x-axis
# - y = description of value on y-axis
with Plot("My plot title", output_dir=directory) as (fig, ax):
   data["MyParameter"].plot(ax=ax)
   ax.set_xlabel("X-values")
   ax.set_ylabel("Y-values")

The Plot class is used to handle the title, file-naming and file saving.

Add new data file

  1. Update ACCEPTED_FILES with the data file name.
  2. Add a data processing function, e.g process_my_data, that reads in the data file and creates a pandas.Dataframe object that is used by the plotting function (see 3.).
  3. Add a data plotting function, e.g plot_my_data, that plots new figures using the template described in Add new plots.
  4. Update name_to_function in main() to include the new file name and processing function