larvaworld.lib.plot.stridecycle

Stide-cycle-related plotting

Functions

plot_vel_during_strides(→ Any)

Plot linear and angular velocities during stride epochs.

stride_cycle(, modes, subfolder, Nbins, individuals, ...)

Create stride cycle curves for kinematic parameters.

stride_cycle_all_points(→ Any)

Create stride cycle plot with all body points.

plot_stride_Dbend(→ Any)

Plot bend angle changes during strides.

plot_stride_Dorient(→ Any)

Plot orientation changes during strides.

plot_interference(→ Any)

Plot interference patterns between body segments.

Module Contents

larvaworld.lib.plot.stridecycle.plot_vel_during_strides(dataset: Any, use_component: bool = False, save_to: str | None = None, return_fig: bool = False, show: bool = False) Any

Plot linear and angular velocities during stride epochs.

Creates two-panel figure showing how velocities vary across stride duration, with optional component velocity analysis.

Args:

dataset: Dataset containing stride epoch data use_component: Use component velocities instead of scalar. Defaults to False save_to: Directory to save plots. Uses dataset plot_dir if None return_fig: Whether to return figure object. Defaults to False show: Whether to display plot. Defaults to False

Returns:

Figure object if return_fig is True, else None

Example:
>>> fig = plot_vel_during_strides(dataset, use_component=True, return_fig=True)
larvaworld.lib.plot.stridecycle.stride_cycle(name: str | None = None, shorts: Sequence[str] = ('sv', 'fov', 'rov', 'foa', 'b'), modes: Sequence[str] | None = None, subfolder: str = 'stride', Nbins: int = 64, individuals: bool = False, pooled: bool = True, title: str = 'Stride cycle analysis', **kwargs: Any) Any

Create stride cycle curves for kinematic parameters.

Generates multi-panel plot showing how velocity, angular velocity, and bend vary throughout the stride cycle phase (0 to 2π).

Args:

name: Plot name for saving. Auto-generated if None shorts: Parameter keys to plot. Defaults to velocity and angular parameters modes: Processing modes for each parameter. Auto-determined if None subfolder: Subfolder for saving. Defaults to ‘stride’ Nbins: Number of phase bins. Defaults to 64 individuals: Plot individual trajectories. Defaults to False pooled: Show pooled quantiles. Defaults to True title: Figure title. Defaults to ‘Stride cycle analysis’ **kwargs: Additional arguments passed to AutoPlot

Returns:

Plot output (figure object or None based on return_fig setting)

Example:
>>> fig = stride_cycle(datasets=[d1, d2], individuals=True, Nbins=128)
larvaworld.lib.plot.stridecycle.stride_cycle_all_points(name: str = 'stride cycle multi', idx: int = 0, Nbins: int = 64, short: str | None = 'fov', subfolder: str = 'stride', maxNpoints: int = 5, axx: Any | None = None, **kwargs: Any) Any

Create stride cycle plot with all body points.

Generates detailed stride cycle visualization showing angular velocities at multiple body points and orientation changes during strides.

Args:

name: Plot name for saving. Defaults to ‘stride cycle multi’ idx: Agent index to plot. Defaults to 0 Nbins: Number of phase bins. Defaults to 64 short: Parameter key to analyze. Defaults to ‘fov’ subfolder: Subfolder for saving. Defaults to ‘stride’ maxNpoints: Maximum body points to show. Defaults to 5 axx: Inset axes for additional plot. Creates new if None **kwargs: Additional arguments passed to AutoPlot

Returns:

Plot output (figure object or None based on return_fig setting)

Example:
>>> fig = stride_cycle_all_points(datasets=[d1], idx=0, maxNpoints=7)
larvaworld.lib.plot.stridecycle.plot_stride_Dbend(name: str = 'stride_bend_change', show_text: bool = False, subfolder: str = 'stride', **kwargs: Any) Any

Plot bend angle changes during strides.

Creates scatter plot showing relationship between initial bend angle and bend change over stride, with linear regression fits.

Args:

name: Plot name for saving. Defaults to ‘stride_bend_change’ show_text: Show regression equation text. Defaults to False subfolder: Subfolder for saving. Defaults to ‘stride’ **kwargs: Additional arguments passed to AutoPlot

Returns:

Plot output (figure object or None based on return_fig setting)

Example:
>>> fig = plot_stride_Dbend(datasets=[d1, d2], show_text=True)
larvaworld.lib.plot.stridecycle.plot_stride_Dorient(name: str = 'stride_orient_change', absolute: bool = True, subfolder: str = 'stride', Nbins: int = 200, **kwargs: Any) Any

Plot orientation changes during strides.

Creates histograms showing distribution of front and rear orientation changes over stride cycles.

Args:

name: Plot name for saving. Defaults to ‘stride_orient_change’ absolute: Use absolute values. Defaults to True subfolder: Subfolder for saving. Defaults to ‘stride’ Nbins: Number of histogram bins. Defaults to 200 **kwargs: Additional arguments passed to AutoPlot

Returns:

Plot output (figure object or None based on return_fig setting)

Example:
>>> fig = plot_stride_Dorient(datasets=[d1, d2], absolute=False, Nbins=150)
larvaworld.lib.plot.stridecycle.plot_interference(mode: str = 'orientation', agent_idx: int | None = None, subfolder: str = 'interference', **kwargs: Any) Any

Plot interference patterns between body segments.

Creates scatter plots showing relationships between front/rear angular velocities, body length, and orientations to detect inter-segment interference.

Args:

mode: Analysis mode (‘orientation’ or other). Defaults to ‘orientation’ agent_idx: Specific agent index to analyze. Analyzes all if None subfolder: Subfolder for saving. Defaults to ‘interference’ **kwargs: Additional arguments passed to AutoPlot

Returns:

Plot output (figure object or None based on return_fig setting)

Example:
>>> fig = plot_interference(datasets=[d1, d2], mode='orientation', agent_idx=0)