peak_performance.plots#

The plots module offer convenience functions for visualizing results and enabling quality control.

Functions for preparing diagnostic and QC plots.

peak_performance.plots.plot_density(*, ax, x: ndarray, samples, percentiles=(5, 95), percentile_kwargs=None, **kwargs)#

Method to plot the original data points alongside the posterior predictive plot (percentiles marked with a black, dashed line).

Parameters:
ax

Axes of a matplotlib figure.

x

Values of the x dimension of the plot (here: time).

samples

Posterior predictive samples taken from an inference data obejct.

percentiles

Lower and upper percentiles to be plotted.

**kwargs

The keyword arguments are used for plotting with ax.plot() and ax.stairs(), e.g. the following:

linestyle

Style of the line marking the border of the chosen percentiles (default = “–”, i.e. a dashed line).

color

Color of the line marking the border of the chosen percentiles (default = “black”).

peak_performance.plots.plot_model_comparison(df_comp: DataFrame, identifier: str, path: str | PathLike | None, save_formats: Sequence[str] = ('png', 'svg'))#

Function to plot the results of a model comparison.

Parameters:
df_comp

DataFrame containing the ranking of the given models.

identifier

Unique identifier of this particular signal (e.g. filename).

path

Path to the folder containing the results of the current run.

save_formats

Which file formats to save as. Must be supported by plt.savefig(), e.g. ("png", "svg", "pdf").

peak_performance.plots.plot_posterior(identifier: str, time: ndarray, intensity: ndarray, path: str | PathLike | None, idata: InferenceData, discarded: bool, save_formats: Sequence[str] = ('png', 'svg'))#

Saves plot of posterior, estimated baseline, and original data points.

Parameters:
identifier

Unique identifier of this particular signal (e.g. filename).

time

NumPy array with the time values of the relevant timeframe.

intensity

NumPy array with the intensity values of the relevant timeframe.

path

Path to the folder containing the results of the current run.

idata

Infernce data object.

discarded

Alters the name of the saved plot. If True, a “_NoPeak” is added to the name.

save_formats

Which file formats to save as. Must be supported by plt.savefig(), e.g. ("png", "svg", "pdf").

peak_performance.plots.plot_posterior_predictive(identifier: str, time: ndarray, intensity: ndarray, path: str | PathLike | None, idata: InferenceData, discarded: bool, save_formats: Sequence[str] = ('png', 'svg'))#

Save plot of posterior_predictive with 95 % HDI and original data points.

Parameters:
identifier

Unique identifier of this particular signal (e.g. filename).

time

NumPy array with the time values of the relevant timeframe.

intensity

NumPy array with the intensity values of the relevant timeframe.

path

Path to the folder containing the results of the current run.

idata

Infernce data object.

discarded

Alters the name of the saved plot. If True, a “_NoPeak” is added to the name.

save_formats

Which file formats to save as. Must be supported by plt.savefig(), e.g. ("png", "svg", "pdf").

peak_performance.plots.plot_raw_data(identifier: str, time: ndarray, intensity: ndarray, path: str | PathLike | None, save_formats: Sequence[str] = ('png', 'svg'))#

Plot just the raw data in case no peak was found.

Parameters:
identifier

Unique identifier of this particular signal (e.g. filename).

time

NumPy array with the time values of the relevant timeframe.

intensity

NumPy array with the intensity values of the relevant timeframe.

path

Path to the folder containing the results of the current run.

save_formats

Which file formats to save as. Must be supported by plt.savefig(), e.g. ("png", "svg", "pdf").