diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example.ipynb b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example.ipynb new file mode 100644 index 00000000..c7844915 --- /dev/null +++ b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example.ipynb @@ -0,0 +1,2583 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ae8cf29c-e9e7-4024-a6a3-d5db8b4f013d", + "metadata": {}, + "source": [ + "# TaskEnvironment.py Tutorial\n", + "(For more info, see `TaskEnvironment_basics.md`)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "7a363d7a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/Users/ryoung/opt/anaconda3/envs/ratinabox11/bin/python\n" + ] + } + ], + "source": [ + "# Setup and parameters\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "from ratinabox.contribs.TaskEnvironment import (SpatialGoalEnvironment, TaskEnvironment, \n", + " SpatialGoal, Reward, Goal, get_goal_vector)\n", + "from ratinabox.Agent import Agent\n", + "from IPython import display\n", + "from matplotlib.animation import FuncAnimation\n", + "from IPython.display import HTML, Video\n", + "import sys\n", + "print(sys.executable)\n", + "\n", + "\n", + "%matplotlib inline\n", + "speed = 12 # dials how fast agent runs\n", + "pausetime = 0.000001 # pause time in plot\n", + "plt.close('all')\n" + ] + }, + { + "cell_type": "markdown", + "id": "469697b9-e0ca-4fd4-b76b-404cdd0215e2", + "metadata": { + "tags": [] + }, + "source": [ + "# Setting up reward 💰 functions\n", + "\n", + "Configure the reward given for reaching a goal. Some options include setting decay function, decay parameters or an external driving function, e.g. a gradient. Rewards once they're given to an agent remain active until they expire (this is optional).\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "de3b1854-364c-4641-834a-30647d8c829d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Text(0.5, 0.98, 'Linear decay reward functions')" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeQAAAFECAYAAAD2sk0XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB8UklEQVR4nO3dd3gUVfvw8e/uZkt6ISEJkFBClU4oUgMC0iwoggIKgiD4oPDATzCIPiAo+IIURRQBBVEUQUFFEamhowKh9xJCC5CQ3ja7O+8fCSshCWRDkk25P9c1V3bPzs7cc5LdO3PmnDMqRVEUhBBCCGFXansHIIQQQghJyEIIIUSJIAlZCCGEKAEkIQshhBAlgCRkIYQQogSQhCyEEEKUAJKQhRBCiBJAErIQQghRAkhCFkIIIUoAScgih4iICFQqFcuWLbN3KIXq5Zdfplq1avYOQ9xj2bJlqFQqIiIiHrjuhg0baNKkCQaDAZVKRVxcXJHHVxAqlYopU6bYOwxRykhCLmfufPnt37/f3qEIYZOYmBj69euHo6MjCxYs4JtvvsHZ2dlu8axfv16SrihUDvYOQJQ8VatWJTU1Fa1Wa+9QhLD6559/SExMZNq0aXTp0sXe4bB+/XoWLFiQa1JOTU3FwUG+XoVt5AxZ5KBSqTAYDGg0GnuHkqeUlBR7h1BiJCcn2zuE+7JYLKSlpT30dm7evAmAh4fHQ2+rqBkMBknIwmaSkEUOuV1Dfvnll3FxceHq1av07t0bFxcXfHx8ePPNNzGbzdneb7FYmDdvHvXr18dgMODr68uIESOIjY3Ntt4vv/xCr169qFSpEnq9nqCgIKZNm5Zjex07dqRBgwYcOHCADh064OTkxNtvv33fY/j5559p0KABBoOBBg0asHbt2lzXy2+sAH/88QchISG4urri5uZGixYt+O6776yv79y5k759+xIYGIherycgIICxY8eSmppqXWfp0qWoVCrCw8NzbH/69OloNBquXr2a53FNmTIFlUrFiRMnGDBgAJ6enrRr1876+rfffktwcDCOjo54eXnxwgsvcPnyZevrn3zyCRqNJtu119mzZ6NSqRg3bpy1zGw24+rqyltvvWUt++ijj2jTpg0VKlTA0dGR4OBgfvzxxxwxqlQqXn/9dVasWEH9+vXR6/Vs2LABgOPHj/PYY4/h6OhIlSpVeP/997FYLHke7x0dO3Zk8ODBALRo0QKVSsXLL78MQLVq1ayP731Px44drc/DwsJQqVSsWrWKDz74gCpVqmAwGOjcuTPnzp3L8f6//vqLnj174unpibOzM40aNeLjjz8GMj8PCxYssB7vneXuOrj3zDk8PJwePXrg5uaGi4sLnTt3Zt++fdnWuXNJaffu3YwbNw4fHx+cnZ155plnuHXrVrZ19+/fT7du3fD29sbR0ZHq1aszdOjQB9alKLnkXziRb2azmW7dutGqVSs++ugjNm/ezOzZswkKCuK1116zrjdixAiWLVvGkCFDGD16NBcvXuTTTz8lPDyc3bt3W5vCly1bhouLC+PGjcPFxYWtW7fyv//9j4SEBGbNmpVt3zExMfTo0YMXXniBF198EV9f3zzj3LhxI3369OGRRx5hxowZxMTEMGTIEKpUqZJjXVtiHTp0KPXr12fixIl4eHgQHh7Ohg0bGDBgAACrV68mJSWF1157jQoVKvD3338zf/58rly5wurVqwF47rnnGDVqFCtWrKBp06bZYlmxYgUdO3akcuXKD/xd9O3bl1q1ajF9+nTu3EH1gw8+4N1336Vfv34MGzaMW7duMX/+fDp06EB4eDgeHh60b98ei8XCrl27eOKJJ4DMfyTUajU7d+60bj88PJykpCQ6dOhgLfv444956qmnGDhwIEajkZUrV9K3b19+++03evXqlS2+rVu3smrVKl5//XW8vb2pVq0aUVFRdOrUCZPJRGhoKM7OzixatAhHR8cHHu+kSZOoU6cOixYtYurUqVSvXp2goKAHvi83H374IWq1mjfffJP4+HhmzpzJwIED+euvv6zrbNq0iSeeeAJ/f3/GjBmDn58fJ0+e5LfffmPMmDGMGDGCa9eusWnTJr755psH7vP48eO0b98eNzc3JkyYgFar5YsvvqBjx45s376dVq1aZVv/jTfewNPTk8mTJxMREcG8efN4/fXX+eGHH4DM1oLHH38cHx8fQk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05edPbPHC71+5U0ntwcw4Dtt9kelU45u6lYobjTs/rVV18lKCiITp06MWfOHOvr33//vfVWcW3atKF69eo8++yz1pukR0REUL16dRo3bkyFChXQ6XS57iclJYWff/6ZadOmUa9ePev1Y8i8V+y3337L8uXLeeaZZ6hWrRotWrQgNDSUnj17Fm0FCAGcOHGCtLQ0AgMDOX/+fLblypUrQGa/BovFQo8ePRg9ejSdOnXKsZ07nwsADw8PateuzcmTJ/Mdx8GDB/Hz88NkMuWI4+6z5rNnzzJv3jy6devGmjVrGDJkSL73YfeE/MMPPzBu3DgmT57MwYMHady4Md26dePmzZt5vsfNzY3r169bl0uXLhVjxCIvwd46vmznyR9dK/BMoAEHFey5aWTwzlh6bIphdUQK6WZJzPmlKAovvPACwcHBHDt2jLlz5zJ+/Hjr6xkZGTz++OPcvHmT9evXc/ToUUJDQ61Nyz/99BMbNmxg27ZtREdH079//zz3tWLFCpo0acLOnTu5fPlytteGDBnC8uXLmT17NqdPn+bnn3+mRYsWREZGFs2BC3GXpKQkPvroI+bOncugQYOoUaMGTZs25fXXX2fQoEH07NmToUOHMnDgQDZv3sysWbP4+uuv8fDwyLad//3vfzz22GPUr1+fZcuWER0dne8zV4DNmzezd+9efv75Z7p27UrVqlVp3bo177//PsHBwRgMBubPn09ISAiBgYG0adOGFi1a2JT089VknZCQkO8N2nqP4Tlz5jB8+HDrfxELFy7k999/56uvvsqz17ZKpbJOTiJKnnoeWua28uDNhma+OpPMyoupnIo3Mf6fBP7fkSQG1XRiYJATFfR2/3+wxNuyZUu24RlAtpt/REZG0rdv31zfazQac30tt5uHbNiwIc+biphMJqZMmcKUKVNsiFyIwvPuu+9y69YtJk6cSI0aNYiLi+PgwYPMmDGDH374gSlTplivJ0+ePJnHH3+chQsXZhvSFxoayscff0ytWrU4dOgQTz75pE09oAF69uzJBx98wNKlS/Hx8SEqKoodO3Zw48YNzGYzFSpUYPny5fj6+hIdHc2aNWuYPHlyvrevUvLRlqhWq/N9B6B7O37cj9FoxMnJ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a9dWdDqdUr9+feX3338v5oiLjy11U7VqVQXIsUyePLn4Ay8Gtv7d3K0sJ2RFsb1u9uzZo7Rq1UrR6/VKjRo1lA8++EAxmUzFHHXxsKVuMjIylClTpihBQUGKwWBQAgIClP/85z9KbGxs8QdexLZt25br98ed+hg8eLASEhKS4z1NmjRRdDqdUqNGDWXp0qXFHndByO0XhRBCiBJAriELIYQQJYAkZCGEEKIEkIQshBBClACSkIUQQogSQBKyEEIIUQJIQhZCCCFKAEnIQgghRAkgCVkIIYQoASQhC1EKhIWFoVKpiIuLs8v+t2zZQr169fJ1L+INGzbQpEmTbHNQCyEeTBKyECVMx44d+e9//5utrE2bNly/fh13d3e7xDRhwgTeeeedbHdeykv37t3RarWsWLGiGCITouyQhCxEKaDT6fDz80OlUhX7vnft2sX58+fp06dPvt/z8ssv88knnxRhVEKUPZKQhShBXn75ZbZv387HH3+MSqVCpVIRERGRo8l62bJleHh48Ntvv1GnTh2cnJx47rnnSElJ4euvv6ZatWp4enoyevTobM3M6enpvPnmm1SuXBlnZ2datWpFWFjYfWNauXIlXbt2xWAwWMsOHz5Mp06dcHV1xc3NjeDgYPbv3299/cknn2T//v2cP3++UOtHiLLMwd4BCCH+9fHHH3PmzBkaNGjA1KlTAfDx8SEiIiLHuikpKXzyySesXLmSxMREnn32WZ555hk8PDxYv349Fy5coE+fPrRt25bnn38egNdff50TJ06wcuVKKlWqxNq1a+nevTtHjx6lVq1auca0c+dOBgwYkK1s4MCBNG3alM8//xyNRsOhQ4fQarXW1wMDA/H19WXnzp0EBQUVUu0IUbZJQhaiBHF3d0en0+Hk5ISfn999183IyODzzz+3JrznnnuOb775hhs3buDi4sIjjzxCp06d2LZtG88//zyRkZEsXbqUyMhIKlWqBMCbb77Jhg0bWLp0KdOnT891P5cuXbKuf0dkZCTjx4+nbt26ALkm80qVKnHp0iWb60CI8koSshCllJOTU7azT19fX6pVq4aLi0u2sps3bwJw9OhRzGYztWvXzrad9PR0KlSokOd+UlNTszVXA4wbN45hw4bxzTff0KVLF/r27ZvjTNjR0ZGUlJQCH58Q5Y0kZCFKqbubiAFUKlWuZXeGHyUlJaHRaDhw4ECO3tJ3J/F7eXt7Exsbm61sypQpDBgwgN9//50//viDyZMns3LlSp555hnrOrdv38bHx6dAxyZEeSQJWYgSRqfT5Wu8r62aNm2K2Wzm5s2btG/f3qb3nThxIkd57dq1qV27NmPHjqV///4sXbrUmpDT0tI4f/48TZs2LbT4hSjrpJe1ECVMtWrV+Ouvv4iIiCA6OrrQJtioXbs2AwcOZNCgQaxZs4aLFy/y999/M2PGDH7//fc839etWzd27dplfZ6amsrrr79OWFgYly5dYvfu3fzzzz/Uq1fPus6+ffvQ6/W0bt26UGIXojyQhCxECfPmm2+i0Wh45JFH8PHxITIystC2vXTpUgYNGsT//d//UadOHXr37s0///xDYGBgnu8ZOHAgx48f5/Tp0wBoNBpiYmIYNGgQtWvXpl+/fvTo0YP33nvP+p7vv/+egQMH4uTkVGixC1HWqRRFUewdhBCiZBs/fjwJCQl88cUXD1w3OjqaOnXqsH//fqpXr14M0QlRNsgZshDigSZNmkTVqlXz1XweERHBZ599JslYCBvJGbIQQghRAsgZshBCCFECSEIWQgghSgBJyEIIIUQJIAlZCCGEKAEkIQshhBAlgCRkIYQQogSQhCyEEEKUAJKQhRBCiBJAErIQQghRAvx/Ez4IGfSwXqsAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fig, axs = plt.subplots(2,1, figsize=(5,3))\n", + "plt.sca(axs[0])\n", + "r_exp=Reward(1, expire_clock=0.5, decay=\"linear\", decay_knobs=[6])\n", + "r_exp.plot_theoretical_reward()\n", + "plt.sca(axs[1])\n", + "r_exp2=Reward(1, expire_clock=0.9, decay=\"linear\", decay_knobs=[3])\n", + "r_exp2.plot_theoretical_reward()\n", + "plt.suptitle('Linear decay reward functions')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "16fd78cb-35fd-4519-b616-e147eb946ba3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Text(0.5, 0.98, 'Constant decay reward function')" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdoAAADBCAYAAABognFDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAABQpklEQVR4nO3dd1gUV/s38O/2pRfpCCggKEpRQEQFVDS2RLG3J6KJRn9JHhNrbLE+Cb4aRRONRJPYYjdqYjRYQBRL7KJiQ0SxUFU67LK75/0DmbhSZJWFRe/Pde2lzN47e88wuzdz5sw5PMYYAyGEEEK0gl/fCRBCCCFvMyq0hBBCiBZRoSWEEEK0iAotIYQQokVUaAkhhBAtokJLCCGEaBEVWkIIIUSLqNASQgghWkSFlhBCCNEiKrSE1FCnTp3QqVOn+k6DvGTevHng8Xg1it20aROaN28OkUgEU1NT7Sb2mu7duwcej4f169fXdyqkllChfYslJydj3LhxcHZ2hlQqhbGxMTp06IAVK1aguLi4XnM7cOAA5s2bVyfvderUKcybNw85OTl18n5EN928eROjRo2Ci4sL1q5dizVr1tRrPlu2bMHy5cvrNQdSN4T1nQDRjv3792PQoEGQSCQYOXIkWrVqBblcjhMnTmDq1KlITEys1y+aAwcOYNWqVXVSbE+dOoX58+dj1KhROnsWQ7QvLi4OKpUKK1asgKura32ngy1btuDatWv48ssv1ZY7OTmhuLgYIpGofhIjtY4K7VsoJSUFQ4cOhZOTE2JjY2Fra8s999lnn+HOnTvYv39/PWZIdElhYSEMDAzqO40qKRQKqFQqiMXiN1pPZmYmAOj8H1s8Hg9SqbS+0yC1iZG3zvjx4xkAdvLkyRrFl5aWsgULFjBnZ2cmFouZk5MTmzFjBispKVGLc3JyYr1792bx8fHM39+fSSQS1rRpU7Zhwwa1OLlczubNm8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Yfjw4di/fz/+/vtvzJ07F9u2bUO/fv24mKdPn8LS0vK1to2QtwkVWkJ0jFgsrtH9qppq3bo1lEolMjMzERQUpNHrrl+/XmG5m5sb3NzcMHHiRAwbNgzr1q3jCm1JSQmSk5PRunXrWsufkIaKeh0TomOaNGmCM2fO4N69e8jOzq61gR/c3NwwYsQIjBw5Ert370ZKSgrOnj2LiIgI7N+/v8rXde/eHSdOnOB+Li4uxueff464uDjcv38fJ0+exLlz59CiRQsu5p9//oFEIkFgYGCt5E5IQ0aFlhAdM2XKFAgEAnh4eMDS0hKpqam1tu5169Zh5MiRmDx5Mtzd3REWFoZz587B0dGxyteMGDECiYmJuHXrFgBAIBDgyZMnGDlyJNzc3DB48GD07NkT8+fP516zdetWjBgxAvr6+rWWOyENFY8xxuo7CUKIbps6dSry8vLw008/vTI2Ozsb7u7uOH/+PJo2bVoH2RGi2+iMlhDySrNmzYKTk1ONmrHv3buHH3/8kYosIc/RGS0hhBCiRXRGSwghhGgRFVpCCCFEi6jQEkIIIVpEhZYQQgjRIiq0hBBCiBZRoSWEEEK0iAotIYQQokVUaAkhhBAtokJLCCGEaNH/B8Q5dtFO2JJ2AAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fig, axs = plt.subplots(1,1, figsize=(5,1.5))\n", + "plt.sca(axs)\n", + "r_con=Reward(1, expire_clock=1/3, decay=\"constant\", decay_knobs=[3])\n", + "r_con.plot_theoretical_reward((0,0.4))\n", + "plt.axhline([0], c=\"black\", linestyle=\"dashed\")\n", + "plt.suptitle('Constant decay reward function')" + ] + }, + { + "cell_type": "markdown", + "id": "ae4b9e07-4c95-4cdb-bfc3-199247de5968", + "metadata": {}, + "source": [ + "### 🎯 `Goal` objects are used to 🔍 _detect a condition_ and 💰 _release these `Reward` objects above 👆\n", + "\n", + "`Rewards` come from special objects that merely check for a rule or objective being satisfied: `Goal`s. For example, an agent enters a special region of a maze and receives a reward, a `SpatialGoal`. Later, we will create those and place them into our `TaskEnvironment`. " + ] + }, + { + "cell_type": "markdown", + "id": "c6b2a532-e21b-4e93-9248-c8d1762a50d3", + "metadata": {}, + "source": [ + "# ⚙️ Configuring `TaskEnvironment` with 🐀 `Agent` objects\n", + "\n", + "Let's take the example task environment, `SpatialGoalTaskEnvironment`; it's configured it to work with `SpatialGoal` objects, although you could pass `SpatialGoal` objects to a vanilla `TaskEnvironment`. \n", + "\n", + "There are two approaches to setting up goals for a task. \n", + "- 🍎 One approach, you make a pool of goal objects yourself and give them to the environment. This is the least opaque.\n", + "- 🚀 The other, you allow `SpatialGoalTaskEnvironment` to construct your goals using keyword arguments the `goalkws` passed to `SpatialTaskEnvironment`. This let's it manage creating them for you. New TaskEnvironments have to have the internal machinery (which is fairly lightweight) to automate this.\n", + "\n", + "#### 🍎 Easy example: Manually crafting goals and integrating them into a versatile TaskEnvironment\n", + "\n", + "First, we're going to dive into the most adaptable scenario. We'll be forging our own 🎯 Goal objects, each with a 💰 Reward, and then delivering those goals to a TaskEnvironment or SpatialTaskEnvironment. To start, let's erect a type of TaskEnvironment object." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "94134941-6e0f-4eba-8a65-058f7fb92ebe", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:694: UserWarning: Cannot collect the default_params dictionaries, as SpatialGoalEnvironment does not have the class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().)\n", + " warnings.warn(\n", + "/Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:749: UserWarning: Cannot check the keys in the params dictionary, as does not have a class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().)\n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "env = SpatialGoalEnvironment(params={'dimensionality':'2D'},\n", + " render_every=1, # how often to draw on .render() \n", + " teleport_on_reset=False, # teleport animal to new location each episode?\n", + " verbose=False)" + ] + }, + { + "cell_type": "markdown", + "id": "26ba4619-736a-4f0f-9fbe-e047443844e6", + "metadata": {}, + "source": [ + "Now, let's bring some goals to life for our environment. We intialize goals by attaching them to an environment. In the case of the spatial goals below, they have some default reward (unless you attach your own through `reward=reward`) and take on a random position (unless you provide it through `pos=pos`). \n", + "\n", + "Here, we generates two spatial goals at random coordinates within the environment 🎲, and one goal that has a precise position (x=0.2, y=0.2) and a reward object `r_con` that's granted upon completion 🎯. The remaining goals will be equipped with the default reward object.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "553b8cb7-8011-4e8c-b15d-4871c715a907", + "metadata": {}, + "outputs": [], + "source": [ + "goals = [SpatialGoal(env), SpatialGoal(env),\n", + " SpatialGoal(env, pos=[0.2, 0.2], reward=r_con)]" + ] + }, + { + "cell_type": "markdown", + "id": "421d2758-008a-4104-93f1-0d0c7004476d", + "metadata": {}, + "source": [ + "We're now ready to attach these goals to our task and recruit some agents 🐀.\n", + "\n", + "The render function will illustrate your environment, agents, and anything else that the task environment is programmed to depict. In the case of `SpatialGoalEnvironment`, it's been fine-tuned to showcase spatial goal objects 🎯." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "c9df089f-f527-4c15-91f7-ec24f5255417", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here are the active agents who have yet to solve the episode goals: ['agent_0']\n", + "env.reset() will reset goals from pool of n=3 possible goals\n" + ] + } + ], + "source": [ + "Ag = Agent(env)\n", + "env.goal_cache.reset_goals = goals # you can also pass these into goalcachekws of an environment\n", + "env.add_agents(Ag)\n", + "print(\"Here are the active agents who have yet to solve the episode goals:\", env.agents)\n", + "print(f\"env.reset() will reset goals from pool of n={len(env.goal_cache.reset_goals)} possible goals\")" + ] + }, + { + "cell_type": "markdown", + "id": "5bd64c54-3903-44fe-999b-7f7a6dd118ee", + "metadata": {}, + "source": [ + "### `.step()` the environment\n", + "we now can make our agents take a step in environment given its state, and the step() will return a set of dictionaries patterned {agent_name:value}. It returns observations the agents make (their states), the rewards per agent, and whether each agent hits a stopping point (if all goals are satisfied this episode for). (See `pettingzoo.env` documentation for more info about the return objects.)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "789d7cf6-8917-445a-a5d9-2e6aca6de781", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Observation: {'agent_0': array([0.54666599, 0.3439716 ])} Reward: {'agent_0': 0} Terminate episode: {'agent_0': False}\n" + ] + } + ], + "source": [ + "observation, reward, terminate_epi, _ , info = env.step() # Take a single action randomly\n", + "print(\"Observation: \", observation,\n", + " \"Reward: \", reward,\n", + " \"Terminate episode: \", terminate_epi)" + ] + }, + { + "cell_type": "markdown", + "id": "1ca984be-8518-485a-bc49-e167a57d9a3a", + "metadata": {}, + "source": [ + "Since we have only _1 agent_, there is a shortcut function `.step1()`. With this call, an environment can behave more like single-agent `Gymnasium` instead of `pettingzoo`, only returning the observation, reward, and halting information for our one agent. Less cumbersome for one agent simulations." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "49b65790-8b6b-4c56-8e0a-755d98a10c82", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Observation: [0.54747371 0.34397705] Reward: 0 Terminate episode: False\n" + ] + } + ], + "source": [ + "observation, reward, terminate_epi, _ , info = env.step1() # Take a single action randomly\n", + "print(\"Observation: \", observation,\n", + " \"Reward: \", reward,\n", + " \"Terminate episode: \", terminate_epi)" + ] + }, + { + "cell_type": "markdown", + "id": "d1b1da0f-1740-4fa8-a870-651d136d4cf0", + "metadata": {}, + "source": [ + "### Animating an episode\n", + "Generally, we call step() repeatedly in a while-loop to carry out an epsiode. \n", + "\n", + "Here, we plan to create a matplotlib animation; so let's instead create a function that draws a single step()! This function \"plans\" an action, takes the action via .step(), and then `render()` or draws the agents, environment, and goals. " + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "99f62f04-baeb-4ff3-be6c-18d779d17ccb", + "metadata": {}, + "outputs": [], + "source": [ + "def animate_update(*pos, **kws):\n", + " dir_to_reward = {name:get_goal_vector(Ag)\n", + " for name, Ag in env.Ags.items()}\n", + " actions = {agent : speed * Ag.speed_mean * \n", + " (dir_to_reward / np.linalg.norm(dir_to_reward))\n", + " for (agent, dir_to_reward) in dir_to_reward.items()}\n", + " \n", + " observation, reward, terminate_episode, _, info = \\\n", + " env.step(actions)\n", + " \n", + " fig, ax = env.render()\n", + " if any(terminate_episode.values()):\n", + " print(\"done! reward:\", reward)\n", + " env.reset()\n", + " print(\"starting episode:\", env.episode)\n", + " \n", + " return fig" + ] + }, + { + "cell_type": "markdown", + "id": "6a07497a-b527-4746-804b-a79495b6a034", + "metadata": {}, + "source": [ + "(If we were not using `FuncAnimation` and jupyter here, you could just blurt this function code into a while loop, and we would see a quick live-rendered plot.)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "a69679fa-3273-49c0-9e88-b0d04cfa707f", + "metadata": {}, + "outputs": [ + { + "data": { + "application/javascript": [ + "/* Put everything inside the global mpl namespace */\n", + "/* global mpl */\n", + "window.mpl = {};\n", + "\n", + "mpl.get_websocket_type = function () {\n", + " if (typeof WebSocket !== 'undefined') {\n", + " return WebSocket;\n", + " } else if (typeof MozWebSocket !== 'undefined') {\n", + " return MozWebSocket;\n", + " } else {\n", + " alert(\n", + " 'Your browser does not have WebSocket support. ' +\n", + " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", + " 'Firefox 4 and 5 are also supported but you ' +\n", + " 'have to enable WebSockets in about:config.'\n", + " );\n", + " }\n", + "};\n", + "\n", + "mpl.figure = function (figure_id, websocket, ondownload, parent_element) {\n", + " this.id = figure_id;\n", + "\n", + " this.ws = websocket;\n", + "\n", + " this.supports_binary = this.ws.binaryType !== undefined;\n", + "\n", + " if (!this.supports_binary) {\n", + " var warnings = document.getElementById('mpl-warnings');\n", + " if (warnings) {\n", + " warnings.style.display = 'block';\n", + " warnings.textContent =\n", + " 'This browser does not support binary websocket messages. ' +\n", + " 'Performance may be slow.';\n", + " }\n", + " }\n", + "\n", + " this.imageObj = new Image();\n", + "\n", + " this.context = undefined;\n", + " this.message = undefined;\n", + " this.canvas = undefined;\n", + " this.rubberband_canvas = undefined;\n", + " this.rubberband_context = undefined;\n", + " this.format_dropdown = undefined;\n", + "\n", + " this.image_mode = 'full';\n", + "\n", + " this.root = document.createElement('div');\n", + " this.root.setAttribute('style', 'display: inline-block');\n", + " this._root_extra_style(this.root);\n", + "\n", + " parent_element.appendChild(this.root);\n", + "\n", + " this._init_header(this);\n", + " this._init_canvas(this);\n", + " this._init_toolbar(this);\n", + "\n", + " var fig = this;\n", + "\n", + " this.waiting = false;\n", + "\n", + " this.ws.onopen = function () {\n", + " fig.send_message('supports_binary', { value: fig.supports_binary });\n", + " fig.send_message('send_image_mode', {});\n", + " if (fig.ratio !== 1) {\n", + " fig.send_message('set_device_pixel_ratio', {\n", + " device_pixel_ratio: fig.ratio,\n", + " });\n", + " }\n", + " fig.send_message('refresh', {});\n", + " };\n", + "\n", + " this.imageObj.onload = function () {\n", + " if (fig.image_mode === 'full') {\n", + " // Full images could contain transparency (where diff images\n", + " // almost always do), so we need to clear the canvas so that\n", + " // there is no ghosting.\n", + " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", + " }\n", + " fig.context.drawImage(fig.imageObj, 0, 0);\n", + " };\n", + "\n", + " this.imageObj.onunload = function () {\n", + " fig.ws.close();\n", + " };\n", + "\n", + " this.ws.onmessage = this._make_on_message_function(this);\n", + "\n", + " this.ondownload = ondownload;\n", + "};\n", + "\n", + "mpl.figure.prototype._init_header = function () {\n", + " var titlebar = document.createElement('div');\n", + " titlebar.classList =\n", + " 'ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix';\n", + " var titletext = document.createElement('div');\n", + " titletext.classList = 'ui-dialog-title';\n", + " titletext.setAttribute(\n", + " 'style',\n", + " 'width: 100%; text-align: center; padding: 3px;'\n", + " );\n", + " titlebar.appendChild(titletext);\n", + " this.root.appendChild(titlebar);\n", + " this.header = titletext;\n", + "};\n", + "\n", + "mpl.figure.prototype._canvas_extra_style = function (_canvas_div) {};\n", + "\n", + "mpl.figure.prototype._root_extra_style = function (_canvas_div) {};\n", + "\n", + "mpl.figure.prototype._init_canvas = function () {\n", + " var fig = this;\n", + "\n", + " var canvas_div = (this.canvas_div = document.createElement('div'));\n", + " canvas_div.setAttribute(\n", + " 'style',\n", + " 'border: 1px solid #ddd;' +\n", + " 'box-sizing: content-box;' +\n", + " 'clear: both;' +\n", + " 'min-height: 1px;' +\n", + " 'min-width: 1px;' +\n", + " 'outline: 0;' +\n", + " 'overflow: hidden;' +\n", + " 'position: relative;' +\n", + " 'resize: both;'\n", + " );\n", + "\n", + " function on_keyboard_event_closure(name) {\n", + " return function (event) {\n", + " return fig.key_event(event, name);\n", + " };\n", + " }\n", + "\n", + " canvas_div.addEventListener(\n", + " 'keydown',\n", + " on_keyboard_event_closure('key_press')\n", + " );\n", + " canvas_div.addEventListener(\n", + " 'keyup',\n", + " on_keyboard_event_closure('key_release')\n", + " );\n", + "\n", + " this._canvas_extra_style(canvas_div);\n", + " this.root.appendChild(canvas_div);\n", + "\n", + " var canvas = (this.canvas = document.createElement('canvas'));\n", + " canvas.classList.add('mpl-canvas');\n", + " canvas.setAttribute('style', 'box-sizing: content-box;');\n", + "\n", + " this.context = canvas.getContext('2d');\n", + "\n", + " var backingStore =\n", + " this.context.backingStorePixelRatio ||\n", + " this.context.webkitBackingStorePixelRatio ||\n", + " this.context.mozBackingStorePixelRatio ||\n", + " this.context.msBackingStorePixelRatio ||\n", + " this.context.oBackingStorePixelRatio ||\n", + " this.context.backingStorePixelRatio ||\n", + " 1;\n", + "\n", + " this.ratio = (window.devicePixelRatio || 1) / backingStore;\n", + "\n", + " var rubberband_canvas = (this.rubberband_canvas = document.createElement(\n", + " 'canvas'\n", + " ));\n", + " rubberband_canvas.setAttribute(\n", + " 'style',\n", + " 'box-sizing: content-box; position: absolute; left: 0; top: 0; z-index: 1;'\n", + " );\n", + "\n", + " // Apply a ponyfill if ResizeObserver is not implemented by browser.\n", + " if (this.ResizeObserver === undefined) {\n", + " if (window.ResizeObserver !== undefined) {\n", + " this.ResizeObserver = window.ResizeObserver;\n", + " } else {\n", + " var obs = _JSXTOOLS_RESIZE_OBSERVER({});\n", + " this.ResizeObserver = obs.ResizeObserver;\n", + " }\n", + " }\n", + "\n", + " this.resizeObserverInstance = new this.ResizeObserver(function (entries) {\n", + " var nentries = entries.length;\n", + " for (var i = 0; i < nentries; i++) {\n", + " var entry = entries[i];\n", + " var width, height;\n", + " if (entry.contentBoxSize) {\n", + " if (entry.contentBoxSize instanceof Array) {\n", + " // Chrome 84 implements new version of spec.\n", + " width = entry.contentBoxSize[0].inlineSize;\n", + " height = entry.contentBoxSize[0].blockSize;\n", + " } else {\n", + " // Firefox implements old version of spec.\n", + " width = entry.contentBoxSize.inlineSize;\n", + " height = entry.contentBoxSize.blockSize;\n", + " }\n", + " } else {\n", + " // Chrome <84 implements even older version of spec.\n", + " width = entry.contentRect.width;\n", + " height = entry.contentRect.height;\n", + " }\n", + "\n", + " // Keep the size of the canvas and rubber band canvas in sync with\n", + " // the canvas container.\n", + " if (entry.devicePixelContentBoxSize) {\n", + " // Chrome 84 implements new version of spec.\n", + " canvas.setAttribute(\n", + " 'width',\n", + " entry.devicePixelContentBoxSize[0].inlineSize\n", + " );\n", + " canvas.setAttribute(\n", + " 'height',\n", + " entry.devicePixelContentBoxSize[0].blockSize\n", + " );\n", + " } else {\n", + " canvas.setAttribute('width', width * fig.ratio);\n", + " canvas.setAttribute('height', height * fig.ratio);\n", + " }\n", + " canvas.setAttribute(\n", + " 'style',\n", + " 'width: ' + width + 'px; height: ' + height + 'px;'\n", + " );\n", + "\n", + " rubberband_canvas.setAttribute('width', width);\n", + " rubberband_canvas.setAttribute('height', height);\n", + "\n", + " // And update the size in Python. We ignore the initial 0/0 size\n", + " // that occurs as the element is placed into the DOM, which should\n", + " // otherwise not happen due to the minimum size styling.\n", + " if (fig.ws.readyState == 1 && width != 0 && height != 0) {\n", + " fig.request_resize(width, height);\n", + " }\n", + " }\n", + " });\n", + " this.resizeObserverInstance.observe(canvas_div);\n", + "\n", + " function on_mouse_event_closure(name) {\n", + " return function (event) {\n", + " return fig.mouse_event(event, name);\n", + " };\n", + " }\n", + "\n", + " rubberband_canvas.addEventListener(\n", + " 'mousedown',\n", + " on_mouse_event_closure('button_press')\n", + " );\n", + " rubberband_canvas.addEventListener(\n", + " 'mouseup',\n", + " on_mouse_event_closure('button_release')\n", + " );\n", + " rubberband_canvas.addEventListener(\n", + " 'dblclick',\n", + " on_mouse_event_closure('dblclick')\n", + " );\n", + " // Throttle sequential mouse events to 1 every 20ms.\n", + " rubberband_canvas.addEventListener(\n", + " 'mousemove',\n", + " on_mouse_event_closure('motion_notify')\n", + " );\n", + "\n", + " rubberband_canvas.addEventListener(\n", + " 'mouseenter',\n", + " on_mouse_event_closure('figure_enter')\n", + " );\n", + " rubberband_canvas.addEventListener(\n", + " 'mouseleave',\n", + " on_mouse_event_closure('figure_leave')\n", + " );\n", + "\n", + " canvas_div.addEventListener('wheel', function (event) {\n", + " if (event.deltaY < 0) {\n", + " event.step = 1;\n", + " } else {\n", + " event.step = -1;\n", + " }\n", + " on_mouse_event_closure('scroll')(event);\n", + " });\n", + "\n", + " canvas_div.appendChild(canvas);\n", + " canvas_div.appendChild(rubberband_canvas);\n", + "\n", + " this.rubberband_context = rubberband_canvas.getContext('2d');\n", + " this.rubberband_context.strokeStyle = '#000000';\n", + "\n", + " this._resize_canvas = function (width, height, forward) {\n", + " if (forward) {\n", + " canvas_div.style.width = width + 'px';\n", + " canvas_div.style.height = height + 'px';\n", + " }\n", + " };\n", + "\n", + " // Disable right mouse context menu.\n", + " this.rubberband_canvas.addEventListener('contextmenu', function (_e) {\n", + " event.preventDefault();\n", + " return false;\n", + " });\n", + "\n", + " function set_focus() {\n", + " canvas.focus();\n", + " canvas_div.focus();\n", + " }\n", + "\n", + " window.setTimeout(set_focus, 100);\n", + "};\n", + "\n", + "mpl.figure.prototype._init_toolbar = function () {\n", + " var fig = this;\n", + "\n", + " var toolbar = document.createElement('div');\n", + " toolbar.classList = 'mpl-toolbar';\n", + " this.root.appendChild(toolbar);\n", + "\n", + " function on_click_closure(name) {\n", + " return function (_event) {\n", + " return fig.toolbar_button_onclick(name);\n", + " };\n", + " }\n", + "\n", + " function on_mouseover_closure(tooltip) {\n", + " return function (event) {\n", + " if (!event.currentTarget.disabled) {\n", + " return fig.toolbar_button_onmouseover(tooltip);\n", + " }\n", + " };\n", + " }\n", + "\n", + " fig.buttons = {};\n", + " var buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'mpl-button-group';\n", + " for (var toolbar_ind in mpl.toolbar_items) {\n", + " var name = mpl.toolbar_items[toolbar_ind][0];\n", + " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", + " var image = mpl.toolbar_items[toolbar_ind][2];\n", + " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", + "\n", + " if (!name) {\n", + " /* Instead of a spacer, we start a new button group. */\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + " buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'mpl-button-group';\n", + " continue;\n", + " }\n", + "\n", + " var button = (fig.buttons[name] = document.createElement('button'));\n", + " button.classList = 'mpl-widget';\n", + " button.setAttribute('role', 'button');\n", + " button.setAttribute('aria-disabled', 'false');\n", + " button.addEventListener('click', on_click_closure(method_name));\n", + " button.addEventListener('mouseover', on_mouseover_closure(tooltip));\n", + "\n", + " var icon_img = document.createElement('img');\n", + " icon_img.src = '_images/' + image + '.png';\n", + " icon_img.srcset = '_images/' + image + '_large.png 2x';\n", + " icon_img.alt = tooltip;\n", + " button.appendChild(icon_img);\n", + "\n", + " buttonGroup.appendChild(button);\n", + " }\n", + "\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + "\n", + " var fmt_picker = document.createElement('select');\n", + " fmt_picker.classList = 'mpl-widget';\n", + " toolbar.appendChild(fmt_picker);\n", + " this.format_dropdown = fmt_picker;\n", + "\n", + " for (var ind in mpl.extensions) {\n", + " var fmt = mpl.extensions[ind];\n", + " var option = document.createElement('option');\n", + " option.selected = fmt === mpl.default_extension;\n", + " option.innerHTML = fmt;\n", + " fmt_picker.appendChild(option);\n", + " }\n", + "\n", + " var status_bar = document.createElement('span');\n", + " status_bar.classList = 'mpl-message';\n", + " toolbar.appendChild(status_bar);\n", + " this.message = status_bar;\n", + "};\n", + "\n", + "mpl.figure.prototype.request_resize = function (x_pixels, y_pixels) {\n", + " // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n", + " // which will in turn request a refresh of the image.\n", + " this.send_message('resize', { width: x_pixels, height: y_pixels });\n", + "};\n", + "\n", + "mpl.figure.prototype.send_message = function (type, properties) {\n", + " properties['type'] = type;\n", + " properties['figure_id'] = this.id;\n", + " this.ws.send(JSON.stringify(properties));\n", + "};\n", + "\n", + "mpl.figure.prototype.send_draw_message = function () {\n", + " if (!this.waiting) {\n", + " this.waiting = true;\n", + " this.ws.send(JSON.stringify({ type: 'draw', figure_id: this.id }));\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_save = function (fig, _msg) {\n", + " var format_dropdown = fig.format_dropdown;\n", + " var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n", + " fig.ondownload(fig, format);\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_resize = function (fig, msg) {\n", + " var size = msg['size'];\n", + " if (size[0] !== fig.canvas.width || size[1] !== fig.canvas.height) {\n", + " fig._resize_canvas(size[0], size[1], msg['forward']);\n", + " fig.send_message('refresh', {});\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_rubberband = function (fig, msg) {\n", + " var x0 = msg['x0'] / fig.ratio;\n", + " var y0 = (fig.canvas.height - msg['y0']) / fig.ratio;\n", + " var x1 = msg['x1'] / fig.ratio;\n", + " var y1 = (fig.canvas.height - msg['y1']) / fig.ratio;\n", + " x0 = Math.floor(x0) + 0.5;\n", + " y0 = Math.floor(y0) + 0.5;\n", + " x1 = Math.floor(x1) + 0.5;\n", + " y1 = Math.floor(y1) + 0.5;\n", + " var min_x = Math.min(x0, x1);\n", + " var min_y = Math.min(y0, y1);\n", + " var width = Math.abs(x1 - x0);\n", + " var height = Math.abs(y1 - y0);\n", + "\n", + " fig.rubberband_context.clearRect(\n", + " 0,\n", + " 0,\n", + " fig.canvas.width / fig.ratio,\n", + " fig.canvas.height / fig.ratio\n", + " );\n", + "\n", + " fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_figure_label = function (fig, msg) {\n", + " // Updates the figure title.\n", + " fig.header.textContent = msg['label'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_cursor = function (fig, msg) {\n", + " fig.rubberband_canvas.style.cursor = msg['cursor'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_message = function (fig, msg) {\n", + " fig.message.textContent = msg['message'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_draw = function (fig, _msg) {\n", + " // Request the server to send over a new figure.\n", + " fig.send_draw_message();\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_image_mode = function (fig, msg) {\n", + " fig.image_mode = msg['mode'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_history_buttons = function (fig, msg) {\n", + " for (var key in msg) {\n", + " if (!(key in fig.buttons)) {\n", + " continue;\n", + " }\n", + " fig.buttons[key].disabled = !msg[key];\n", + " fig.buttons[key].setAttribute('aria-disabled', !msg[key]);\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_navigate_mode = function (fig, msg) {\n", + " if (msg['mode'] === 'PAN') {\n", + " fig.buttons['Pan'].classList.add('active');\n", + " fig.buttons['Zoom'].classList.remove('active');\n", + " } else if (msg['mode'] === 'ZOOM') {\n", + " fig.buttons['Pan'].classList.remove('active');\n", + " fig.buttons['Zoom'].classList.add('active');\n", + " } else {\n", + " fig.buttons['Pan'].classList.remove('active');\n", + " fig.buttons['Zoom'].classList.remove('active');\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.updated_canvas_event = function () {\n", + " // Called whenever the canvas gets updated.\n", + " this.send_message('ack', {});\n", + "};\n", + "\n", + "// A function to construct a web socket function for onmessage handling.\n", + "// Called in the figure constructor.\n", + "mpl.figure.prototype._make_on_message_function = function (fig) {\n", + " return function socket_on_message(evt) {\n", + " if (evt.data instanceof Blob) {\n", + " var img = evt.data;\n", + " if (img.type !== 'image/png') {\n", + " /* FIXME: We get \"Resource interpreted as Image but\n", + " * transferred with MIME type text/plain:\" errors on\n", + " * Chrome. But how to set the MIME type? It doesn't seem\n", + " * to be part of the websocket stream */\n", + " img.type = 'image/png';\n", + " }\n", + "\n", + " /* Free the memory for the previous frames */\n", + " if (fig.imageObj.src) {\n", + " (window.URL || window.webkitURL).revokeObjectURL(\n", + " fig.imageObj.src\n", + " );\n", + " }\n", + "\n", + " fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n", + " img\n", + " );\n", + " fig.updated_canvas_event();\n", + " fig.waiting = false;\n", + " return;\n", + " } else if (\n", + " typeof evt.data === 'string' &&\n", + " evt.data.slice(0, 21) === 'data:image/png;base64'\n", + " ) {\n", + " fig.imageObj.src = evt.data;\n", + " fig.updated_canvas_event();\n", + " fig.waiting = false;\n", + " return;\n", + " }\n", + "\n", + " var msg = JSON.parse(evt.data);\n", + " var msg_type = msg['type'];\n", + "\n", + " // Call the \"handle_{type}\" callback, which takes\n", + " // the figure and JSON message as its only arguments.\n", + " try {\n", + " var callback = fig['handle_' + msg_type];\n", + " } catch (e) {\n", + " console.log(\n", + " \"No handler for the '\" + msg_type + \"' message type: \",\n", + " msg\n", + " );\n", + " return;\n", + " }\n", + "\n", + " if (callback) {\n", + " try {\n", + " // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n", + " callback(fig, msg);\n", + " } catch (e) {\n", + " console.log(\n", + " \"Exception inside the 'handler_\" + msg_type + \"' callback:\",\n", + " e,\n", + " e.stack,\n", + " msg\n", + " );\n", + " }\n", + " }\n", + " };\n", + "};\n", + "\n", + "// from https://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n", + "mpl.findpos = function (e) {\n", + " //this section is from http://www.quirksmode.org/js/events_properties.html\n", + " var targ;\n", + " if (!e) {\n", + " e = window.event;\n", + " }\n", + " if (e.target) {\n", + " targ = e.target;\n", + " } else if (e.srcElement) {\n", + " targ = e.srcElement;\n", + " }\n", + " if (targ.nodeType === 3) {\n", + " // defeat Safari bug\n", + " targ = targ.parentNode;\n", + " }\n", + "\n", + " // pageX,Y are the mouse positions relative to the document\n", + " var boundingRect = targ.getBoundingClientRect();\n", + " var x = e.pageX - (boundingRect.left + document.body.scrollLeft);\n", + " var y = e.pageY - (boundingRect.top + document.body.scrollTop);\n", + "\n", + " return { x: x, y: y };\n", + "};\n", + "\n", + "/*\n", + " * return a copy of an object with only non-object keys\n", + " * we need this to avoid circular references\n", + " * https://stackoverflow.com/a/24161582/3208463\n", + " */\n", + "function simpleKeys(original) {\n", + " return Object.keys(original).reduce(function (obj, key) {\n", + " if (typeof original[key] !== 'object') {\n", + " obj[key] = original[key];\n", + " }\n", + " return obj;\n", + " }, {});\n", + "}\n", + "\n", + "mpl.figure.prototype.mouse_event = function (event, name) {\n", + " var canvas_pos = mpl.findpos(event);\n", + "\n", + " if (name === 'button_press') {\n", + " this.canvas.focus();\n", + " this.canvas_div.focus();\n", + " }\n", + "\n", + " var x = canvas_pos.x * this.ratio;\n", + " var y = canvas_pos.y * this.ratio;\n", + "\n", + " this.send_message(name, {\n", + " x: x,\n", + " y: y,\n", + " button: event.button,\n", + " step: event.step,\n", + " guiEvent: simpleKeys(event),\n", + " });\n", + "\n", + " /* This prevents the web browser from automatically changing to\n", + " * the text insertion cursor when the button is pressed. We want\n", + " * to control all of the cursor setting manually through the\n", + " * 'cursor' event from matplotlib */\n", + " event.preventDefault();\n", + " return false;\n", + "};\n", + "\n", + "mpl.figure.prototype._key_event_extra = function (_event, _name) {\n", + " // Handle any extra behaviour associated with a key event\n", + "};\n", + "\n", + "mpl.figure.prototype.key_event = function (event, name) {\n", + " // Prevent repeat events\n", + " if (name === 'key_press') {\n", + " if (event.key === this._key) {\n", + " return;\n", + " } else {\n", + " this._key = event.key;\n", + " }\n", + " }\n", + " if (name === 'key_release') {\n", + " this._key = null;\n", + " }\n", + "\n", + " var value = '';\n", + " if (event.ctrlKey && event.key !== 'Control') {\n", + " value += 'ctrl+';\n", + " }\n", + " else if (event.altKey && event.key !== 'Alt') {\n", + " value += 'alt+';\n", + " }\n", + " else if (event.shiftKey && event.key !== 'Shift') {\n", + " value += 'shift+';\n", + " }\n", + "\n", + " value += 'k' + event.key;\n", + "\n", + " this._key_event_extra(event, name);\n", + "\n", + " this.send_message(name, { key: value, guiEvent: simpleKeys(event) });\n", + " return false;\n", + "};\n", + "\n", + "mpl.figure.prototype.toolbar_button_onclick = function (name) {\n", + " if (name === 'download') {\n", + " this.handle_save(this, null);\n", + " } else {\n", + " this.send_message('toolbar_button', { name: name });\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.toolbar_button_onmouseover = function (tooltip) {\n", + " this.message.textContent = tooltip;\n", + "};\n", + "\n", + "///////////////// REMAINING CONTENT GENERATED BY embed_js.py /////////////////\n", + "// prettier-ignore\n", + "var _JSXTOOLS_RESIZE_OBSERVER=function(A){var t,i=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakMap,o=new Set;function s(e){if(!(this instanceof s))throw new TypeError(\"Constructor requires 'new' operator\");i.set(this,e)}function h(){throw new TypeError(\"Function is not a constructor\")}function c(e,t,i,n){e=0 in arguments?Number(arguments[0]):0,t=1 in arguments?Number(arguments[1]):0,i=2 in arguments?Number(arguments[2]):0,n=3 in arguments?Number(arguments[3]):0,this.right=(this.x=this.left=e)+(this.width=i),this.bottom=(this.y=this.top=t)+(this.height=n),Object.freeze(this)}function d(){t=requestAnimationFrame(d);var s=new WeakMap,p=new Set;o.forEach((function(t){r.get(t).forEach((function(i){var r=t instanceof window.SVGElement,o=a.get(t),d=r?0:parseFloat(o.paddingTop),f=r?0:parseFloat(o.paddingRight),l=r?0:parseFloat(o.paddingBottom),u=r?0:parseFloat(o.paddingLeft),g=r?0:parseFloat(o.borderTopWidth),m=r?0:parseFloat(o.borderRightWidth),w=r?0:parseFloat(o.borderBottomWidth),b=u+f,F=d+l,v=(r?0:parseFloat(o.borderLeftWidth))+m,W=g+w,y=r?0:t.offsetHeight-W-t.clientHeight,E=r?0:t.offsetWidth-v-t.clientWidth,R=b+v,z=F+W,M=r?t.width:parseFloat(o.width)-R-E,O=r?t.height:parseFloat(o.height)-z-y;if(n.has(t)){var k=n.get(t);if(k[0]===M&&k[1]===O)return}n.set(t,[M,O]);var S=Object.create(h.prototype);S.target=t,S.contentRect=new c(u,d,M,O),s.has(i)||(s.set(i,[]),p.add(i)),s.get(i).push(S)}))})),p.forEach((function(e){i.get(e).call(e,s.get(e),e)}))}return s.prototype.observe=function(i){if(i instanceof window.Element){r.has(i)||(r.set(i,new Set),o.add(i),a.set(i,window.getComputedStyle(i)));var n=r.get(i);n.has(this)||n.add(this),cancelAnimationFrame(t),t=requestAnimationFrame(d)}},s.prototype.unobserve=function(i){if(i instanceof window.Element&&r.has(i)){var n=r.get(i);n.has(this)&&(n.delete(this),n.size||(r.delete(i),o.delete(i))),n.size||r.delete(i),o.size||cancelAnimationFrame(t)}},A.DOMRectReadOnly=c,A.ResizeObserver=s,A.ResizeObserverEntry=h,A}; // eslint-disable-line\n", + "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Left button pans, Right button zooms\\nx/y fixes axis, CTRL fixes aspect\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\\nx/y fixes axis\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n", + "\n", + "mpl.extensions = [\"eps\", \"jpeg\", \"pgf\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n", + "\n", + "mpl.default_extension = \"png\";/* global mpl */\n", + "\n", + "var comm_websocket_adapter = function (comm) {\n", + " // Create a \"websocket\"-like object which calls the given IPython comm\n", + " // object with the appropriate methods. Currently this is a non binary\n", + " // socket, so there is still some room for performance tuning.\n", + " var ws = {};\n", + "\n", + " ws.binaryType = comm.kernel.ws.binaryType;\n", + " ws.readyState = comm.kernel.ws.readyState;\n", + " function updateReadyState(_event) {\n", + " if (comm.kernel.ws) {\n", + " ws.readyState = comm.kernel.ws.readyState;\n", + " } else {\n", + " ws.readyState = 3; // Closed state.\n", + " }\n", + " }\n", + " comm.kernel.ws.addEventListener('open', updateReadyState);\n", + " comm.kernel.ws.addEventListener('close', updateReadyState);\n", + " comm.kernel.ws.addEventListener('error', updateReadyState);\n", + "\n", + " ws.close = function () {\n", + " comm.close();\n", + " };\n", + " ws.send = function (m) {\n", + " //console.log('sending', m);\n", + " comm.send(m);\n", + " };\n", + " // Register the callback with on_msg.\n", + " comm.on_msg(function (msg) {\n", + " //console.log('receiving', msg['content']['data'], msg);\n", + " var data = msg['content']['data'];\n", + " if (data['blob'] !== undefined) {\n", + " data = {\n", + " data: new Blob(msg['buffers'], { type: data['blob'] }),\n", + " };\n", + " }\n", + " // Pass the mpl event to the overridden (by mpl) onmessage function.\n", + " ws.onmessage(data);\n", + " });\n", + " return ws;\n", + "};\n", + "\n", + "mpl.mpl_figure_comm = function (comm, msg) {\n", + " // This is the function which gets called when the mpl process\n", + " // starts-up an IPython Comm through the \"matplotlib\" channel.\n", + "\n", + " var id = msg.content.data.id;\n", + " // Get hold of the div created by the display call when the Comm\n", + " // socket was opened in Python.\n", + " var element = document.getElementById(id);\n", + " var ws_proxy = comm_websocket_adapter(comm);\n", + "\n", + " function ondownload(figure, _format) {\n", + " window.open(figure.canvas.toDataURL());\n", + " }\n", + "\n", + " var fig = new mpl.figure(id, ws_proxy, ondownload, element);\n", + "\n", + " // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n", + " // web socket which is closed, not our websocket->open comm proxy.\n", + " ws_proxy.onopen();\n", + "\n", + " fig.parent_element = element;\n", + " fig.cell_info = mpl.find_output_cell(\"
\");\n", + " if (!fig.cell_info) {\n", + " console.error('Failed to find cell for figure', id, fig);\n", + " return;\n", + " }\n", + " fig.cell_info[0].output_area.element.on(\n", + " 'cleared',\n", + " { fig: fig },\n", + " fig._remove_fig_handler\n", + " );\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_close = function (fig, msg) {\n", + " var width = fig.canvas.width / fig.ratio;\n", + " fig.cell_info[0].output_area.element.off(\n", + " 'cleared',\n", + " fig._remove_fig_handler\n", + " );\n", + " fig.resizeObserverInstance.unobserve(fig.canvas_div);\n", + "\n", + " // Update the output cell to use the data from the current canvas.\n", + " fig.push_to_output();\n", + " var dataURL = fig.canvas.toDataURL();\n", + " // Re-enable the keyboard manager in IPython - without this line, in FF,\n", + " // the notebook keyboard shortcuts fail.\n", + " IPython.keyboard_manager.enable();\n", + " fig.parent_element.innerHTML =\n", + " '';\n", + " fig.close_ws(fig, msg);\n", + "};\n", + "\n", + "mpl.figure.prototype.close_ws = function (fig, msg) {\n", + " fig.send_message('closing', msg);\n", + " // fig.ws.close()\n", + "};\n", + "\n", + "mpl.figure.prototype.push_to_output = function (_remove_interactive) {\n", + " // Turn the data on the canvas into data in the output cell.\n", + " var width = this.canvas.width / this.ratio;\n", + " var dataURL = this.canvas.toDataURL();\n", + " this.cell_info[1]['text/html'] =\n", + " '';\n", + "};\n", + "\n", + "mpl.figure.prototype.updated_canvas_event = function () {\n", + " // Tell IPython that the notebook contents must change.\n", + " IPython.notebook.set_dirty(true);\n", + " this.send_message('ack', {});\n", + " var fig = this;\n", + " // Wait a second, then push the new image to the DOM so\n", + " // that it is saved nicely (might be nice to debounce this).\n", + " setTimeout(function () {\n", + " fig.push_to_output();\n", + " }, 1000);\n", + "};\n", + "\n", + "mpl.figure.prototype._init_toolbar = function () {\n", + " var fig = this;\n", + "\n", + " var toolbar = document.createElement('div');\n", + " toolbar.classList = 'btn-toolbar';\n", + " this.root.appendChild(toolbar);\n", + "\n", + " function on_click_closure(name) {\n", + " return function (_event) {\n", + " return fig.toolbar_button_onclick(name);\n", + " };\n", + " }\n", + "\n", + " function on_mouseover_closure(tooltip) {\n", + " return function (event) {\n", + " if (!event.currentTarget.disabled) {\n", + " return fig.toolbar_button_onmouseover(tooltip);\n", + " }\n", + " };\n", + " }\n", + "\n", + " fig.buttons = {};\n", + " var buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'btn-group';\n", + " var button;\n", + " for (var toolbar_ind in mpl.toolbar_items) {\n", + " var name = mpl.toolbar_items[toolbar_ind][0];\n", + " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", + " var image = mpl.toolbar_items[toolbar_ind][2];\n", + " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", + "\n", + " if (!name) {\n", + " /* Instead of a spacer, we start a new button group. */\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + " buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'btn-group';\n", + " continue;\n", + " }\n", + "\n", + " button = fig.buttons[name] = document.createElement('button');\n", + " button.classList = 'btn btn-default';\n", + " button.href = '#';\n", + " button.title = name;\n", + " button.innerHTML = '';\n", + " button.addEventListener('click', on_click_closure(method_name));\n", + " button.addEventListener('mouseover', on_mouseover_closure(tooltip));\n", + " buttonGroup.appendChild(button);\n", + " }\n", + "\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + "\n", + " // Add the status bar.\n", + " var status_bar = document.createElement('span');\n", + " status_bar.classList = 'mpl-message pull-right';\n", + " toolbar.appendChild(status_bar);\n", + " this.message = status_bar;\n", + "\n", + " // Add the close button to the window.\n", + " var buttongrp = document.createElement('div');\n", + " buttongrp.classList = 'btn-group inline pull-right';\n", + " button = document.createElement('button');\n", + " button.classList = 'btn btn-mini btn-primary';\n", + " button.href = '#';\n", + " button.title = 'Stop Interaction';\n", + " button.innerHTML = '';\n", + " button.addEventListener('click', function (_evt) {\n", + " fig.handle_close(fig, {});\n", + " });\n", + " button.addEventListener(\n", + " 'mouseover',\n", + " on_mouseover_closure('Stop Interaction')\n", + " );\n", + " buttongrp.appendChild(button);\n", + " var titlebar = this.root.querySelector('.ui-dialog-titlebar');\n", + " titlebar.insertBefore(buttongrp, titlebar.firstChild);\n", + "};\n", + "\n", + "mpl.figure.prototype._remove_fig_handler = function (event) {\n", + " var fig = event.data.fig;\n", + " if (event.target !== this) {\n", + " // Ignore bubbled events from children.\n", + " return;\n", + " }\n", + " fig.close_ws(fig, {});\n", + "};\n", + "\n", + "mpl.figure.prototype._root_extra_style = function (el) {\n", + " el.style.boxSizing = 'content-box'; // override notebook setting of border-box.\n", + "};\n", + "\n", + "mpl.figure.prototype._canvas_extra_style = function (el) {\n", + " // this is important to make the div 'focusable\n", + " el.setAttribute('tabindex', 0);\n", + " // reach out to IPython and tell the keyboard manager to turn it's self\n", + " // off when our div gets focus\n", + "\n", + " // location in version 3\n", + " if (IPython.notebook.keyboard_manager) {\n", + " IPython.notebook.keyboard_manager.register_events(el);\n", + " } else {\n", + " // location in version 2\n", + " IPython.keyboard_manager.register_events(el);\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype._key_event_extra = function (event, _name) {\n", + " // Check for shift+enter\n", + " if (event.shiftKey && event.which === 13) {\n", + " this.canvas_div.blur();\n", + " // select the cell after this one\n", + " var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n", + " IPython.notebook.select(index + 1);\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_save = function (fig, _msg) {\n", + " fig.ondownload(fig, null);\n", + "};\n", + "\n", + "mpl.find_output_cell = function (html_output) {\n", + " // Return the cell and output element which can be found *uniquely* in the notebook.\n", + " // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n", + " // IPython event is triggered only after the cells have been serialised, which for\n", + " // our purposes (turning an active figure into a static one), is too late.\n", + " var cells = IPython.notebook.get_cells();\n", + " var ncells = cells.length;\n", + " for (var i = 0; i < ncells; i++) {\n", + " var cell = cells[i];\n", + " if (cell.cell_type === 'code') {\n", + " for (var j = 0; j < cell.output_area.outputs.length; j++) {\n", + " var data = cell.output_area.outputs[j];\n", + " if (data.data) {\n", + " // IPython >= 3 moved mimebundle to data attribute of output\n", + " data = data.data;\n", + " }\n", + " if (data['text/html'] === html_output) {\n", + " return [cell, data, j];\n", + " }\n", + " }\n", + " }\n", + " }\n", + "};\n", + "\n", + "// Register the function which deals with the matplotlib target/channel.\n", + "// The kernel may be null if the page has been refreshed.\n", + "if (IPython.notebook.kernel !== null) {\n", + " IPython.notebook.kernel.comm_manager.register_target(\n", + " 'matplotlib',\n", + " mpl.mpl_figure_comm\n", + " );\n", + "}\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "WARNING: This figure has not been saved.\n", + " • To AUTOMATICALLY save all plots (recommended), set `ratinabox.autosave_plots = True`\n", + " • To MANUALLY save plots, call `ratinabox.utils.save_figure(figure_object, save_title).\n", + " This warning will not be shown again\n", + "HINT: You can stylize plots to make them look like repo/paper by calling `ratinabox.stylize_plots()`\n", + " This hint will not be shown again\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 2\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 3\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 4\n", + "done! reward: {'agent_0': 1.99}\n", + "starting episode: 5\n", + "done! reward: {'agent_0': 2.9701}\n", + "starting episode: 6\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 7\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 8\n", + "done! reward: {'agent_0': 1.99}\n", + "starting episode: 9\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 10\n", + "done! reward: {'agent_0': 1.99}\n", + "starting episode: 11\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 12\n", + "done! reward: {'agent_0': 1}\n", + "starting episode: 13\n" + ] + }, + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "%matplotlib notebook\n", + "fig, ax = env.render(); # get the figure and axis\n", + "anim = FuncAnimation(fig, animate_update, range(1000), blit=False) # animate 1000 of of the environment-action loop\n", + "anim.save('TaskEnv_teaching_example_files/env_primary_interface.mp4', \n", + " writer='ffmpeg', fps=180)\n", + "Video(\"TaskEnv_teaching_example_files/env_primary_interface.mp4\")" + ] + }, + { + "cell_type": "markdown", + "id": "06397e77-41c1-4ee0-9419-18d9a3c068c2", + "metadata": {}, + "source": [ + "![My Animation](TaskEnv_teaching_example_files/animation.mp4)" + ] + }, + { + "cell_type": "markdown", + "id": "a9f79ae0-4298-4012-ad29-918721ea7268", + "metadata": {}, + "source": [ + "### 🚀 Shortcut to crafting SpatialGoals through a SpatialGoalEnvironment\n", + "\n", + "The derived class, SpatialGoalEnvironment, comes with its own set of convenience functions. These allow you to simply specify the number of goals and provide the construction arguments goalkws. You can also fine-tune features of the goalcache, as we discussed earlier, such as designating whether the goals are sequential or not, or if they're shared among agents 🤖." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "2376e972-02b4-476b-82ce-bdf18353c60c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Agent names: ['agent_0', 'agent_1']\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:694: UserWarning: Cannot collect the default_params dictionaries, as SpatialGoalEnvironment does not have the class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().)\n", + " warnings.warn(\n", + "/Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:749: UserWarning: Cannot check the keys in the params dictionary, as does not have a class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().)\n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "goalkws = dict(reward=r_exp) # Goal.__init__ kws called within Task, we could also just provide `Goal` objects\n", + "goalcachekws = dict(reset_n_goals=2,\n", + " agentmode=\"noninteract\",\n", + " goalorder=\"nonsequential\") # GoalCache.__init__ kws, these are covered elsewhere\n", + " # and can also be used for the 🍎 section\n", + " # ie for manually set goal collections\n", + "\n", + "env = SpatialGoalEnvironment(\n", + " teleport_on_reset=False, # \n", + " goalkws=goalkws, # Reward will be attached to the `Goal` object\n", + " goalcachekws=goalcachekws, # Goals will be tracked by the cache\n", + ")\n", + "\n", + "# Add our agents to the environment}\n", + "Ag = Agent(env)\n", + "Ag2 = Agent(env)\n", + "env.add_agents(Ag)\n", + "env.add_agents(Ag2)\n", + "print(\"Agent names: \",env.agent_names)" + ] + }, + { + "cell_type": "markdown", + "id": "17b477ff-b491-451e-b2db-23e37e94361f", + "metadata": {}, + "source": [ + "And now let's run the environment :)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "c411d33e-242d-4fec-8eb0-b693e06d5cd2", + "metadata": {}, + "outputs": [ + { + "data": { + "application/javascript": [ + "/* Put everything inside the global mpl namespace */\n", + "/* global mpl */\n", + "window.mpl = {};\n", + "\n", + "mpl.get_websocket_type = function () {\n", + " if (typeof WebSocket !== 'undefined') {\n", + " return WebSocket;\n", + " } else if (typeof MozWebSocket !== 'undefined') {\n", + " return MozWebSocket;\n", + " } else {\n", + " alert(\n", + " 'Your browser does not have WebSocket support. ' +\n", + " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", + " 'Firefox 4 and 5 are also supported but you ' +\n", + " 'have to enable WebSockets in about:config.'\n", + " );\n", + " }\n", + "};\n", + "\n", + "mpl.figure = function (figure_id, websocket, ondownload, parent_element) {\n", + " this.id = figure_id;\n", + "\n", + " this.ws = websocket;\n", + "\n", + " this.supports_binary = this.ws.binaryType !== undefined;\n", + "\n", + " if (!this.supports_binary) {\n", + " var warnings = document.getElementById('mpl-warnings');\n", + " if (warnings) {\n", + " warnings.style.display = 'block';\n", + " warnings.textContent =\n", + " 'This browser does not support binary websocket messages. ' +\n", + " 'Performance may be slow.';\n", + " }\n", + " }\n", + "\n", + " this.imageObj = new Image();\n", + "\n", + " this.context = undefined;\n", + " this.message = undefined;\n", + " this.canvas = undefined;\n", + " this.rubberband_canvas = undefined;\n", + " this.rubberband_context = undefined;\n", + " this.format_dropdown = undefined;\n", + "\n", + " this.image_mode = 'full';\n", + "\n", + " this.root = document.createElement('div');\n", + " this.root.setAttribute('style', 'display: inline-block');\n", + " this._root_extra_style(this.root);\n", + "\n", + " parent_element.appendChild(this.root);\n", + "\n", + " this._init_header(this);\n", + " this._init_canvas(this);\n", + " this._init_toolbar(this);\n", + "\n", + " var fig = this;\n", + "\n", + " this.waiting = false;\n", + "\n", + " this.ws.onopen = function () {\n", + " fig.send_message('supports_binary', { value: fig.supports_binary });\n", + " fig.send_message('send_image_mode', {});\n", + " if (fig.ratio !== 1) {\n", + " fig.send_message('set_device_pixel_ratio', {\n", + " device_pixel_ratio: fig.ratio,\n", + " });\n", + " }\n", + " fig.send_message('refresh', {});\n", + " };\n", + "\n", + " this.imageObj.onload = function () {\n", + " if (fig.image_mode === 'full') {\n", + " // Full images could contain transparency (where diff images\n", + " // almost always do), so we need to clear the canvas so that\n", + " // there is no ghosting.\n", + " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", + " }\n", + " fig.context.drawImage(fig.imageObj, 0, 0);\n", + " };\n", + "\n", + " this.imageObj.onunload = function () {\n", + " fig.ws.close();\n", + " };\n", + "\n", + " this.ws.onmessage = this._make_on_message_function(this);\n", + "\n", + " this.ondownload = ondownload;\n", + "};\n", + "\n", + "mpl.figure.prototype._init_header = function () {\n", + " var titlebar = document.createElement('div');\n", + " titlebar.classList =\n", + " 'ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix';\n", + " var titletext = document.createElement('div');\n", + " titletext.classList = 'ui-dialog-title';\n", + " titletext.setAttribute(\n", + " 'style',\n", + " 'width: 100%; text-align: center; padding: 3px;'\n", + " );\n", + " titlebar.appendChild(titletext);\n", + " this.root.appendChild(titlebar);\n", + " this.header = titletext;\n", + "};\n", + "\n", + "mpl.figure.prototype._canvas_extra_style = function (_canvas_div) {};\n", + "\n", + "mpl.figure.prototype._root_extra_style = function (_canvas_div) {};\n", + "\n", + "mpl.figure.prototype._init_canvas = function () {\n", + " var fig = this;\n", + "\n", + " var canvas_div = (this.canvas_div = document.createElement('div'));\n", + " canvas_div.setAttribute(\n", + " 'style',\n", + " 'border: 1px solid #ddd;' +\n", + " 'box-sizing: content-box;' +\n", + " 'clear: both;' +\n", + " 'min-height: 1px;' +\n", + " 'min-width: 1px;' +\n", + " 'outline: 0;' +\n", + " 'overflow: hidden;' +\n", + " 'position: relative;' +\n", + " 'resize: both;'\n", + " );\n", + "\n", + " function on_keyboard_event_closure(name) {\n", + " return function (event) {\n", + " return fig.key_event(event, name);\n", + " };\n", + " }\n", + "\n", + " canvas_div.addEventListener(\n", + " 'keydown',\n", + " on_keyboard_event_closure('key_press')\n", + " );\n", + " canvas_div.addEventListener(\n", + " 'keyup',\n", + " on_keyboard_event_closure('key_release')\n", + " );\n", + "\n", + " this._canvas_extra_style(canvas_div);\n", + " this.root.appendChild(canvas_div);\n", + "\n", + " var canvas = (this.canvas = document.createElement('canvas'));\n", + " canvas.classList.add('mpl-canvas');\n", + " canvas.setAttribute('style', 'box-sizing: content-box;');\n", + "\n", + " this.context = canvas.getContext('2d');\n", + "\n", + " var backingStore =\n", + " this.context.backingStorePixelRatio ||\n", + " this.context.webkitBackingStorePixelRatio ||\n", + " this.context.mozBackingStorePixelRatio ||\n", + " this.context.msBackingStorePixelRatio ||\n", + " this.context.oBackingStorePixelRatio ||\n", + " this.context.backingStorePixelRatio ||\n", + " 1;\n", + "\n", + " this.ratio = (window.devicePixelRatio || 1) / backingStore;\n", + "\n", + " var rubberband_canvas = (this.rubberband_canvas = document.createElement(\n", + " 'canvas'\n", + " ));\n", + " rubberband_canvas.setAttribute(\n", + " 'style',\n", + " 'box-sizing: content-box; position: absolute; left: 0; top: 0; z-index: 1;'\n", + " );\n", + "\n", + " // Apply a ponyfill if ResizeObserver is not implemented by browser.\n", + " if (this.ResizeObserver === undefined) {\n", + " if (window.ResizeObserver !== undefined) {\n", + " this.ResizeObserver = window.ResizeObserver;\n", + " } else {\n", + " var obs = _JSXTOOLS_RESIZE_OBSERVER({});\n", + " this.ResizeObserver = obs.ResizeObserver;\n", + " }\n", + " }\n", + "\n", + " this.resizeObserverInstance = new this.ResizeObserver(function (entries) {\n", + " var nentries = entries.length;\n", + " for (var i = 0; i < nentries; i++) {\n", + " var entry = entries[i];\n", + " var width, height;\n", + " if (entry.contentBoxSize) {\n", + " if (entry.contentBoxSize instanceof Array) {\n", + " // Chrome 84 implements new version of spec.\n", + " width = entry.contentBoxSize[0].inlineSize;\n", + " height = entry.contentBoxSize[0].blockSize;\n", + " } else {\n", + " // Firefox implements old version of spec.\n", + " width = entry.contentBoxSize.inlineSize;\n", + " height = entry.contentBoxSize.blockSize;\n", + " }\n", + " } else {\n", + " // Chrome <84 implements even older version of spec.\n", + " width = entry.contentRect.width;\n", + " height = entry.contentRect.height;\n", + " }\n", + "\n", + " // Keep the size of the canvas and rubber band canvas in sync with\n", + " // the canvas container.\n", + " if (entry.devicePixelContentBoxSize) {\n", + " // Chrome 84 implements new version of spec.\n", + " canvas.setAttribute(\n", + " 'width',\n", + " entry.devicePixelContentBoxSize[0].inlineSize\n", + " );\n", + " canvas.setAttribute(\n", + " 'height',\n", + " entry.devicePixelContentBoxSize[0].blockSize\n", + " );\n", + " } else {\n", + " canvas.setAttribute('width', width * fig.ratio);\n", + " canvas.setAttribute('height', height * fig.ratio);\n", + " }\n", + " canvas.setAttribute(\n", + " 'style',\n", + " 'width: ' + width + 'px; height: ' + height + 'px;'\n", + " );\n", + "\n", + " rubberband_canvas.setAttribute('width', width);\n", + " rubberband_canvas.setAttribute('height', height);\n", + "\n", + " // And update the size in Python. We ignore the initial 0/0 size\n", + " // that occurs as the element is placed into the DOM, which should\n", + " // otherwise not happen due to the minimum size styling.\n", + " if (fig.ws.readyState == 1 && width != 0 && height != 0) {\n", + " fig.request_resize(width, height);\n", + " }\n", + " }\n", + " });\n", + " this.resizeObserverInstance.observe(canvas_div);\n", + "\n", + " function on_mouse_event_closure(name) {\n", + " return function (event) {\n", + " return fig.mouse_event(event, name);\n", + " };\n", + " }\n", + "\n", + " rubberband_canvas.addEventListener(\n", + " 'mousedown',\n", + " on_mouse_event_closure('button_press')\n", + " );\n", + " rubberband_canvas.addEventListener(\n", + " 'mouseup',\n", + " on_mouse_event_closure('button_release')\n", + " );\n", + " rubberband_canvas.addEventListener(\n", + " 'dblclick',\n", + " on_mouse_event_closure('dblclick')\n", + " );\n", + " // Throttle sequential mouse events to 1 every 20ms.\n", + " rubberband_canvas.addEventListener(\n", + " 'mousemove',\n", + " on_mouse_event_closure('motion_notify')\n", + " );\n", + "\n", + " rubberband_canvas.addEventListener(\n", + " 'mouseenter',\n", + " on_mouse_event_closure('figure_enter')\n", + " );\n", + " rubberband_canvas.addEventListener(\n", + " 'mouseleave',\n", + " on_mouse_event_closure('figure_leave')\n", + " );\n", + "\n", + " canvas_div.addEventListener('wheel', function (event) {\n", + " if (event.deltaY < 0) {\n", + " event.step = 1;\n", + " } else {\n", + " event.step = -1;\n", + " }\n", + " on_mouse_event_closure('scroll')(event);\n", + " });\n", + "\n", + " canvas_div.appendChild(canvas);\n", + " canvas_div.appendChild(rubberband_canvas);\n", + "\n", + " this.rubberband_context = rubberband_canvas.getContext('2d');\n", + " this.rubberband_context.strokeStyle = '#000000';\n", + "\n", + " this._resize_canvas = function (width, height, forward) {\n", + " if (forward) {\n", + " canvas_div.style.width = width + 'px';\n", + " canvas_div.style.height = height + 'px';\n", + " }\n", + " };\n", + "\n", + " // Disable right mouse context menu.\n", + " this.rubberband_canvas.addEventListener('contextmenu', function (_e) {\n", + " event.preventDefault();\n", + " return false;\n", + " });\n", + "\n", + " function set_focus() {\n", + " canvas.focus();\n", + " canvas_div.focus();\n", + " }\n", + "\n", + " window.setTimeout(set_focus, 100);\n", + "};\n", + "\n", + "mpl.figure.prototype._init_toolbar = function () {\n", + " var fig = this;\n", + "\n", + " var toolbar = document.createElement('div');\n", + " toolbar.classList = 'mpl-toolbar';\n", + " this.root.appendChild(toolbar);\n", + "\n", + " function on_click_closure(name) {\n", + " return function (_event) {\n", + " return fig.toolbar_button_onclick(name);\n", + " };\n", + " }\n", + "\n", + " function on_mouseover_closure(tooltip) {\n", + " return function (event) {\n", + " if (!event.currentTarget.disabled) {\n", + " return fig.toolbar_button_onmouseover(tooltip);\n", + " }\n", + " };\n", + " }\n", + "\n", + " fig.buttons = {};\n", + " var buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'mpl-button-group';\n", + " for (var toolbar_ind in mpl.toolbar_items) {\n", + " var name = mpl.toolbar_items[toolbar_ind][0];\n", + " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", + " var image = mpl.toolbar_items[toolbar_ind][2];\n", + " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", + "\n", + " if (!name) {\n", + " /* Instead of a spacer, we start a new button group. */\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + " buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'mpl-button-group';\n", + " continue;\n", + " }\n", + "\n", + " var button = (fig.buttons[name] = document.createElement('button'));\n", + " button.classList = 'mpl-widget';\n", + " button.setAttribute('role', 'button');\n", + " button.setAttribute('aria-disabled', 'false');\n", + " button.addEventListener('click', on_click_closure(method_name));\n", + " button.addEventListener('mouseover', on_mouseover_closure(tooltip));\n", + "\n", + " var icon_img = document.createElement('img');\n", + " icon_img.src = '_images/' + image + '.png';\n", + " icon_img.srcset = '_images/' + image + '_large.png 2x';\n", + " icon_img.alt = tooltip;\n", + " button.appendChild(icon_img);\n", + "\n", + " buttonGroup.appendChild(button);\n", + " }\n", + "\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + "\n", + " var fmt_picker = document.createElement('select');\n", + " fmt_picker.classList = 'mpl-widget';\n", + " toolbar.appendChild(fmt_picker);\n", + " this.format_dropdown = fmt_picker;\n", + "\n", + " for (var ind in mpl.extensions) {\n", + " var fmt = mpl.extensions[ind];\n", + " var option = document.createElement('option');\n", + " option.selected = fmt === mpl.default_extension;\n", + " option.innerHTML = fmt;\n", + " fmt_picker.appendChild(option);\n", + " }\n", + "\n", + " var status_bar = document.createElement('span');\n", + " status_bar.classList = 'mpl-message';\n", + " toolbar.appendChild(status_bar);\n", + " this.message = status_bar;\n", + "};\n", + "\n", + "mpl.figure.prototype.request_resize = function (x_pixels, y_pixels) {\n", + " // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n", + " // which will in turn request a refresh of the image.\n", + " this.send_message('resize', { width: x_pixels, height: y_pixels });\n", + "};\n", + "\n", + "mpl.figure.prototype.send_message = function (type, properties) {\n", + " properties['type'] = type;\n", + " properties['figure_id'] = this.id;\n", + " this.ws.send(JSON.stringify(properties));\n", + "};\n", + "\n", + "mpl.figure.prototype.send_draw_message = function () {\n", + " if (!this.waiting) {\n", + " this.waiting = true;\n", + " this.ws.send(JSON.stringify({ type: 'draw', figure_id: this.id }));\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_save = function (fig, _msg) {\n", + " var format_dropdown = fig.format_dropdown;\n", + " var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n", + " fig.ondownload(fig, format);\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_resize = function (fig, msg) {\n", + " var size = msg['size'];\n", + " if (size[0] !== fig.canvas.width || size[1] !== fig.canvas.height) {\n", + " fig._resize_canvas(size[0], size[1], msg['forward']);\n", + " fig.send_message('refresh', {});\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_rubberband = function (fig, msg) {\n", + " var x0 = msg['x0'] / fig.ratio;\n", + " var y0 = (fig.canvas.height - msg['y0']) / fig.ratio;\n", + " var x1 = msg['x1'] / fig.ratio;\n", + " var y1 = (fig.canvas.height - msg['y1']) / fig.ratio;\n", + " x0 = Math.floor(x0) + 0.5;\n", + " y0 = Math.floor(y0) + 0.5;\n", + " x1 = Math.floor(x1) + 0.5;\n", + " y1 = Math.floor(y1) + 0.5;\n", + " var min_x = Math.min(x0, x1);\n", + " var min_y = Math.min(y0, y1);\n", + " var width = Math.abs(x1 - x0);\n", + " var height = Math.abs(y1 - y0);\n", + "\n", + " fig.rubberband_context.clearRect(\n", + " 0,\n", + " 0,\n", + " fig.canvas.width / fig.ratio,\n", + " fig.canvas.height / fig.ratio\n", + " );\n", + "\n", + " fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_figure_label = function (fig, msg) {\n", + " // Updates the figure title.\n", + " fig.header.textContent = msg['label'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_cursor = function (fig, msg) {\n", + " fig.rubberband_canvas.style.cursor = msg['cursor'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_message = function (fig, msg) {\n", + " fig.message.textContent = msg['message'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_draw = function (fig, _msg) {\n", + " // Request the server to send over a new figure.\n", + " fig.send_draw_message();\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_image_mode = function (fig, msg) {\n", + " fig.image_mode = msg['mode'];\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_history_buttons = function (fig, msg) {\n", + " for (var key in msg) {\n", + " if (!(key in fig.buttons)) {\n", + " continue;\n", + " }\n", + " fig.buttons[key].disabled = !msg[key];\n", + " fig.buttons[key].setAttribute('aria-disabled', !msg[key]);\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_navigate_mode = function (fig, msg) {\n", + " if (msg['mode'] === 'PAN') {\n", + " fig.buttons['Pan'].classList.add('active');\n", + " fig.buttons['Zoom'].classList.remove('active');\n", + " } else if (msg['mode'] === 'ZOOM') {\n", + " fig.buttons['Pan'].classList.remove('active');\n", + " fig.buttons['Zoom'].classList.add('active');\n", + " } else {\n", + " fig.buttons['Pan'].classList.remove('active');\n", + " fig.buttons['Zoom'].classList.remove('active');\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.updated_canvas_event = function () {\n", + " // Called whenever the canvas gets updated.\n", + " this.send_message('ack', {});\n", + "};\n", + "\n", + "// A function to construct a web socket function for onmessage handling.\n", + "// Called in the figure constructor.\n", + "mpl.figure.prototype._make_on_message_function = function (fig) {\n", + " return function socket_on_message(evt) {\n", + " if (evt.data instanceof Blob) {\n", + " var img = evt.data;\n", + " if (img.type !== 'image/png') {\n", + " /* FIXME: We get \"Resource interpreted as Image but\n", + " * transferred with MIME type text/plain:\" errors on\n", + " * Chrome. But how to set the MIME type? It doesn't seem\n", + " * to be part of the websocket stream */\n", + " img.type = 'image/png';\n", + " }\n", + "\n", + " /* Free the memory for the previous frames */\n", + " if (fig.imageObj.src) {\n", + " (window.URL || window.webkitURL).revokeObjectURL(\n", + " fig.imageObj.src\n", + " );\n", + " }\n", + "\n", + " fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n", + " img\n", + " );\n", + " fig.updated_canvas_event();\n", + " fig.waiting = false;\n", + " return;\n", + " } else if (\n", + " typeof evt.data === 'string' &&\n", + " evt.data.slice(0, 21) === 'data:image/png;base64'\n", + " ) {\n", + " fig.imageObj.src = evt.data;\n", + " fig.updated_canvas_event();\n", + " fig.waiting = false;\n", + " return;\n", + " }\n", + "\n", + " var msg = JSON.parse(evt.data);\n", + " var msg_type = msg['type'];\n", + "\n", + " // Call the \"handle_{type}\" callback, which takes\n", + " // the figure and JSON message as its only arguments.\n", + " try {\n", + " var callback = fig['handle_' + msg_type];\n", + " } catch (e) {\n", + " console.log(\n", + " \"No handler for the '\" + msg_type + \"' message type: \",\n", + " msg\n", + " );\n", + " return;\n", + " }\n", + "\n", + " if (callback) {\n", + " try {\n", + " // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n", + " callback(fig, msg);\n", + " } catch (e) {\n", + " console.log(\n", + " \"Exception inside the 'handler_\" + msg_type + \"' callback:\",\n", + " e,\n", + " e.stack,\n", + " msg\n", + " );\n", + " }\n", + " }\n", + " };\n", + "};\n", + "\n", + "// from https://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n", + "mpl.findpos = function (e) {\n", + " //this section is from http://www.quirksmode.org/js/events_properties.html\n", + " var targ;\n", + " if (!e) {\n", + " e = window.event;\n", + " }\n", + " if (e.target) {\n", + " targ = e.target;\n", + " } else if (e.srcElement) {\n", + " targ = e.srcElement;\n", + " }\n", + " if (targ.nodeType === 3) {\n", + " // defeat Safari bug\n", + " targ = targ.parentNode;\n", + " }\n", + "\n", + " // pageX,Y are the mouse positions relative to the document\n", + " var boundingRect = targ.getBoundingClientRect();\n", + " var x = e.pageX - (boundingRect.left + document.body.scrollLeft);\n", + " var y = e.pageY - (boundingRect.top + document.body.scrollTop);\n", + "\n", + " return { x: x, y: y };\n", + "};\n", + "\n", + "/*\n", + " * return a copy of an object with only non-object keys\n", + " * we need this to avoid circular references\n", + " * https://stackoverflow.com/a/24161582/3208463\n", + " */\n", + "function simpleKeys(original) {\n", + " return Object.keys(original).reduce(function (obj, key) {\n", + " if (typeof original[key] !== 'object') {\n", + " obj[key] = original[key];\n", + " }\n", + " return obj;\n", + " }, {});\n", + "}\n", + "\n", + "mpl.figure.prototype.mouse_event = function (event, name) {\n", + " var canvas_pos = mpl.findpos(event);\n", + "\n", + " if (name === 'button_press') {\n", + " this.canvas.focus();\n", + " this.canvas_div.focus();\n", + " }\n", + "\n", + " var x = canvas_pos.x * this.ratio;\n", + " var y = canvas_pos.y * this.ratio;\n", + "\n", + " this.send_message(name, {\n", + " x: x,\n", + " y: y,\n", + " button: event.button,\n", + " step: event.step,\n", + " guiEvent: simpleKeys(event),\n", + " });\n", + "\n", + " /* This prevents the web browser from automatically changing to\n", + " * the text insertion cursor when the button is pressed. We want\n", + " * to control all of the cursor setting manually through the\n", + " * 'cursor' event from matplotlib */\n", + " event.preventDefault();\n", + " return false;\n", + "};\n", + "\n", + "mpl.figure.prototype._key_event_extra = function (_event, _name) {\n", + " // Handle any extra behaviour associated with a key event\n", + "};\n", + "\n", + "mpl.figure.prototype.key_event = function (event, name) {\n", + " // Prevent repeat events\n", + " if (name === 'key_press') {\n", + " if (event.key === this._key) {\n", + " return;\n", + " } else {\n", + " this._key = event.key;\n", + " }\n", + " }\n", + " if (name === 'key_release') {\n", + " this._key = null;\n", + " }\n", + "\n", + " var value = '';\n", + " if (event.ctrlKey && event.key !== 'Control') {\n", + " value += 'ctrl+';\n", + " }\n", + " else if (event.altKey && event.key !== 'Alt') {\n", + " value += 'alt+';\n", + " }\n", + " else if (event.shiftKey && event.key !== 'Shift') {\n", + " value += 'shift+';\n", + " }\n", + "\n", + " value += 'k' + event.key;\n", + "\n", + " this._key_event_extra(event, name);\n", + "\n", + " this.send_message(name, { key: value, guiEvent: simpleKeys(event) });\n", + " return false;\n", + "};\n", + "\n", + "mpl.figure.prototype.toolbar_button_onclick = function (name) {\n", + " if (name === 'download') {\n", + " this.handle_save(this, null);\n", + " } else {\n", + " this.send_message('toolbar_button', { name: name });\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.toolbar_button_onmouseover = function (tooltip) {\n", + " this.message.textContent = tooltip;\n", + "};\n", + "\n", + "///////////////// REMAINING CONTENT GENERATED BY embed_js.py /////////////////\n", + "// prettier-ignore\n", + "var _JSXTOOLS_RESIZE_OBSERVER=function(A){var t,i=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakMap,o=new Set;function s(e){if(!(this instanceof s))throw new TypeError(\"Constructor requires 'new' operator\");i.set(this,e)}function h(){throw new TypeError(\"Function is not a constructor\")}function c(e,t,i,n){e=0 in arguments?Number(arguments[0]):0,t=1 in arguments?Number(arguments[1]):0,i=2 in arguments?Number(arguments[2]):0,n=3 in arguments?Number(arguments[3]):0,this.right=(this.x=this.left=e)+(this.width=i),this.bottom=(this.y=this.top=t)+(this.height=n),Object.freeze(this)}function d(){t=requestAnimationFrame(d);var s=new WeakMap,p=new Set;o.forEach((function(t){r.get(t).forEach((function(i){var r=t instanceof window.SVGElement,o=a.get(t),d=r?0:parseFloat(o.paddingTop),f=r?0:parseFloat(o.paddingRight),l=r?0:parseFloat(o.paddingBottom),u=r?0:parseFloat(o.paddingLeft),g=r?0:parseFloat(o.borderTopWidth),m=r?0:parseFloat(o.borderRightWidth),w=r?0:parseFloat(o.borderBottomWidth),b=u+f,F=d+l,v=(r?0:parseFloat(o.borderLeftWidth))+m,W=g+w,y=r?0:t.offsetHeight-W-t.clientHeight,E=r?0:t.offsetWidth-v-t.clientWidth,R=b+v,z=F+W,M=r?t.width:parseFloat(o.width)-R-E,O=r?t.height:parseFloat(o.height)-z-y;if(n.has(t)){var k=n.get(t);if(k[0]===M&&k[1]===O)return}n.set(t,[M,O]);var S=Object.create(h.prototype);S.target=t,S.contentRect=new c(u,d,M,O),s.has(i)||(s.set(i,[]),p.add(i)),s.get(i).push(S)}))})),p.forEach((function(e){i.get(e).call(e,s.get(e),e)}))}return s.prototype.observe=function(i){if(i instanceof window.Element){r.has(i)||(r.set(i,new Set),o.add(i),a.set(i,window.getComputedStyle(i)));var n=r.get(i);n.has(this)||n.add(this),cancelAnimationFrame(t),t=requestAnimationFrame(d)}},s.prototype.unobserve=function(i){if(i instanceof window.Element&&r.has(i)){var n=r.get(i);n.has(this)&&(n.delete(this),n.size||(r.delete(i),o.delete(i))),n.size||r.delete(i),o.size||cancelAnimationFrame(t)}},A.DOMRectReadOnly=c,A.ResizeObserver=s,A.ResizeObserverEntry=h,A}; // eslint-disable-line\n", + "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Left button pans, Right button zooms\\nx/y fixes axis, CTRL fixes aspect\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\\nx/y fixes axis\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n", + "\n", + "mpl.extensions = [\"eps\", \"jpeg\", \"pgf\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n", + "\n", + "mpl.default_extension = \"png\";/* global mpl */\n", + "\n", + "var comm_websocket_adapter = function (comm) {\n", + " // Create a \"websocket\"-like object which calls the given IPython comm\n", + " // object with the appropriate methods. Currently this is a non binary\n", + " // socket, so there is still some room for performance tuning.\n", + " var ws = {};\n", + "\n", + " ws.binaryType = comm.kernel.ws.binaryType;\n", + " ws.readyState = comm.kernel.ws.readyState;\n", + " function updateReadyState(_event) {\n", + " if (comm.kernel.ws) {\n", + " ws.readyState = comm.kernel.ws.readyState;\n", + " } else {\n", + " ws.readyState = 3; // Closed state.\n", + " }\n", + " }\n", + " comm.kernel.ws.addEventListener('open', updateReadyState);\n", + " comm.kernel.ws.addEventListener('close', updateReadyState);\n", + " comm.kernel.ws.addEventListener('error', updateReadyState);\n", + "\n", + " ws.close = function () {\n", + " comm.close();\n", + " };\n", + " ws.send = function (m) {\n", + " //console.log('sending', m);\n", + " comm.send(m);\n", + " };\n", + " // Register the callback with on_msg.\n", + " comm.on_msg(function (msg) {\n", + " //console.log('receiving', msg['content']['data'], msg);\n", + " var data = msg['content']['data'];\n", + " if (data['blob'] !== undefined) {\n", + " data = {\n", + " data: new Blob(msg['buffers'], { type: data['blob'] }),\n", + " };\n", + " }\n", + " // Pass the mpl event to the overridden (by mpl) onmessage function.\n", + " ws.onmessage(data);\n", + " });\n", + " return ws;\n", + "};\n", + "\n", + "mpl.mpl_figure_comm = function (comm, msg) {\n", + " // This is the function which gets called when the mpl process\n", + " // starts-up an IPython Comm through the \"matplotlib\" channel.\n", + "\n", + " var id = msg.content.data.id;\n", + " // Get hold of the div created by the display call when the Comm\n", + " // socket was opened in Python.\n", + " var element = document.getElementById(id);\n", + " var ws_proxy = comm_websocket_adapter(comm);\n", + "\n", + " function ondownload(figure, _format) {\n", + " window.open(figure.canvas.toDataURL());\n", + " }\n", + "\n", + " var fig = new mpl.figure(id, ws_proxy, ondownload, element);\n", + "\n", + " // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n", + " // web socket which is closed, not our websocket->open comm proxy.\n", + " ws_proxy.onopen();\n", + "\n", + " fig.parent_element = element;\n", + " fig.cell_info = mpl.find_output_cell(\"
\");\n", + " if (!fig.cell_info) {\n", + " console.error('Failed to find cell for figure', id, fig);\n", + " return;\n", + " }\n", + " fig.cell_info[0].output_area.element.on(\n", + " 'cleared',\n", + " { fig: fig },\n", + " fig._remove_fig_handler\n", + " );\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_close = function (fig, msg) {\n", + " var width = fig.canvas.width / fig.ratio;\n", + " fig.cell_info[0].output_area.element.off(\n", + " 'cleared',\n", + " fig._remove_fig_handler\n", + " );\n", + " fig.resizeObserverInstance.unobserve(fig.canvas_div);\n", + "\n", + " // Update the output cell to use the data from the current canvas.\n", + " fig.push_to_output();\n", + " var dataURL = fig.canvas.toDataURL();\n", + " // Re-enable the keyboard manager in IPython - without this line, in FF,\n", + " // the notebook keyboard shortcuts fail.\n", + " IPython.keyboard_manager.enable();\n", + " fig.parent_element.innerHTML =\n", + " '';\n", + " fig.close_ws(fig, msg);\n", + "};\n", + "\n", + "mpl.figure.prototype.close_ws = function (fig, msg) {\n", + " fig.send_message('closing', msg);\n", + " // fig.ws.close()\n", + "};\n", + "\n", + "mpl.figure.prototype.push_to_output = function (_remove_interactive) {\n", + " // Turn the data on the canvas into data in the output cell.\n", + " var width = this.canvas.width / this.ratio;\n", + " var dataURL = this.canvas.toDataURL();\n", + " this.cell_info[1]['text/html'] =\n", + " '';\n", + "};\n", + "\n", + "mpl.figure.prototype.updated_canvas_event = function () {\n", + " // Tell IPython that the notebook contents must change.\n", + " IPython.notebook.set_dirty(true);\n", + " this.send_message('ack', {});\n", + " var fig = this;\n", + " // Wait a second, then push the new image to the DOM so\n", + " // that it is saved nicely (might be nice to debounce this).\n", + " setTimeout(function () {\n", + " fig.push_to_output();\n", + " }, 1000);\n", + "};\n", + "\n", + "mpl.figure.prototype._init_toolbar = function () {\n", + " var fig = this;\n", + "\n", + " var toolbar = document.createElement('div');\n", + " toolbar.classList = 'btn-toolbar';\n", + " this.root.appendChild(toolbar);\n", + "\n", + " function on_click_closure(name) {\n", + " return function (_event) {\n", + " return fig.toolbar_button_onclick(name);\n", + " };\n", + " }\n", + "\n", + " function on_mouseover_closure(tooltip) {\n", + " return function (event) {\n", + " if (!event.currentTarget.disabled) {\n", + " return fig.toolbar_button_onmouseover(tooltip);\n", + " }\n", + " };\n", + " }\n", + "\n", + " fig.buttons = {};\n", + " var buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'btn-group';\n", + " var button;\n", + " for (var toolbar_ind in mpl.toolbar_items) {\n", + " var name = mpl.toolbar_items[toolbar_ind][0];\n", + " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", + " var image = mpl.toolbar_items[toolbar_ind][2];\n", + " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", + "\n", + " if (!name) {\n", + " /* Instead of a spacer, we start a new button group. */\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + " buttonGroup = document.createElement('div');\n", + " buttonGroup.classList = 'btn-group';\n", + " continue;\n", + " }\n", + "\n", + " button = fig.buttons[name] = document.createElement('button');\n", + " button.classList = 'btn btn-default';\n", + " button.href = '#';\n", + " button.title = name;\n", + " button.innerHTML = '';\n", + " button.addEventListener('click', on_click_closure(method_name));\n", + " button.addEventListener('mouseover', on_mouseover_closure(tooltip));\n", + " buttonGroup.appendChild(button);\n", + " }\n", + "\n", + " if (buttonGroup.hasChildNodes()) {\n", + " toolbar.appendChild(buttonGroup);\n", + " }\n", + "\n", + " // Add the status bar.\n", + " var status_bar = document.createElement('span');\n", + " status_bar.classList = 'mpl-message pull-right';\n", + " toolbar.appendChild(status_bar);\n", + " this.message = status_bar;\n", + "\n", + " // Add the close button to the window.\n", + " var buttongrp = document.createElement('div');\n", + " buttongrp.classList = 'btn-group inline pull-right';\n", + " button = document.createElement('button');\n", + " button.classList = 'btn btn-mini btn-primary';\n", + " button.href = '#';\n", + " button.title = 'Stop Interaction';\n", + " button.innerHTML = '';\n", + " button.addEventListener('click', function (_evt) {\n", + " fig.handle_close(fig, {});\n", + " });\n", + " button.addEventListener(\n", + " 'mouseover',\n", + " on_mouseover_closure('Stop Interaction')\n", + " );\n", + " buttongrp.appendChild(button);\n", + " var titlebar = this.root.querySelector('.ui-dialog-titlebar');\n", + " titlebar.insertBefore(buttongrp, titlebar.firstChild);\n", + "};\n", + "\n", + "mpl.figure.prototype._remove_fig_handler = function (event) {\n", + " var fig = event.data.fig;\n", + " if (event.target !== this) {\n", + " // Ignore bubbled events from children.\n", + " return;\n", + " }\n", + " fig.close_ws(fig, {});\n", + "};\n", + "\n", + "mpl.figure.prototype._root_extra_style = function (el) {\n", + " el.style.boxSizing = 'content-box'; // override notebook setting of border-box.\n", + "};\n", + "\n", + "mpl.figure.prototype._canvas_extra_style = function (el) {\n", + " // this is important to make the div 'focusable\n", + " el.setAttribute('tabindex', 0);\n", + " // reach out to IPython and tell the keyboard manager to turn it's self\n", + " // off when our div gets focus\n", + "\n", + " // location in version 3\n", + " if (IPython.notebook.keyboard_manager) {\n", + " IPython.notebook.keyboard_manager.register_events(el);\n", + " } else {\n", + " // location in version 2\n", + " IPython.keyboard_manager.register_events(el);\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype._key_event_extra = function (event, _name) {\n", + " // Check for shift+enter\n", + " if (event.shiftKey && event.which === 13) {\n", + " this.canvas_div.blur();\n", + " // select the cell after this one\n", + " var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n", + " IPython.notebook.select(index + 1);\n", + " }\n", + "};\n", + "\n", + "mpl.figure.prototype.handle_save = function (fig, _msg) {\n", + " fig.ondownload(fig, null);\n", + "};\n", + "\n", + "mpl.find_output_cell = function (html_output) {\n", + " // Return the cell and output element which can be found *uniquely* in the notebook.\n", + " // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n", + " // IPython event is triggered only after the cells have been serialised, which for\n", + " // our purposes (turning an active figure into a static one), is too late.\n", + " var cells = IPython.notebook.get_cells();\n", + " var ncells = cells.length;\n", + " for (var i = 0; i < ncells; i++) {\n", + " var cell = cells[i];\n", + " if (cell.cell_type === 'code') {\n", + " for (var j = 0; j < cell.output_area.outputs.length; j++) {\n", + " var data = cell.output_area.outputs[j];\n", + " if (data.data) {\n", + " // IPython >= 3 moved mimebundle to data attribute of output\n", + " data = data.data;\n", + " }\n", + " if (data['text/html'] === html_output) {\n", + " return [cell, data, j];\n", + " }\n", + " }\n", + " }\n", + " }\n", + "};\n", + "\n", + "// Register the function which deals with the matplotlib target/channel.\n", + "// The kernel may be null if the page has been refreshed.\n", + "if (IPython.notebook.kernel !== null) {\n", + " IPython.notebook.kernel.comm_manager.register_target(\n", + " 'matplotlib',\n", + " mpl.mpl_figure_comm\n", + " );\n", + "}\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "done! reward: {'agent_0': 1.4849913702741633, 'agent_1': 0}\n", + "starting episode: 2\n", + "done! reward: {'agent_0': 1, 'agent_1': 0}\n", + "starting episode: 3\n", + "done! reward: {'agent_0': 1, 'agent_1': 0.8261686238355868}\n", + "starting episode: 4\n", + "done! reward: {'agent_0': 1.4430479816261728, 'agent_1': 1}\n", + "starting episode: 5\n", + "done! reward: {'agent_0': 1, 'agent_1': 0}\n", + "starting episode: 6\n", + "done! reward: {'agent_0': 2.3998609130491433, 'agent_1': 0.8179069375972309}\n", + "starting episode: 7\n" + ] + }, + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "%matplotlib notebook\n", + "fig, ax = env.render(); # does not return a figure until something happens\n", + "anim = FuncAnimation(fig, animate_update, range(1000), blit=False)\n", + "anim.save('TaskEnv_teaching_example_files/shortcut_env_spatial.mp4', writer='ffmpeg', fps=180)\n", + "Video(\"TaskEnv_teaching_example_files/shortcut_env_spatial.mp4\")" + ] + }, + { + "cell_type": "markdown", + "id": "052d4fed-659d-4646-a7e0-abcfd94a9127", + "metadata": {}, + "source": [ + "![My Animation](TaskEnv_teaching_example_files/animation.mp4)" + ] + }, + { + "cell_type": "markdown", + "id": "c90ab1d9-5b95-47db-8154-78f496cdfaf9", + "metadata": { + "tags": [] + }, + "source": [ + "# Custom goals\n", + "\n", + "Let's imagine we wanted to create a goal for a virtual rat: to remain still for 2 seconds (some experimental insight: not an easy ask for real rats). We can encode that goal as follows ...." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "fa34fe8d-aff8-447c-b6f3-1afa3f4953b7", + "metadata": {}, + "outputs": [], + "source": [ + "class Stillness(Goal):\n", + " \"\"\"\n", + " Default `Goal` object that this inherits from takes \n", + " an environment (which may have agents) and\n", + " a reward they can give to agents \n", + " \"\"\"\n", + " def __init__(self, *pos, how_long=2, velocity_thresh=0.5, **kws):\n", + " super().__init__(*pos, **kws)\n", + " self.how_long = how_long # How long should 🐀 be still?\n", + " self.velocity_thresh = velocity_thresh # What is stillness? How slow?\n", + " self.lastmove = {agent:0 for agent in self.env.Ags} # Store the last movement times\n", + " \n", + " def check(self, agents):\n", + " \"\"\"\n", + " Now our check method runs over each 🐀 in our environment, checking\n", + " if its speed is below the threshold for stillness, and emits a reward\n", + " if its been still for more than 2 seconds\n", + " \"\"\"\n", + " successful_agents = []\n", + " for name, agent in selg.env.Ags.items():\n", + " if agent.velocity > self.velocity_thresh:\n", + " self.last_move[name] = agent.t\n", + " if agent.t - self.last_move[name] > self.how_long:\n", + " successful_agents.append(name)\n", + " return {name:reward for name in successful_agents}" + ] + }, + { + "cell_type": "markdown", + "id": "4b455297-0101-4f6a-919b-8b52c20a4811", + "metadata": {}, + "source": [ + "# CREATING *NEW* TASKS with new goals 🛠️ 🎨" + ] + }, + { + "cell_type": "markdown", + "id": "fd9f1ce2-942a-436a-a76f-2704693118e1", + "metadata": {}, + "source": [ + "(Coming soon ...)" + ] + }, + { + "cell_type": "markdown", + "id": "6f3b6391-4ee2-4b1b-8c81-d1fe5f640f70", + "metadata": {}, + "source": [ + "More about understanding the structure of TaskEnvironments you can find in [./TaskEnvironment_basics.md](./TaskEnvironment_basics.md)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example.md b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example.md new file mode 100644 index 00000000..3e737998 --- /dev/null +++ b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example.md @@ -0,0 +1,361 @@ +# TaskEnvironment.py Tutorial +(For more info, see `TaskEnvironment_basics.md`) + + +```python +# Setup and parameters +import numpy as np +import matplotlib.pyplot as plt +from ratinabox.contribs.TaskEnvironment import (SpatialGoalEnvironment, TaskEnvironment, + SpatialGoal, Reward, Goal, get_goal_vector) +from ratinabox.Agent import Agent +from IPython import display +from matplotlib.animation import FuncAnimation +from IPython.display import HTML, Video +import sys +print(sys.executable) + + +%matplotlib inline +speed = 12 # dials how fast agent runs +pausetime = 0.000001 # pause time in plot +plt.close('all') + +``` + + /Users/ryoung/opt/anaconda3/envs/ratinabox11/bin/python + + +# Setting up reward 💰 functions + +Configure the reward given for reaching a goal. Some options include setting decay function, decay parameters or an external driving function, e.g. a gradient. Rewards once they're given to an agent remain active until they expire (this is optional). + + + +```python +fig, axs = plt.subplots(2,1, figsize=(5,3)) +plt.sca(axs[0]) +r_exp=Reward(1, expire_clock=0.5, decay="linear", decay_knobs=[6]) +r_exp.plot_theoretical_reward() +plt.sca(axs[1]) +r_exp2=Reward(1, expire_clock=0.9, decay="linear", decay_knobs=[3]) +r_exp2.plot_theoretical_reward() +plt.suptitle('Linear decay reward functions') +``` + + + + + Text(0.5, 0.98, 'Linear decay reward functions') + + + + + +![png](TaskEnv_teaching_example_files/TaskEnv_teaching_example_3_1.png) + + + + +```python +fig, axs = plt.subplots(1,1, figsize=(5,1.5)) +plt.sca(axs) +r_con=Reward(1, expire_clock=1/3, decay="constant", decay_knobs=[3]) +r_con.plot_theoretical_reward((0,0.4)) +plt.axhline([0], c="black", linestyle="dashed") +plt.suptitle('Constant decay reward function') +``` + + + + + Text(0.5, 0.98, 'Constant decay reward function') + + + + + +![png](TaskEnv_teaching_example_files/TaskEnv_teaching_example_4_1.png) + + + +### 🎯 `Goal` objects are used to 🔍 _detect a condition_ and 💰 _release these `Reward` objects above 👆 + +`Rewards` come from special objects that merely check for a rule or objective being satisfied: `Goal`s. For example, an agent enters a special region of a maze and receives a reward, a `SpatialGoal`. Later, we will create those and place them into our `TaskEnvironment`. + +# ⚙️ Configuring `TaskEnvironment` with 🐀 `Agent` objects + +Let's take the example task environment, `SpatialGoalTaskEnvironment`; it's configured it to work with `SpatialGoal` objects, although you could pass `SpatialGoal` objects to a vanilla `TaskEnvironment`. + +There are two approaches to setting up goals for a task. +- 🍎 One approach, you make a pool of goal objects yourself and give them to the environment. This is the least opaque. +- 🚀 The other, you allow `SpatialGoalTaskEnvironment` to construct your goals using keyword arguments the `goalkws` passed to `SpatialTaskEnvironment`. This let's it manage creating them for you. New TaskEnvironments have to have the internal machinery (which is fairly lightweight) to automate this. + +#### 🍎 Easy example: Manually crafting goals and integrating them into a versatile TaskEnvironment + +First, we're going to dive into the most adaptable scenario. We'll be forging our own 🎯 Goal objects, each with a 💰 Reward, and then delivering those goals to a TaskEnvironment or SpatialTaskEnvironment. To start, let's erect a type of TaskEnvironment object. + + +```python +env = SpatialGoalEnvironment(params={'dimensionality':'2D'}, + render_every=1, # how often to draw on .render() + teleport_on_reset=False, # teleport animal to new location each episode? + verbose=False) +``` + + /Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:694: UserWarning: Cannot collect the default_params dictionaries, as SpatialGoalEnvironment does not have the class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().) + warnings.warn( + /Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:749: UserWarning: Cannot check the keys in the params dictionary, as does not have a class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().) + warnings.warn( + + +Now, let's bring some goals to life for our environment. We intialize goals by attaching them to an environment. In the case of the spatial goals below, they have some default reward (unless you attach your own through `reward=reward`) and take on a random position (unless you provide it through `pos=pos`). + +Here, we generates two spatial goals at random coordinates within the environment 🎲, and one goal that has a precise position (x=0.2, y=0.2) and a reward object `r_con` that's granted upon completion 🎯. The remaining goals will be equipped with the default reward object. + + + +```python +goals = [SpatialGoal(env), SpatialGoal(env), + SpatialGoal(env, pos=[0.2, 0.2], reward=r_con)] +``` + +We're now ready to attach these goals to our task and recruit some agents 🐀. + +The render function will illustrate your environment, agents, and anything else that the task environment is programmed to depict. In the case of `SpatialGoalEnvironment`, it's been fine-tuned to showcase spatial goal objects 🎯. + + +```python +Ag = Agent(env) +env.goal_cache.reset_goals = goals # you can also pass these into goalcachekws of an environment +env.add_agents(Ag) +print("Here are the active agents who have yet to solve the episode goals:", env.agents) +print(f"env.reset() will reset goals from pool of n={len(env.goal_cache.reset_goals)} possible goals") +``` + + Here are the active agents who have yet to solve the episode goals: ['agent_0'] + env.reset() will reset goals from pool of n=3 possible goals + + +### `.step()` the environment +we now can make our agents take a step in environment given its state, and the step() will return a set of dictionaries patterned {agent_name:value}. It returns observations the agents make (their states), the rewards per agent, and whether each agent hits a stopping point (if all goals are satisfied this episode for). (See `pettingzoo.env` documentation for more info about the return objects.) + + +```python +observation, reward, terminate_epi, _ , info = env.step() # Take a single action randomly +print("Observation: ", observation, + "Reward: ", reward, + "Terminate episode: ", terminate_epi) +``` + + Observation: {'agent_0': array([0.22710697, 0.57119362])} Reward: {'agent_0': 0} Terminate episode: {'agent_0': False} + + +Since we have only _1 agent_, there is a shortcut function `.step1()`. With this call, an environment can behave more like single-agent `Gymnasium` instead of `pettingzoo`, only returning the observation, reward, and halting information for our one agent. Less cumbersome for one agent simulations. + + +```python +observation, reward, terminate_epi, _ , info = env.step1() # Take a single action randomly +print("Observation: ", observation, + "Reward: ", reward, + "Terminate episode: ", terminate_epi) +``` + + Observation: [0.22628509 0.5709708 ] Reward: 0 Terminate episode: False + + +### Animating an episode +Generally, we call step() repeatedly in a while-loop to carry out an epsiode. + +Here, we plan to create a matplotlib animation; so let's instead create a function that draws a single step()! This function "plans" an action, takes the action via .step(), and then `render()` or draws the agents, environment, and goals. + + +```python +def animate_update(*pos, **kws): + dir_to_reward = {name:get_goal_vector(Ag) + for name, Ag in env.Ags.items()} + actions = {agent : speed * Ag.speed_mean * + (dir_to_reward / np.linalg.norm(dir_to_reward)) + for (agent, dir_to_reward) in dir_to_reward.items()} + + observation, reward, terminate_episode, _, info = \ + env.step(actions) + + fig, ax = env.render() + if any(terminate_episode.values()): + print("done! reward:", reward) + env.reset() + print("starting episode:", env.episode) + + return fig +``` + +(If we were not using `FuncAnimation` and jupyter here, you could just blurt this function code into a while loop, and we would see a quick live-rendered plot.) + + +```python +%matplotlib notebook +fig, ax = env.render(); # get the figure and axis +anim = FuncAnimation(fig, animate_update, range(1000), blit=False) # animate 1000 of of the environment-action loop +anim.save('TaskEnv_teaching_example_files/env_primary_interface.mp4', + writer='ffmpeg', fps=180) +Video("TaskEnv_teaching_example_files/env_primary_interface.mp4") +``` + + + + + + +
+ + + WARNING: This figure has not been saved. + • To AUTOMATICALLY save all plots (recommended), set `ratinabox.autosave_plots = True` + • To MANUALLY save plots, call `ratinabox.utils.save_figure(figure_object, save_title). + This warning will not be shown again + HINT: You can stylize plots to make them look like repo/paper by calling `ratinabox.stylize_plots()` + This hint will not be shown again + done! reward: {'agent_0': 1} + starting episode: 2 + done! reward: {'agent_0': 1} + starting episode: 3 + done! reward: {'agent_0': 1.99} + starting episode: 4 + done! reward: {'agent_0': 2.9701} + starting episode: 5 + done! reward: {'agent_0': 3.940399} + starting episode: 6 + done! reward: {'agent_0': 1} + starting episode: 7 + done! reward: {'agent_0': 1} + starting episode: 8 + done! reward: {'agent_0': 1.7936142836436555} + starting episode: 9 + done! reward: {'agent_0': 1} + starting episode: 10 + + + + + + + + + +![My Animation](TaskEnv_teaching_example_files/animation.mp4) + +### 🚀 Shortcut to crafting SpatialGoals through a SpatialGoalEnvironment + +The derived class, SpatialGoalEnvironment, comes with its own set of convenience functions. These allow you to simply specify the number of goals and provide the construction arguments goalkws. You can also fine-tune features of the goalcache, as we discussed earlier, such as designating whether the goals are sequential or not, or if they're shared among agents 🤖. + + +```python +goalkws = dict(reward=r_exp) # Goal.__init__ kws called within Task, we could also just provide `Goal` objects +goalcachekws = dict(reset_n_goals=2, + agentmode="noninteract", + goalorder="nonsequential") # GoalCache.__init__ kws, these are covered elsewhere + # and can also be used for the 🍎 section + # ie for manually set goal collections + +env = SpatialGoalEnvironment( + teleport_on_reset=False, # + goalkws=goalkws, # Reward will be attached to the `Goal` object + goalcachekws=goalcachekws, # Goals will be tracked by the cache +) + +# Add our agents to the environment} +Ag = Agent(env) +Ag2 = Agent(env) +env.add_agents(Ag) +env.add_agents(Ag2) +print("Agent names: ",env.agent_names) +``` + + Agent names: ['agent_0', 'agent_1'] + + + /Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:694: UserWarning: Cannot collect the default_params dictionaries, as SpatialGoalEnvironment does not have the class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().) + warnings.warn( + /Users/ryoung/opt/anaconda3/envs/ratinabox11/lib/python3.11/site-packages/ratinabox/utils.py:749: UserWarning: Cannot check the keys in the params dictionary, as does not have a class attribute 'default_params' defined in its preamble. (Can be just an empty dictionary, i.e.: default_params = dict().) + warnings.warn( + + +And now let's run the environment :) + + +```python +%matplotlib notebook +fig, ax = env.render(); # does not return a figure until something happens +anim = FuncAnimation(fig, animate_update, range(1000), blit=False) +anim.save('TaskEnv_teaching_example_files/shortcut_env_spatial.mp4', writer='ffmpeg', fps=180) +Video("TaskEnv_teaching_example_files/shortcut_env_spatial.mp4") +``` + + + + + + +
+ + + done! reward: {'agent_0': 1, 'agent_1': 0.9509900499} + starting episode: 2 + done! reward: {'agent_0': 1, 'agent_1': 0.6050060671375367} + starting episode: 3 + done! reward: {'agent_0': 1, 'agent_1': 0.8261686238355868} + starting episode: 4 + + + + + + + + + +![My Animation](TaskEnv_teaching_example_files/animation.mp4) + +# Custom goals + +Let's imagine we wanted to create a goal for a virtual rat: to remain still for 2 seconds (some experimental insight: not an easy ask for real rats). We can encode that goal as follows .... + + +```python +class Stillness(Goal): + """ + Default `Goal` object that this inherits from takes + an environment (which may have agents) and + a reward they can give to agents + """ + def __init__(self, *pos, how_long=2, velocity_thresh=0.5, **kws): + super().__init__(*pos, **kws) + self.how_long = how_long # How long should 🐀 be still? + self.velocity_thresh = velocity_thresh # What is stillness? How slow? + self.lastmove = {agent:0 for agent in self.env.Ags} # Store the last movement times + + def check(self, agents): + """ + Now our check method runs over each 🐀 in our environment, checking + if its speed is below the threshold for stillness, and emits a reward + if its been still for more than 2 seconds + """ + successful_agents = [] + for name, agent in selg.env.Ags.items(): + if agent.velocity > self.velocity_thresh: + self.last_move[name] = agent.t + if agent.t - self.last_move[name] > self.how_long: + successful_agents.append(name) + return {name:reward for name in successful_agents} +``` + +# CREATING *NEW* TASKS with new goals 🛠️ 🎨 + +(Coming soon ...) + +More about understanding the structure of TaskEnvironments you can find in [./TaskEnvironment_basics.md](./TaskEnvironment_basics.md) diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TE_Goals+Rewards.png b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TE_Goals+Rewards.png new file mode 100644 index 00000000..973324f7 Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TE_Goals+Rewards.png differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TE_TaskEnvironment.png b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TE_TaskEnvironment.png new file mode 100644 index 00000000..dea08843 Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TE_TaskEnvironment.png differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_11_2.png b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_11_2.png new file mode 100644 index 00000000..c62badaf Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_11_2.png differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_18_2.png b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_18_2.png new file mode 100644 index 00000000..32bec254 Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_18_2.png differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_2_1.png b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_2_1.png new file mode 100644 index 00000000..a62c7501 Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_2_1.png differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_3_1.png b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_3_1.png new file mode 100644 index 00000000..b1f1cbda Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/TaskEnv_teaching_example_3_1.png differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/env_primary_interface.mp4 b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/env_primary_interface.mp4 new file mode 100644 index 00000000..a5e03199 Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/env_primary_interface.mp4 differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/shortcut_env_spatial.mp4 b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/shortcut_env_spatial.mp4 new file mode 100644 index 00000000..fe2125d4 Binary files /dev/null and b/ratinabox/contribs/TaskEnv_example_files/TaskEnv_teaching_example_files/shortcut_env_spatial.mp4 differ diff --git a/ratinabox/contribs/TaskEnv_example_files/TaskEnvironment_basics.md b/ratinabox/contribs/TaskEnv_example_files/TaskEnvironment_basics.md new file mode 100644 index 00000000..e551420d --- /dev/null +++ b/ratinabox/contribs/TaskEnv_example_files/TaskEnvironment_basics.md @@ -0,0 +1,95 @@ +# TaskEnvironment + +`TaskEnvironment` is designed to simplify creating and managing environments that contain tasks! This blends the flexble `ratinabox.Environment` with a popular multi-agent reinforcement learning `pettingzoo.env` environment. Included are some tools to manage `Goal`s and `Reward`s, but they are optional. You could write/inherit a `TaskEnvironment` like a purely `pettingzoo` enabled RIB `Environment`. + +Let's exame some things `TaskEnvironment.py` offers. These are some basic descriptions of customizable structures to handle an environment with various types of goals and rewards. + +The main classes in TaskEnvironment.py are: + +* `Goal`: This abstract class represents a goal that agents need to achieve. For new tasks, users may need to implement their own specialized goal classes derived from Goal by defining specific methods to determine goal satisfaction and any other specific behaviors. + +* `Reward`: This class represents a reward that agents can earn by satisfying goals. Rewards can have dynamics that evolve over time (e.g. decay rates or may be driven by an external ramping signal). + +* `RewardCache`: This class acts as a cache for all active rewards attached to an agent. It keeps track of the rewards and provides methods to update and retrieve the total value of active rewards. + +* `GoalCache`: This class manages all active goals across all agents. It is responsible for tracking goal completion and coordinating agent interactions with the goals. + +* `TaskEnvironment`: This serves as the base class for task environments. It defines the core structure, methods, and functionalities for managing agents, rewards, and goals. + + +## Overview + +The following figures offer a birds-eye summary of how the above classes interact to carry out your task of interest. We're mainly showing the most important objects and methods. See the class docfiles for more info. + +![TaskEnvironment](./TaskEnv_teaching_example_files/TE_TaskEnvironment.png) + +Task Environment contains an `Agents` dictionary `agent_name -> agent`, names indexing the agents. You can add agents with `add_agents()` method. `step(actions)` moves the agents through your environment, sending `actions` to each agent, and the environment can change with agent actions, emitting rewards if a goal is reached. + +To track goals, we optionally have a `GoalCache` object that stores the set of goals (or goal sequences) for the agents. + +The `RewardCache` holds the active rewards for each agent. When a `Goal` is satisfied by one of the agents, say an animal reaches a special location, it releases a goal to that animal's cache. These are objects that can release reward over time to the agent after triggering the event. + +`Goals` inside the `GoalCache` encode the rules --- what conditions should your agent get a reward. `Reward` objects in the `RewardCache` encode the dynamics of your reward. + + +

+

+Goals + Rewards + + + +### :angel: 👉 `Goal`/`GoalCache` and `Reward`/`RewardCache` are ❗️OPTIONAL ❗️ +The goal and reward interfaces are optional helpers to keep organize goals and sequence them, and rewards interfaces help track non-sparse rewards. You can skip/leap-frog these! + +Feel free to simply inherit the `TaskEnvironment` if you merely want a `gynasium`/`pettingzoo` RIB `Environment` without the helpful but extra fluff. You can manually encode your rules and reward logic pythonically into the `.step()` function. See the function and its attached doc file to understand what you should output. + +## Creating your own task, examples + +### `Reward`/`Goal` interfaces +(coming soon...) +### Without `Reward`/`Goal` interfaces, like a raw RIB environment + pettingzoo +(coming soon...) + +