diff --git a/Makefile b/Makefile index baa8d710..ac67e446 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ conda: set -ex conda env create -f environment.yml conda activate nams - python setup.py develop + python setup.py develop python checkenv.py venv: @@ -30,7 +30,7 @@ venv: virtualenv network source network/bin/activate && pip install -r requirements.txt echo "Run 'source network/bin/activate' to begin" - python setup.py develop + python setup.py develop python checkenv.py check: diff --git a/nams/solutions/paths.py b/nams/solutions/paths.py index 7dc80f79..7cdae9ca 100644 --- a/nams/solutions/paths.py +++ b/nams/solutions/paths.py @@ -118,7 +118,7 @@ def plot_path_with_neighbors(G, n1, n2): g = G.subgraph(nodes) nv.arc( - g, sort_by="order", node_color_by="order", edge_aes_kwargs={"alpha_scale": 0.5} + g, sort_by="order", node_color_by="order", edge_enc_kwargs={"alpha_scale": 0.5} ) for n in path: highlights.arc_node(g, n, sort_by="order") diff --git a/notebooks/01-introduction/03-viz.ipynb b/notebooks/01-introduction/03-viz.ipynb index 5cb97a11..9cceb427 100644 --- a/notebooks/01-introduction/03-viz.ipynb +++ b/notebooks/01-introduction/03-viz.ipynb @@ -9,7 +9,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -365,7 +367,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/02-algorithms/01-hubs.ipynb b/notebooks/02-algorithms/01-hubs.ipynb index 9ad13a11..2b4b1a38 100644 --- a/notebooks/02-algorithms/01-hubs.ipynb +++ b/notebooks/02-algorithms/01-hubs.ipynb @@ -9,7 +9,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -614,7 +616,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/02-algorithms/02-paths.ipynb b/notebooks/02-algorithms/02-paths.ipynb index ab0b460d..0f09f53c 100644 --- a/notebooks/02-algorithms/02-paths.ipynb +++ b/notebooks/02-algorithms/02-paths.ipynb @@ -9,7 +9,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -479,7 +481,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/02-algorithms/03-structures.ipynb b/notebooks/02-algorithms/03-structures.ipynb index 2f1f2b71..7023769d 100644 --- a/notebooks/02-algorithms/03-structures.ipynb +++ b/notebooks/02-algorithms/03-structures.ipynb @@ -9,7 +9,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -718,13 +720,6 @@ "\n", "print(inspect.getsource(structures))" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -743,7 +738,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/03-practical/01-io.ipynb b/notebooks/03-practical/01-io.ipynb index 47e44d05..7c210345 100644 --- a/notebooks/03-practical/01-io.ipynb +++ b/notebooks/03-practical/01-io.ipynb @@ -9,7 +9,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -657,7 +659,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/04-advanced/01-bipartite.ipynb b/notebooks/04-advanced/01-bipartite.ipynb index 7b426cf1..4a284ab3 100644 --- a/notebooks/04-advanced/01-bipartite.ipynb +++ b/notebooks/04-advanced/01-bipartite.ipynb @@ -11,7 +11,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -141,7 +143,7 @@ "import matplotlib.pyplot as plt\n", "\n", "fig, ax = plt.subplots(figsize=(7, 7))\n", - "nv.circos(G, sort_by=\"degree\", group_by=\"bipartite\", node_color_by=\"bipartite\", node_aes_kwargs={\"size_scale\": 3})" + "nv.circos(G, sort_by=\"degree\", group_by=\"bipartite\", node_color_by=\"bipartite\", node_enc_kwargs={\"size_scale\": 3})" ] }, { @@ -617,7 +619,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/04-advanced/02-linalg.ipynb b/notebooks/04-advanced/02-linalg.ipynb index b00fa091..e0f171a4 100644 --- a/notebooks/04-advanced/02-linalg.ipynb +++ b/notebooks/04-advanced/02-linalg.ipynb @@ -9,7 +9,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -923,7 +925,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/04-advanced/03-stats.ipynb b/notebooks/04-advanced/03-stats.ipynb index 235875ac..97e16540 100644 --- a/notebooks/04-advanced/03-stats.ipynb +++ b/notebooks/04-advanced/03-stats.ipynb @@ -9,7 +9,9 @@ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", - "%config InlineBackend.figure_format = 'retina'" + "%config InlineBackend.figure_format = 'retina'\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -398,7 +400,7 @@ "import nxviz as nv\n", "from nxviz import annotate\n", "\n", - "nv.circos(G, sort_by=\"degree\", node_color_by=\"degree\", node_aes_kwargs={\"size_scale\": 10})\n", + "nv.circos(G, sort_by=\"degree\", node_color_by=\"degree\", node_enc_kwargs={\"size_scale\": 10})\n", "annotate.node_colormapping(G, color_by=\"degree\")" ] }, @@ -660,7 +662,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/05-casestudies/01-gameofthrones.ipynb b/notebooks/05-casestudies/01-gameofthrones.ipynb index e7e2296d..3f1a8dd9 100644 --- a/notebooks/05-casestudies/01-gameofthrones.ipynb +++ b/notebooks/05-casestudies/01-gameofthrones.ipynb @@ -14,7 +14,9 @@ "import networkx as nx\n", "import community\n", "import numpy as np\n", - "import matplotlib.pyplot as plt" + "import matplotlib.pyplot as plt\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -752,7 +754,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/05-casestudies/02-airport.ipynb b/notebooks/05-casestudies/02-airport.ipynb index a92d4660..4709d627 100644 --- a/notebooks/05-casestudies/02-airport.ipynb +++ b/notebooks/05-casestudies/02-airport.ipynb @@ -13,7 +13,9 @@ "import networkx as nx\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", - "import numpy as np" + "import numpy as np\n", + "import warnings\n", + "warnings.filterwarnings('ignore')" ] }, { @@ -338,7 +340,7 @@ "lat_long\n", "wanted_nodes = list(pass_2015_network.nodes())\n", "us_airports = lat_long.query(\"CODE3 in @wanted_nodes\").drop_duplicates(subset=[\"CODE3\"]).set_index(\"CODE3\")\n", - "us_airports\n", + "us_airports.head()\n", "# us_airports" ] }, @@ -385,7 +387,7 @@ "import nxviz as nv\n", "from nxviz import nodes, plots, edges\n", "plt.figure(figsize=(20, 9))\n", - "pos = nodes.geo(g, aesthetics_kwargs={\"size_scale\": 1})\n", + "pos = nodes.geo(g, encodings_kwargs={\"size_scale\": 1})\n", "plots.aspect_equal()\n", "plots.despine()" ] @@ -408,8 +410,8 @@ "import nxviz as nv\n", "from nxviz import nodes, plots, edges, annotate\n", "plt.figure(figsize=(20, 9))\n", - "pos = nodes.geo(g, color_by=\"degree\", aesthetics_kwargs={\"size_scale\": 1})\n", - "edges.line(g, pos, aesthetics_kwargs={\"alpha_scale\": 0.1})\n", + "pos = nodes.geo(g, color_by=\"degree\", encodings_kwargs={\"size_scale\": 1})\n", + "edges.line(g, pos, encodings_kwargs={\"alpha_scale\": 0.1})\n", "annotate.node_colormapping(g, color_by=\"degree\")\n", "plots.aspect_equal()\n", "plots.despine()" @@ -519,8 +521,9 @@ "G.add_edges_from([(1, 2), (3, 2),\n", " (4, 2), (5, 2),\n", " (6, 2), (7, 2)])\n", - "# nx.draw_spring(G, with_labels=True)\n", - "nv.circos(G, node_aes_kwargs={\"size_scale\": 0.3})" + "nx.draw_circular(G, with_labels=True)\n", + "\n", + "# nv.circos(G, node_enc_kwargs={\"size_scale\": 0.3})" ] }, { @@ -559,8 +562,8 @@ "outputs": [], "source": [ "G.add_edge(5, 6)\n", - "nv.circos(G, node_aes_kwargs={\"size_scale\": 0.3})\n", - "# nx.draw_spring(G, with_labels=True)" + "# nv.circos(G, node_enc_kwargs={\"size_scale\": 0.3})\n", + "nx.draw_circular(G, with_labels=True)" ] }, { @@ -590,7 +593,7 @@ "outputs": [], "source": [ "G.add_edge(2, 8)\n", - "nv.circos(G, node_aes_kwargs={\"size_scale\": 0.3})" + "nx.draw_circular(G, with_labels=True)" ] }, { @@ -919,9 +922,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The airports 'SSB' and 'SPB' are codes for Seaplanes airports and they have flights to each other so it makes sense that they aren't connected to the larger network of airports.\n", + "The airports `SSB` and `SPB` are codes for Seaplanes airports and they have flights to each other so it makes sense that they aren't connected to the larger network of airports.\n", "\n", - "The airport is even more weird as it is in a component in itself, i.e there is a flight from AIK to AIK. After investigating further it just seems like an anomaly in this dataset." + "The airport is even more weird as it is in a component in itself, i.e there is a flight from `AIK` to `AIK`. After investigating further it just seems like an anomaly in this dataset." ] }, { @@ -1134,31 +1137,17 @@ }, "outputs": [], "source": [ - "BCE_DEST_2015 = pass_air_data[\n", - " (pass_air_data['YEAR'] == 2015) & \n", - " (pass_air_data['DEST'] == 'BCE')]\n", - "BCE_DEST_2015.head()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "BCE_ORI_2015 = pass_air_data[\n", - " (pass_air_data['YEAR'] == 2015) & \n", - " (pass_air_data['ORIGIN'] == 'BCE')]\n", - "BCE_ORI_2015.head()" + "bce_2015 = (pass_air_data\n", + " .query('YEAR == 2015')\n", + " .query(\"ORIGIN == 'BCE' or DEST == 'BCE'\"))\n", + "bce_2015" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "As we can see above you can fly into 'BCE' but can't fly out, weird indeed. These airport are small airports with one off schedules flights. For the purposes of our analyses we can ignore such airports." + "As we can see above you can fly into `BCE` but can't fly out, weird indeed. These airport are small airports with one off schedules flights. For the purposes of our analyses we can ignore such airports." ] }, { @@ -1412,13 +1401,6 @@ "\n", "print(inspect.getsource(airport))" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -1440,7 +1422,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4,