xlsindy.render module

This module contain some render function for the basics experiment

xlsindy.render.animate_double_pendulum(length1: float, length2: float, angle_array: ndarray, time_array: ndarray, fig=None)

Animates a double pendulum based on its segment lengths, angles, and time steps.

Parameters:
  • length1 (float) – Length of the first segment.

  • length2 (float) – Length of the second segment.

  • angle_array (ndarray) – Array of angular positions of both segments over time.

  • time_array (ndarray) – Array of time steps corresponding to angles.

xlsindy.render.animate_single_pendulum(length: float, angle_array: ndarray, time_array: ndarray)

Animates a single pendulum based on its length, angle data, and time steps.

Parameters:
  • length (float) – Length of the pendulum.

  • angle_array (ndarray) – Array of angular positions over time.

  • time_array (ndarray) – Array of time steps corresponding to angles.

xlsindy.render.plot_bipartite_graph_svg(x_names, b_names, edges, x_sol_indices, output_file='fancy_bipartite_graph.svg', iterations=5, important_exclusive=False)

Plots a bipartite graph with custom node ordering and auto-sized node boxes.

Improvements:
  1. Custom node ordering: - Uses a simple iterative barycenter approach that reorders nodes so that each is placed

    closer to the average position of its connected nodes.

    • x_nodes appear at x=0 and b_nodes at x=1, with y-positions assigned by the ordering.

  2. Auto sizing for node boxes: - Node widths are determined by the maximum label length (scaled by a factor); you can adjust

    the scaling factor to suit your design needs.

Parameters:
  • x_names (list of str) – Names for x nodes.

  • b_names (list of str) – Names for b nodes.

  • edges (list of tuple) – Each tuple (x_name, b_name) represents an edge.

  • x_sol_indices (list of int) – Indices (with respect to x_names) for important x nodes.

  • output_file (str) – Filename for the output SVG.

  • iterations (int) – Number of iterations to update barycenter orders.

xlsindy.render.plot_bipartite_graph_svg_dep(x_names, b_names, edges, x_sol_indices, output_file='fancy_bipartite_graph.svg')

Plots a modern, fancy bipartite graph with custom node shapes and updated colors, then saves the plot as an SVG file.

Parameters:
  • x_names (list of str) – Names for the x variables.

  • b_names (list of str) – Names for the b groups.

  • edges (list of tuple) – Each tuple (x_name, b_name) represents an edge from an x-node to a b-node.

  • x_sol_indices (list of int) – List of indices (with respect to x_names) corresponding to important (solved) x nodes.

  • output_file (str) – Filename for the output SVG.

Customizations:
  • x-nodes are drawn as plain rectangles.

  • b-nodes are drawn as rounded rectangles.

  • Edges originating from an important x-node are drawn in a modern red (thicker), others in a dashed soft gray-blue.

  • A modern pastel color scheme is used with generous margins.