pyretis.inout.plotting package

This package contains functions for setting up plotters.

Specifically it defines colors, color schemes and a function for selecting a plotter.

Here we also hard-code some color schemes which may be useful for the plotting:

  • the colorblind 10 scheme [cb10],
  • the deep color scheme from the seaborn project [deep] and
  • the husl color scheme [husl].

Package structure

Modules

__init__.py
This file, handles imports for PyRETIS and defines some colors and the method for creating a plotter.
mpl_plotting.py (pyretis.inout.plotting.mpl_plotting)
Methods for generating plots using matplotlib.
plotting.py (pyretis.inout.plotting.plotting)
Definition of a generic base class for the plotter(s).

Important methods defined here

create_plotter (create_plotter())
Method to create a plotter.

Folders

styles
This folder contains style files for matplotlib which are used by PyRETIS.

References

[cb10]The colorblind_10 color scheme, https://jiffyclub.github.io/palettable/tableau/
[deep]The deep color scheme, from the seaborn project http://stanford.edu/~mwaskom/software/seaborn/index.html
[husl]The husl color scheme, http://www.husl-colors.org/
pyretis.inout.plotting.create_plotter(plot_settings, out_dir=None)[source]

Function to create a plotter.

The input plot settings is assumed to be a dictionary which we use for creating the plotter. In case the plot settings is not given, we just return None. We are here assuming that they are not given simply because we do not want to create a plotter.

Parameters:
  • plot_settings (dict) – These are the settings to create the plotter from. Here, we look for the keys plotter, output and style which defines the plotter to use, the output format and the style to use.
  • out_dir (string, optional) – This string selects if and where the output should be written to. It’s mainly used for internal purposes to save the report files to a specific directory.
Returns:

out – This is a object which can be used for plotting.

Return type:

object like MplPlotter

pyretis.inout.plotting.mpl_plotting module

Functions for generating plots using matplotlib.

This module defines a plotter class for matplotlib and it also defines some standard plots that are used in the analysis.

Important classes defined here

MplPlotter (MplPlotter)
A class for plotting with matplotlib.

Important methods defined here

mpl_set_style (mpl_set_style())
Method for setting the style for the plots, typically used here to load the PyRETIS style.
class pyretis.inout.plotting.mpl_plotting.MplPlotter(out_fmt, backup=False, style=None, out_dir=None)[source]

Bases: pyretis.inout.plotting.plotting.Plotter

A plotter using matplotlib.

This class defines a plotter which make use of matplotlib and it can be used as a starting point to create other plotters for PyRETIS bases on other tools (e.g. gnuplot etc.).

style

string – Defines what style to use for the plotting.

out_fmt

string – Selects format for output plots.

output_energy(results, energies)[source]

Plot energy results using mpl_plot_energy().

The parameters for this method is described in mpl_plot_energy().

Returns:out – This dict contains the files created by the plotting.
Return type:dict
output_flux(results)[source]

Plot flux results using py:func:.mpl_plot_flux.

The parameters for this method is described in mpl_plot_flux().

Returns:outputfile – A list containing the files created for the flux and for the error in the flux.
Return type:list of dicts

Note

The returned list is used to plot the figures in pairs.

output_matched_probability(path_ensembles, detect, matched)[source]

Plot matched probabilities using mpl_plot_matched()

The parameters for this method is described in mpl_plot_matched().

Returns:out – This dict contains the files created by the plotting.
Return type:dict
output_orderp(results, orderdata)[source]

Plot order parameter data using mpl_plot_orderp().

The parameters for this method is described in mpl_plot_orderp().

Returns:out – This dict contains the files created by the plotting.
Return type:dict
output_path(results, path_ensemble)[source]

Plot path results using mpl_plot_path().

The parameters for this method is described in mpl_plot_path().

Returns:out – This dict contains the files created by the plotting.
Return type:dict

pyretis.inout.plotting.plotting module

Definition of the base class for the plotter.

This module just defines a base class for plotters. This is just to ensure that all plotters at least implements some functions and that we can make use of them.

Important classes defined here

Plotter (Plotter)
A generic class for creating plots.
class pyretis.inout.plotting.plotting.Plotter(backup=True, plotter_type=None, out_dir=None)[source]

Bases: object

Base class for PyRETIS plotters.

This class defines a plotter. A plotter is just a object that supports certain functions which can be called by analysis output functions. It should define certain plots and the Plotter class is an abstract class just to make sure that all plotters define the needed plots.

backup

boolean – Determines if we overwrite old files or try to back them up.

plotter_type

string – Defines a name for the plotter, in case we want to identify it.

out_dir

string, optional – Defines an output directory for the plotter.

__str__()[source]

Just print out the basic info.

output_energy(results, energies)[source]

Function that plots energy results.

output_flux(results)[source]

Function that plots flux results.

output_matched_probability(path_ensembles, detect, matched)[source]

Function that plots the overall probability for path ensembles.

output_orderp(results, orderdata)[source]

Function that plots order parameter results.

output_path(results, path_ensemble)[source]

Function that plots path ensemble results.