pyCGM2.Lib.plot.compareSelectedEmgEvelops#

pyCGM2.Lib.plot.compareSelectedEmgEvelops(DATA_PATH: str, analyses: List[Analysis], legends: List[str], emgChannels: List[str], contexts: List[str], normalized: bool = False, plotType: str = 'Descriptive', eventType: str = 'Gait', show: bool = True, title: str | None = None, OUT_PATH=None, outputName: str | None = None, exportPng: bool = False, exportPdf: bool = False, autoYlim: bool = False)#

Compares selected EMG envelopes from different analysis instances constructed from the same session.

This function visualizes and compares selected EMG channels from multiple analysis instances, providing insights into muscle activation patterns. It supports normalization and different plot types.

Parameters:
  • DATA_PATH (str) – Path to the data directory.

  • analyses (List[Analysis]) – List of Analysis instances to compare.

  • legends (List[str]) – Labels representing each analysis instance.

  • emgChannels (List[str]) – Names of EMG channels to compare.

  • contexts (List[str]) – Event contexts corresponding to the EMG channels.

  • normalized (bool) – If True, displays normalized EMG amplitude. Defaults to False.

  • plotType (str) – Type of plot (‘Descriptive’ or ‘Consistency’). Defaults to ‘Descriptive’.

  • eventType (str) – Event type to consider (e.g., ‘Gait’). Defaults to ‘Gait’.

  • show (bool) – If True, shows the plot using Matplotlib. Defaults to True.

  • title (Optional[str]) – Title for the plot panel. Defaults to None.

  • OUT_PATH (Optional[str]) – Path for saving exported files. Defaults to None.

  • outputName (Optional[str]) – Name of the output file. Defaults to None.

  • exportPng (bool) – If True, exports the plot as a PNG. Defaults to False.

  • exportPdf (bool) – If True, exports the plot as a PDF. Defaults to False.

  • autoYlim (bool) – If True, sets Y-axis limits automatically. Defaults to False.

Returns:
  • Union[matplotlib.figure.Figure, Tuple[matplotlib.figure.Figure, str]] – The Matplotlib figure object.

  • If exporting as PNG, returns a tuple of the figure object and the filename.

Examples

>>> fig = compareSelectedEmgEvelops("/data/path", [analysis1, analysis2], ["pre", "post"], ["EMG1", "EMG2"], ["Left", "Right"])