marlax.utils.animate_simulation_by_df

marlax.utils.animate_simulation_by_df#

marlax.utils.animate_simulation_by_df(df, regime, start_frame, end_frame, grid_size=11, interval=100)[source]#

Create an animation for a given regime and frame range that supports multiple agents.

Parameters:
  • df – DataFrame containing columns with agent positions, reward_loc, steps_without_reward, activated, collected, terminated, etc. Expected agent columns follow the format: a1x, a1y, a2x, a2y, …

  • regime – The regime index to animate.

  • start_frame – Starting frame number (inclusive).

  • end_frame – Ending frame number (inclusive).

  • grid_size – The size of the board (default 11).

  • interval – Interval (in ms) between frames.

Returns:

The matplotlib.animation.FuncAnimation object.

Return type:

ani