{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "be3342e1",
   "metadata": {},
   "source": [
    "(ch:intro)=\n",
    "# Scratchpad\n",
    "\n",
    "\n",
    "In this chapter, we do blah.\n",
    "Specifically\n",
    "\n",
    "- foo\n",
    "- bar.\n",
    "- baz\n",
    "\n",
    "For more details, see \n",
    "{ref}`ch:hmm` and  {cite}`Sarkka13`.\n",
    "\n",
    "\n",
    "## Python\n",
    "\n",
    "We\\'re now ready to start coding."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a1ee3323",
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib import rcParams, cycler\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "plt.ion()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0de511fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 151472 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "filenames": {
       "image/png": "/Users/kpmurphy/github/ssm-book/_build/jupyter_execute/chapters/scratch_2_0.png"
      },
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Fixing random state for reproducibility\n",
    "np.random.seed(19680801)\n",
    "\n",
    "N = 10\n",
    "data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)]\n",
    "data = np.array(data).T\n",
    "cmap = plt.cm.coolwarm\n",
    "rcParams['axes.prop_cycle'] = cycler(color=cmap(np.linspace(0, 1, N)))\n",
    "\n",
    "\n",
    "from matplotlib.lines import Line2D\n",
    "custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4),\n",
    "                Line2D([0], [0], color=cmap(.5), lw=4),\n",
    "                Line2D([0], [0], color=cmap(1.), lw=4)]\n",
    "\n",
    "fig, ax = plt.subplots(figsize=(10, 5))\n",
    "lines = ax.plot(data)\n",
    "ax.legend(custom_lines, ['Cold', 'Medium', 'Hot']);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "aa053ad3",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CpuDevice(id=0)]\n"
     ]
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import jax\n",
    "import jax.numpy as jnp\n",
    "\n",
    "print(jax.devices())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "55d95c95",
   "metadata": {},
   "source": [
    "## Images\n",
    "\n",
    "\n",
    "<!---\n",
    "![](https://myst-parser.readthedocs.io/en/latest/_static/logo-wide.svg)\n",
    "\n",
    "\n",
    "<img src=\"https://github.com/probml/probml-notebooks/blob/main/images/cat_dog.jpg\"\n",
    "style=\"height:200\">\n",
    "-->\n",
    "\n",
    "```{figure} /figures/cat_dog.jpg\n",
    ":scale: 50%\n",
    ":name: cat_dog\n",
    "\n",
    "A photo of a cat and a dog.\n",
    "```\n",
    "\n",
    "```{figure} /figures/cat_dog.jpg\n",
    ":scale: 50%\n",
    ":name: cat_dog2\n",
    "\n",
    "Another photo of a cat and a dog.\n",
    "```\n",
    "\n",
    "In {numref}`Figure %s <cat_dog>` we show catdog.\n",
    "In {numref}`Figure %s <cat_dog2>` we show catdog2, its twin.\n",
    "\n",
    "\n",
    "## Math\n",
    "\n",
    "We have $E= mc^2$, and also\n",
    "\n",
    "```{math}\n",
    ":label: foo\n",
    "a x^2 + bx+ c = 0\n",
    "```\n",
    "\n",
    "From {eq}`foo`, it follows that\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "0 &= a x^2 + bx+ c \\\\\n",
    "0 &= a x^2 + bx+ c \n",
    "\\end{align}\n",
    "$$"
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "formats": "md:myst",
   "text_representation": {
    "extension": ".md",
    "format_name": "myst"
   }
  },
  "kernelspec": {
   "display_name": "Python 3",
   "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.8.5"
  },
  "source_map": [
   12,
   33,
   40,
   61,
   68
  ]
 },
 "nbformat": 4,
 "nbformat_minor": 5
}