larvaworld.lib.plot.stridecycle =============================== .. py:module:: larvaworld.lib.plot.stridecycle .. autoapi-nested-parse:: Stide-cycle-related plotting Functions --------- .. autoapisummary:: larvaworld.lib.plot.stridecycle.plot_vel_during_strides larvaworld.lib.plot.stridecycle.stride_cycle larvaworld.lib.plot.stridecycle.stride_cycle_all_points larvaworld.lib.plot.stridecycle.plot_stride_Dbend larvaworld.lib.plot.stridecycle.plot_stride_Dorient larvaworld.lib.plot.stridecycle.plot_interference Module Contents --------------- .. py:function:: plot_vel_during_strides(dataset: Any, use_component: bool = False, save_to: Optional[str] = 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) .. py:function:: stride_cycle(name: Optional[str] = None, shorts: Sequence[str] = ('sv', 'fov', 'rov', 'foa', 'b'), modes: Optional[Sequence[str]] = 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) .. py:function:: stride_cycle_all_points(name: str = 'stride cycle multi', idx: int = 0, Nbins: int = 64, short: Optional[str] = 'fov', subfolder: str = 'stride', maxNpoints: int = 5, axx: Optional[Any] = 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) .. py:function:: 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) .. py:function:: 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) .. py:function:: plot_interference(mode: str = 'orientation', agent_idx: Optional[int] = 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)