sarcasm.plots

Classes

Plots

Class with plotting functions for Structure and Motion objects

Module Contents

class sarcasm.plots.Plots[source]

Class with plotting functions for Structure and Motion objects

static plot_stack_overlay(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure | sarcasm.motion.Motion, frames, plot_func, offset=0.025, spine_color='w', xlim=None, ylim=None)[source]

Plot a stack of overlayed subplots on a given Axes object.

Parameters:
  • ax (matplotlib.axes.Axes) – The Axes object on which the stack should be plotted.

  • sarc_obj (Structure) – Data to be plotted in each subplot, which can be an instance of Structure or Motion.

  • frames (list) – The frames at which the subplots should be created.

  • plot_func (function) – The function used to plot the data in each subplot, e.g.

  • offset (float, optional) – The offset between each subplot. Defaults to 0.025.

  • spine_color (str, optional) – The color of the spines (borders) of each subplot. Defaults to ‘w’ (white).

  • xlim (tuple, optional) – The x-axis limits for each subplot. Defaults to None.

  • ylim (tuple, optional) – The y-axis limits for each subplot. Defaults to None.

static plot_loi_summary_motion(motion_obj: sarcasm.motion.Motion, number_contr=0, t_lim=(0, 12), t_lim_overlay=(-0.1, 2.9), filename=None)[source]

Plots a summary of the motion of the line of interest (LOI).

Parameters:
  • motion_obj (Motion) – The Motion object to plot.

  • number_contr (int, optional) – The number of contractions to plot. Defaults to 0.

  • t_lim (tuple of float, optional) – The time limits for the plot in seconds. Defaults to (0, 12).

  • t_lim_overlay (tuple of float, optional) – The time limits for the overlay plots in seconds. Defaults to (-0.1, 2.9)

  • filename (str, optional) – The filename to save the plot. Defaults to None.

static plot_loi_detection(sarc_obj: sarcasm.structure.Structure, frame: int = 0, filepath: str = None, cmap_z_bands='Greys')[source]

Plots all steps of automated LOI finding algorithm

Parameters:
  • sarc_obj (Structure) – Instance of Structure class

  • frame (int) – The time point to plot.

  • filepath (str) – Path to save the plot. If None, plot is not saved.

  • cmap_z_bands (str, optional) – Colormap of Z-bands. Defaults to ‘Greys’.

static plot_image(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure | sarcasm.motion.Motion, frame: int = 0, cmap: str = 'grey', alpha: float = 1, clip_thrs: Tuple[float, float] = (1, 99), scalebar: bool = True, title: None | str = None, show_loi: bool = False, zoom_region: Tuple[int, int, int, int] = None, inset_bounds: Tuple[float, float, float, float] = (0.6, 0.6, 0.4, 0.4))[source]

Plots microscopy raw image of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure or Motion) – The sarcomere object to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • cmap (matplotlib.cm.Colormap, optional) – The colormap to use. Defaults to ‘gray’.

  • alpha (float, optional) – The transparency to use. Defaults to 1.

  • clip_thrs (tuple, optional) – Clipping thresholds to normalize intensity, in percentiles. Defaults to (1, 99).

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • title (str, optional) – The title for the plot. Defaults to None.

  • show_loi (bool, optional) – Whether to show the line of interest (LOI). Defaults to True.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_z_bands(ax: matplotlib.pyplot.Axes, sarc_obj: sarcasm.structure.Structure | sarcasm.motion.Motion, frame=0, cmap='Greys_r', zero_transparent=False, alpha=1, scalebar=True, title=None, color_scalebar='w', show_loi=False, zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots the Z-bands of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure or Motion) – The sarcomere object to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • cmap (matplotlib.cm.Colormap, optional) – Colormap to use. Defaults to ‘Greys_r’.

  • alpha (float, optional) – Alpha value to change opacity of image. Defaults to 1

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • title (str, optional) – The title for the plot. Defaults to None.

  • show_loi (bool, optional) – Whether to show the line of interest (LOI). Defaults to True.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

plot_z_bands_midlines(sarc_obj: sarcasm.structure.Structure | sarcasm.motion.Motion, frame=0, cmap='berlin', alpha=1, scalebar=True, title=None, color_scalebar='w', show_loi=True, zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots the Z-bands and midlines of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure or Motion) – The sarcomere object to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • cmap (matplotlib.cm.Colormap, optional) – Colormap to use. Defaults to ‘Blues_r’.

  • alpha (float, optional) – Alpha value to change opacity of image. Defaults to 1

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • title (str, optional) – The title for the plot. Defaults to None.

  • show_loi (bool, optional) – Whether to show the line of interest (LOI). Defaults to True.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_cell_mask(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure | sarcasm.motion.Motion, frame=0, threshold=0.5, cmap='gray', alpha=1, scalebar=True, title=None)[source]

Plots the cell mask of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure or Motion) – The sarcomere object to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • threshold (float, optional) – Binarization threshold to use for cell mask. Defaults to 0.5.

  • cmap (matplotlib.colors.Colormap, optional) – The colormap to use. Defaults to ‘gray’

  • alpha (float, optional) – Transparency value to change opacity of mask. Defaults to 0.5.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • title (str, optional) – The title for the plot. Defaults to None.

static plot_z_segmentation(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, scalebar=True, shuffle=True, title=None, zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots the Z-band segmentation result of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure) – The instance of Structure class to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • shuffle (bool, optional) – Whether to shuffle the labels. Defaults to True.

  • title (str, optional) – The title for the plot. Defaults to None.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_z_lateral_connections(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, scalebar=True, markersize=1.5, markersize_inset=3, linewidth=0.25, linewidth_inset=0.5, plot_groups=True, shuffle=True, title=None, zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots lateral Z-band connections of a Structure object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure) – The instance of Structure object to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • markersize (int, optional) – The size of the markers of the Z-band ends. Defaults to 5.

  • markersize_inset (int, optional) – The size of the markers of the Z-band ends in the inset plot. Defaults to 5.

  • linewidth (int, optional) – The width of the connection lines. Defaults to 0.25.

  • linewidth – The width of the connection lines in the inset plot. Defaults to 0.5.

  • plot_groups (bool) – Whether to show the Z-bands of each lateral group with the same color. Defaults to True.

  • shuffle (bool, optional) – Whether to shuffle the labels. Defaults to True.

  • title (str, optional) – The title for the plot. Defaults to None.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_sarcomere_orientation_field(ax1: matplotlib.axes.Axes, ax2: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, cmap='vanimo', scalebar=True, colorbar=True, shrink_colorbar=0.7, orient_colorbar='vertical', zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots sarcomere orientation field of the sarcomere object.

Parameters:
  • ax1 (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (object) – The instance of Structure class to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • colorbar (bool, optional) – Whether to add a colorbar to the plot. Defaults to True.

  • shrink_colorbar (float, optional) – The factor by which to shrink the colorbar. Defaults to 0.7.

  • orient_colorbar (str, optional) – The orientation of the colorbar (‘horizontal’ or ‘vertical’). Defaults to ‘vertical’.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_sarcomere_mask(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, cmap='viridis', threshold=0.1, show_z_bands=False, alpha=0.5, cmap_z_bands='gray', alpha_z_bands=1, clip_thrs=(1, 99.9), title=None, zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots binary mask of sarcomeres, derived from sarcomere vectors.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure) – The instance of Structure class to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • cmap (str, optional) – The colormap to use. Defaults to ‘viridis’

  • show_z_bands (bool, optional) – Whether to show Z-bands. If False, the raw image is shown. Defaults to False.

  • alpha (float, optional) – The transparency of sarcomere mask. Defaults to 0.5.

  • cmap_z_bands (bool, optional) – Colormap for Z-bands. Defaults to ‘gray’.

  • alpha_z_bands (float, optional) – Alpha value of Z-bands. Defaults to 1.

  • clip_thrs (tuple of float, optional) – Clipping threshold for image in background. Defaults to (1, 99.9). Only if show_z_bands is False.

  • title (str, optional) – The title for the plot. Defaults to None.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_sarcomere_vectors(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, color_arrows='k', color_points='darkgreen', s_points=0.5, linewidths=0.5, s_points_inset=0.5, linewidths_inset=0.5, scalebar=True, legend=False, show_image=False, cmap_z_bands='Purples', alpha_z_bands=1, title=None, zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots quiver plot reflecting local sarcomere length and orientation based on sarcomere vector analysis result of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure) – The instance of Structure class to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • color_arrows (str, optional) – The color of the arrows. Defaults to ‘mediumpurple’.

  • color_points (str, optional) – The color of the points. Defaults to ‘darkgreen’.

  • s_points (float, optional) – The size of midline points. Defaults to 0.5.

  • linewidths (float, optional) – The width of the arrow lines. Defaults to 0.0005.

  • s_points_inset (float, optional) – The size of midline points. Defaults to 0.5.

  • linewidths_inset (float, optional) – The width of the arrow lines in the inset plot. Defaults to 0.0001.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • legend (bool, optional) – Whether to add a legend to the plot. Defaults to False.

  • show_image (bool, optional) – Whether to show the image (True) or the Z-bands (False). Defaults to False.

  • cmap_z_bands (str, optional) – Colormap of Z-bands. Defaults to ‘Greys’.

  • alpha_z_bands (float, optional) – Alpha value of Z-bands. Defaults to 1.

  • title (str, optional) – The title for the plot. Defaults to None.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_sarcomere_domains(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, alpha=0.5, cmap='gist_rainbow', scalebar=True, plot_raw_data=False, cmap_z_bands='Greys', alpha_z_bands=1, title=None)[source]

Plots the sarcomere domains of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure) – The instance of Structure class to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • alpha (float, optional) – The transparency of the domain masks. Defaults to 0.3.

  • cmap (str, optional) – The colormap to use. Defaults to ‘gist_rainbow’.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • plot_raw_data (bool, optional) – Whether to plot the raw data. Defaults to False.

  • cmap_z_bands (str, optional) – Colormap for Z-bands. Defaults to ‘Greys’.

  • alpha_z_bands (float, optional) – Transparency of Z-bands. Defaults to 1.

  • title (str, optional) – The title for the plot. Defaults to None.

static plot_myofibril_lines(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, show_z_bands=True, linewidth=1, color_lines='r', linewidth_inset=3, alpha=0.2, cmap_z_bands='Greys', alpha_z_bands=1, scalebar=True, title=None, zoom_region=None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots result of myofibril line growth algorithm of the sarcomere object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure or Motion) – The sarcomere object to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • show_z_bands (bool) – Whether or not to show Z-bands. Defaults to True

  • linewidth (float, optional) – The width of the lines. Defaults to 1.

  • color_lines (str) – Color of lines. Defaults to ‘r’

  • linewidth_inset (float, optional) – Thickness of the lines in inset. Defaults to 1.

  • alpha (float, optional) – The transparency of the lines. Defaults to 0.2.

  • cmap_z_bands (str, optional) – Colormap of Z-bands. Defaults to ‘Greys’.

  • alpha_z_bands (float, optional) – Transparency of Z-bands. Defaults to 1.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • title (str, optional) – The titlefor the plot. Defaults to None.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_myofibril_length_map(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, frame=0, vmax=None, alpha=1, show_z_bands=False, cmap_z_bands='Greys', alpha_z_bands=1, colorbar=True, shrink_colorbar=0.7, orient_colorbar='vertical', scalebar=True, title=None, zoom_region: Tuple[int, int, int, int] = None, inset_bounds=(0.6, 0.6, 0.4, 0.4))[source]

Plots the spatial map of myofibril lengths for a given frame.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • sarc_obj (Structure) – The instance of Structure class to plot.

  • frame (int, optional) – The frame to plot. Defaults to 0.

  • vmax (float, optional) – Maximum value for the colormap. If None, the maximum value in the data is used. Defaults to None.

  • alpha (float, optional) – Transparency of the colormap. Defaults to 1.

  • show_z_bands (bool, optional) – Whether to show Z-band mask, else raw image is shown. Defaults to False.

  • cmap_z_bands (str, optional) – Colormap of Z-bands. Defaults to ‘Greys’.

  • alpha_z_bands (float, optional) – Transparency of Z-bands or raw image. Defaults to 1.

  • colorbar (bool, optional) – Whether to show the colorbar. Defaults to True.

  • shrink_colorbar (float, optional) – Shrinkage of the colorbar. Defaults to 0.7.

  • orient_colorbar (str, optional) – Orientation of the colorbar. Defaults to ‘vertical’.

  • scalebar (bool, optional) – Whether to add a scalebar to the plot. Defaults to True.

  • title (str, optional) – The title for the plot. Defaults to None.

  • zoom_region (tuple of int, optional) – The region to zoom in on, specified as (x1, x2, y1, y2). Defaults to None.

  • inset_bounds (tuple of float, optional) – Bounds of inset axis, specified as (x0, y0, width, height). Defaults to (0.6, 0.6, 0.4, 0.4).

static plot_lois(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure | sarcasm.motion.Motion, color='darkorange', linewidth=2, alpha=0.5)[source]

Plot all LOI lines for Structure object and LOI line Motion object.

Parameters:
  • ax (matplotlib axis) – Axis on which to plot the LOI lines

  • sarc_obj (Structure or Motion) – Object of Structure or Motion class

  • color (str) – Color of lines

  • linewidth (float) – Width of lines

  • alpha (float) – Transparency of lines

static plot_histogram_structure(ax: matplotlib.axes.Axes, sarc_obj: sarcasm.structure.Structure, feature: str, frame: int = 0, bins: int = 20, density: bool = False, range: tuple | None = None, label: str | None = None, ylabel: str | None = None, rwidth: float = 0.6, color: str = 'darkslategray', edge_color: str = 'k', align: Literal['mid', 'left', 'right'] = 'mid', rotate_yticks: bool = False) None[source]

Plots the histogram of a specified structural feature from a sarcomere object on a given Axes.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes on which to draw the histogram.

  • sarc_obj (Structure) – The instance of Structure class to plot.

  • feature (str) – The name of the structural feature to plot.

  • frame (int, optional) – The frame index from which to extract the data. Defaults to 0.

  • bins (int, optional) – The number of bins for the histogram. Defaults to 20.

  • density (bool, optional) – If True, the histogram is normalized to show the probability density rather than raw counts. Defaults to False.

  • range (tuple, optional) – The lower and upper range of the bins. If not provided, the range is determined from the data.

  • label (str, optional) – The label for the x-axis. If not specified, a default label based on the feature will be used.

  • ylabel (str, optional) – The label for the y-axis. Overrides the default label if provided.

  • rwidth (float, optional) – The relative width of the histogram bars. Defaults to 0.7.

  • color (str, optional) – The fill color of the histogram bars. Defaults to ‘darkslategray’.

  • edge_color (str, optional) – The color of the edges of the histogram bars. Defaults to ‘k’.

  • align (str, optional) – The alignment of the histogram bars. Defaults to ‘mid’.

  • rotate_yticks (bool, optional) – If True, rotates the y-axis tick labels by 90 degrees for improved readability. Defaults to False.

static plot_z_pos(ax: matplotlib.axes.Axes, motion_obj: sarcasm.motion.Motion, number_contr=None, show_contr=True, show_kymograph=False, color='k', t_lim=(None, None), y_lim=(None, None))[source]

Plots the z-band trajectories of the motion object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • motion_obj (Motion) – The motion object to plot.

  • show_contr (bool, optional) – Whether to show the contractions. Defaults to True.

  • show_kymograph (bool, optional) – Whether to show the kymograph. Defaults to False.

  • color (str, optional) – The color of the plot. Defaults to ‘k’.

  • t_lim (tuple, optional) – The time limits for the plot. Defaults to (None, None).

  • y_lim (tuple, optional) – The y limits for the plot. Defaults to (None, None).

static plot_delta_slen(ax: matplotlib.axes.Axes, motion_obj: sarcasm.motion.Motion, frame=None, t_lim=(0, 12), y_lim=(-0.3, 0.4), n_rows=6, n_start=1, show_contr=True)[source]

Plots the change in sarcomere length over time for a motion object.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • motion_obj (Motion) – The motion object to plot.

  • frame (int or None, optional) – Show frame with vertical dashed line, in frames. Defaults to None.

  • t_lim (tuple, optional) – The time limits for the plot. Defaults to (0, 12).

  • y_lim (tuple, optional) – The y limits for the plot. Defaults to (-0.3, 0.4).

  • n_rows (int, optional) – The number of rows for the plot. Defaults to 6.

  • n_start (int, optional) – The starting index for the plot. Defaults to 1.

  • show_contr (bool, optional) – Whether to show the systoles. Defaults to True.

static plot_overlay_delta_slen(ax: matplotlib.axes.Axes, motion_obj: sarcasm.motion.Motion, number_contr=None, t_lim=(0, 1), y_lim=(-0.35, 0.5), show_contr=True)[source]

Plots the sarcomere length change over time for a motion object, overlaying multiple trajectories.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • motion_obj (Motion) – The motion object to plot.

  • number_contr (int, optional) – The number of contractions to overlay. If None, all contractions are overlaid. Defaults to None.

  • t_lim (tuple, optional) – The time limits for the plot. Defaults to (0, 1).

  • y_lim (tuple, optional) – The y limits for the plot. Defaults to (-0.35, 0.45).

  • show_contr (bool, optional) – Whether to show the contractions. Defaults to True.

static plot_overlay_velocity(ax, motion_obj: sarcasm.motion.Motion, number_contr=None, t_lim=(0, 0.9), y_lim=(-9, 12), show_contr=True)[source]

Plots overlay of sarcomere velocity time series of the motion object

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • motion_obj (Motion) – The motion object to plot.

  • number_contr (int, optional) – The number of contractions to overlay. If None, all contractions are overlaid. Defaults to None.

  • t_lim (tuple, optional) – The time limits for the plot. Defaults to (0, 0.9).

  • y_lim (tuple, optional) – The y limits for the plot. Defaults to (-7, 10).

  • show_contr (bool, optional) – Whether to show the contractions. Defaults to True.

static plot_phase_space(ax: matplotlib.axes.Axes, motion_obj: sarcasm.motion.Motion, t_lim=(0, 4), number_contr=None, frame=None)[source]

Plots sarcomere trajectory in length-change velocity phase space

Parameters:
  • ax (matplotlib.axes.Axes) – The axes to draw the plot on.

  • motion_obj (Motion) – The motion object to plot.

  • t_lim (tuple, optional) – The time limits for the plot. Defaults to (0, 4).

  • number_contr (int, optional) – The number of contractions to overlay. If None, all contractions are overlaid. Defaults to None.

  • frame (int, optional) – The frame number to plot the individual sarcomeres in phase space. Defaults to None.

static plot_popping_events(motion_obj: sarcasm.motion.Motion, save_name=None)[source]

Create binary event map of popping events of the motion object.

Parameters:
  • motion_obj (Motion) – The motion object to plot.

  • save_name (str, optional) – The name to save the plot as. If None, the plot is not saved. Defaults to None.