dianna.visualization.timeseries

Module Contents

Functions

plot_timeseries() → matplotlib.pyplot.Figure)

Plot timeseries with segments highlighted.

_draw_segments(axs, cmap, segments, heatmap_range)

_process_plotting_parameters(x, y, y_labels)

dianna.visualization.timeseries.plot_timeseries(x: numpy.ndarray, y: numpy.ndarray, segments: List[Dict[str, Any]], x_label: str = 't', y_label: str | Iterable[str] = None, cmap: str | None = None, show_plot: bool | None = True, output_filename: str | None = None, heatmap_range=(-1, 1)) matplotlib.pyplot.Figure[source]

Plot timeseries with segments highlighted.

Parameters:
  • x (np.ndarray) – X-values with shape (number of time_steps)

  • y (np.ndarray) – Y-values with shape (number_of_time_steps, number_of_channels)

  • segments (List[Dict[str, Any]]) – Segment data, must be a list of dicts with the following keys: ‘index’, ‘start’, ‘end’, ‘weight’, ‘channel. Here, index is the index of the segment of feature, start and end determine the location of the segment, weight determines the color, and ‘channel’ determines the channel within the timeseries.

  • x_label (str, optional) – Label for the x-axis

  • y_label (Union[str, Iterable[str]], optional) – Label or list of labels for the y-axis

  • cmap (str, optional) – Matplotlib colormap

  • show_plot (bool, optional) – Shows plot if true (for testing or writing plots to disk instead).

  • output_filename (str, optional) – Name of the file to save the plot to (optional).

  • heatmap_range (tuple, optional) – a tuple (vmin, vmax) to set the range of the heatmap.

Returns:

plt.Figure

dianna.visualization.timeseries._draw_segments(axs, cmap, segments, heatmap_range)[source]
dianna.visualization.timeseries._process_plotting_parameters(x, y, y_labels)[source]