Interactive helpers

When developing QC code interactively it is often useful to generate plots. This module is a thin wrapper around the matplotlib.pyplot module that generates the plot that you probably want as a glimpse of a medsrtqc.core.Profile or medsrtqc.core.Trace. These functions are most usefully invoked in a Jupyter Notebook or similar environment. These functions require matplotlib <https://matplotlib.org/> to be installed.

medsrtqc.interactive.plot(x, fig=None, ax=None, vars=None, trace_attrs=None)

A convenience method that either calls plot_profile() or plot_trace() depending on the class of x.

>>> from medsrtqc.core import Trace, Profile
>>> from medsrtqc.interactive import plot
>>> trace = Trace([1, 2, 4], adjusted=[2, 3, 5], pres=[0, 1, 2])
>>> plot(trace)
>>> plot(Profile({'param1': trace}))
medsrtqc.interactive.plot_trace(x, ax=None, trace_attrs=None)

Plot a medsrtqc.core.Trace object.

Parameters:
  • x – A medsrtqc.core.Trace object

  • ax – An existing set of matplotlib Axes

  • trace_attrs – A subset tuple of 'value', 'adjusted' and/or 'ajusted_error'. Plotting QC flags is not implemented yet.

medsrtqc.interactive.plot_profile(x, fig=None, ax=None, vars=None, trace_attrs=None)

Plot a medsrtqc.core.Profile object.

Parameters:
  • x – A medsrtqc.core.Profile object

  • fig – An existing matplotlib Figure such as that returned by matplotlib.pyplot.subplots().

  • ax – An existing set of matplotlib Axes or array of these as returned by matplotlib.pyplot.subplots().

  • vars – An iterable of variables to plot or None to plot them all.

  • trace_attrs – Passed to plot_trace().