{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Playing with the PyGSP\n", "" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from pygsp import graphs, filters\n", "\n", "plt.rcParams['figure.figsize'] = (17, 5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1 Example\n", "\n", "The following demonstrates how to instantiate a graph and a filter, the two main objects of the package." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "G = graphs.Logo()\n", "G.estimate_lmax()\n", "g = filters.Heat(G, tau=100)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's now create a graph signal: a set of three Kronecker deltas for that example. We can now look at one step of heat diffusion by filtering the deltas with the above defined filter. Note how the diffusion follows the local structure!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "DELTAS = [20, 30, 1090]\n", "s = np.zeros(G.N)\n", "s[DELTAS] = 1\n", "s = g.filter(s)\n", "G.plot_signal(s, highlight=DELTAS, backend='matplotlib')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2 Tutorials\n", "\n", "Try to follow one of our [tutorials](https://pygsp.readthedocs.io/en/stable/tutorials/index.html)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Your code here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3 Playground\n", "\n", "Or try anything that goes through your mind!\n", "Look at the [reference guide](https://pygsp.readthedocs.io/en/stable/reference/index.html) to know more about the API." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Your code here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you miss a package, you can install it with:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "! pip install pygsp" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 2 }