From 948dae5ce77c70081c4853c3c02e3713a17d60d6 Mon Sep 17 00:00:00 2001 From: Paulo Meira <10246101+PMeira@users.noreply.github.com> Date: Wed, 24 May 2023 22:20:13 -0300 Subject: [PATCH] docs: Adjust notebooks for Google Colab. --- docs/examples/JSON.ipynb | 25 ++++++++++- docs/examples/Plotting.ipynb | 45 ++++++++++++++++++- .../UserModels/PyIndMach012/README.ipynb | 36 +++++++++++++-- 3 files changed, 100 insertions(+), 6 deletions(-) diff --git a/docs/examples/JSON.ipynb b/docs/examples/JSON.ipynb index a2144fb7..b2bd558e 100644 --- a/docs/examples/JSON.ipynb +++ b/docs/examples/JSON.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "6b7792b4-5bbc-49f5-9388-e7367cfa644c", "metadata": { @@ -11,7 +12,7 @@ "\n", "*Updated for DSS C-API version 0.13.2*\n", "\n", - "You can open and then run this notebook on Google Colab from a quick overview if you don't want to set up a local environment: **[Open in Colab](https://colab.research.google.com/github/dss-extensions/dss_python/blob/master/docs/examples/JSON.ipynb)**.\n", + "You can open and then run this notebook on Google Colab for a quick overview if you don't want to set up a local environment: **[Open in Colab](https://colab.research.google.com/github/dss-extensions/dss_python/blob/master/docs/examples/JSON.ipynb)**.\n", "\n", "**Preparation**\n", "\n", @@ -49,6 +50,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f97f96f9-aace-4b42-aaa5-357e17f2ec61", "metadata": {}, @@ -67,10 +69,11 @@ "source": [ "import os, subprocess\n", "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " print(subprocess.check_output('pip install dss-python[plot] opendssdirect.py[extras]', shell=True).decode())" + " print(subprocess.check_output('pip install dss-python[plot] opendssdirect.py[extras] pandas==2', shell=True).decode())" ] }, { + "attachments": {}, "cell_type": "markdown", "id": "a37214b7-082d-40a2-b2dd-fc9fa56ec508", "metadata": {}, @@ -93,6 +96,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "677a0e15-1789-4058-8f00-3a55d4d542db", "metadata": { @@ -121,6 +125,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e2787869-e30d-4d9d-b1b4-b72248ba0244", "metadata": {}, @@ -146,6 +151,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "235cb310-e658-4312-a68e-4938787dca1e", "metadata": { @@ -156,6 +162,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8ef715c5-1bc8-48cd-a95d-5f3eeaf00218", "metadata": {}, @@ -226,6 +233,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "0028c7eb-ffc2-4f40-aef1-44b0c720a066", "metadata": {}, @@ -424,6 +432,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "0a50f347-59a1-4468-84ee-9720ed50905e", "metadata": {}, @@ -844,6 +853,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "dc7426e0-0c2e-4a71-bcc0-1ef53936618b", "metadata": {}, @@ -884,6 +894,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "bd2281de-9ce6-45a8-9d83-357d9cc52ba3", "metadata": {}, @@ -926,6 +937,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "604febff-f357-4712-b39d-8204174260c5", "metadata": { @@ -936,6 +948,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "88a793a7-267f-40fa-90ad-a6bc11e0ee8f", "metadata": {}, @@ -1099,6 +1112,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "7ac63e18-28ed-41e8-9925-214bc2ab5a4c", "metadata": { @@ -1109,6 +1123,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "ef07797b-ede0-41b6-a1b1-a02f72d17467", "metadata": {}, @@ -1185,6 +1200,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8c9e34f0-8888-43da-aa98-84aad1c399e8", "metadata": { @@ -2409,6 +2425,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e289e7d2-9269-4a56-a3e7-73d0c6d02812", "metadata": {}, @@ -2533,6 +2550,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "b1d035d2-8b30-4982-a3f9-27fc674c00a6", "metadata": { @@ -2569,6 +2587,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "a37ce6c3-b93a-4810-aa2e-73349430208b", "metadata": {}, @@ -2632,6 +2651,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "9fed0487-8b78-4f40-89fb-df0b82024a0a", "metadata": { @@ -3045,6 +3065,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "a3c741d8-3532-4015-82d2-e787c1f7b04d", "metadata": {}, diff --git a/docs/examples/Plotting.ipynb b/docs/examples/Plotting.ipynb index e5f40e0b..47552927 100644 --- a/docs/examples/Plotting.ipynb +++ b/docs/examples/Plotting.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "ede6d6d2-58b0-4efa-89a9-b868897a2aa7", "metadata": { @@ -14,7 +15,7 @@ "\n", "**Due to the high number of images, this notebook is stored in the Git repository without outputs.**\n", "\n", - "You can open and then run this notebook on Google Colab from a quick overview if you don't want to set up a local environment: **[Open in Colab](https://colab.research.google.com/github/dss-extensions/dss_python/blob/master/docs/examples/Plotting.ipynb)**.\n", + "You can open and then run this notebook on Google Colab for a quick overview if you don't want to set up a local environment: **[Open in Colab](https://colab.research.google.com/github/dss-extensions/dss_python/blob/master/docs/examples/Plotting.ipynb)**.\n", "\n", "**General preparation**\n", "\n", @@ -38,6 +39,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "ff162dff-dfe1-4a6e-acdd-687c1324171e", "metadata": {}, @@ -58,6 +60,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d68bb78a-064b-42e4-89cb-90bd298b77a2", "metadata": { @@ -89,6 +92,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f899e819-c16c-45e4-9059-d3ee7d207896", "metadata": { @@ -128,6 +132,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "5c330d85-b445-4027-b29b-d4b55420694b", "metadata": {}, @@ -149,6 +154,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8de28804-c360-47e4-9588-a9d51d4353a1", "metadata": {}, @@ -173,6 +179,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "5c80d280-f058-4d9a-a1b6-53905250c5b3", "metadata": {}, @@ -181,6 +188,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "80d4d363-746c-44d8-8825-7fc5ef5185fa", "metadata": { @@ -210,6 +218,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "04fb2db6-2d87-4427-a825-0dc635fbd52d", "metadata": { @@ -239,6 +248,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "edc12ad5-6a72-4198-af4c-e2e0220e02ad", "metadata": { @@ -293,6 +303,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d22b3e1c-8155-41a0-9fda-e8f62ce5c3b7", "metadata": {}, @@ -317,6 +328,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e132fb2f-e203-42ed-babf-1732aa78d466", "metadata": { @@ -356,6 +368,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "a1b47acb-64bb-4289-a189-c04b7a1c6e9d", "metadata": { @@ -417,6 +430,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "0f278947-010f-45fd-81e0-c98cba46c0d3", "metadata": {}, @@ -438,6 +452,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "3e77b9c2-8eed-46df-890f-8b649df0f2fb", "metadata": { @@ -467,6 +482,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "4fbe6f68-c1ca-466b-81ae-1992f640b3ac", "metadata": { @@ -477,6 +493,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "7a9a89c1-3472-4739-a3de-1dfc03ccc792", "metadata": {}, @@ -514,6 +531,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "7069de34-ca21-4733-baf8-78321cdf5d07", "metadata": {}, @@ -522,6 +540,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "63e28e58-1247-4edb-a837-11cb526523c6", "metadata": {}, @@ -595,6 +614,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "a5424bda-2ed5-40dd-a0d7-3b28d38e0757", "metadata": {}, @@ -616,6 +636,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "69310ed9-00ca-46e2-a9ad-8e1ce45ee4e3", "metadata": {}, @@ -652,6 +673,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "861d1a29-ad34-486f-92b6-22f43429a6d2", "metadata": { @@ -677,6 +699,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "bb422410-172e-4c14-a323-ffcf23fe4576", "metadata": { @@ -704,6 +727,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8bb6ccd8-200f-4144-b28f-c7809076db39", "metadata": {}, @@ -778,6 +802,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "66a18b5d-1230-4b8c-a3af-316c984ff36e", "metadata": { @@ -844,6 +869,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "04793094-1ffe-439e-bedd-c36c8e85bead", "metadata": { @@ -854,6 +880,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "93a6d50a-1207-4d12-a5e8-6ef714e84d2a", "metadata": { @@ -901,6 +928,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "6d28135b-3980-472d-a044-8eca6b586716", "metadata": {}, @@ -924,6 +952,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "b02a5383-325b-480c-b2fc-d83c2abf741c", "metadata": {}, @@ -947,6 +976,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c44a508d-7ac1-4689-9d0f-68897927c510", "metadata": { @@ -972,6 +1002,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "851fa4d9-ea6c-465f-bb81-f561c4a499ca", "metadata": {}, @@ -997,6 +1028,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f88408ca-1980-432d-b619-5113fcca07f8", "metadata": {}, @@ -1028,6 +1060,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "220da516-05d0-435b-bc29-2687335e0f6f", "metadata": {}, @@ -1063,6 +1096,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2bf1cbb1-a875-4c65-80f1-48ec6b959138", "metadata": { @@ -1103,6 +1137,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "681b4581-691c-4de7-ab8b-054dd51c0066", "metadata": {}, @@ -1124,6 +1159,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c2ee4861-e69e-411b-9f04-2db05dcd40d3", "metadata": { @@ -1168,6 +1204,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d228c039-91a2-4147-8d4c-07604fd51edb", "metadata": { @@ -1201,6 +1238,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e624d5d9-be13-4e8b-9c75-895498ba837c", "metadata": { @@ -1218,6 +1256,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "6c6753ef-3113-4047-a378-4e5270d085bb", "metadata": {}, @@ -1251,6 +1290,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "9de41b4c-2543-401c-9d5d-499a492c68f0", "metadata": {}, @@ -1277,6 +1317,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "43a6d4d4-6b89-44ba-ace3-f8a6cbe47ee1", "metadata": { @@ -1313,6 +1354,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "a1ccf947-fee3-4c6b-a76c-d92f97ec833d", "metadata": {}, @@ -1335,6 +1377,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c258d002-17f4-4660-991e-7fb396e1c0cb", "metadata": { diff --git a/docs/examples/UserModels/PyIndMach012/README.ipynb b/docs/examples/UserModels/PyIndMach012/README.ipynb index 50bfc205..5b0c142b 100644 --- a/docs/examples/UserModels/PyIndMach012/README.ipynb +++ b/docs/examples/UserModels/PyIndMach012/README.ipynb @@ -1,16 +1,39 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "# PyIndMach012: an example of user-model using DSS Python\n", + "# PyIndMach012: an example of user-model using DSS-Python\n", "\n", "This example runs a modified example from the OpenDSS distribution for the induction machine model with a sample PyIndMach012 implementation, written in Python, and the original, built-in IndMach012.\n", "\n", "Check the `PyIndMach012.py` file for more comments. Comparing it to [the Pascal code for IndMach012](https://github.com/dss-extensions/dss_capi/blob/master/Version7/Source/PCElements/IndMach012.pas) can be useful to understand some of the inner workings of OpenDSS.\n", "\n", - "The user-model code in DSS Python is not stable yet but can be used to develop new ideas before commiting the final model in a traditional DLL user-model. Particularly, I (@PMeira) found some issues with callbacks with newer Version 8 COM DLLs, so changes related to that are expected.\n" + "The user-model code in DSS-Python was supposed to grow other features, but the effort hasn't been continued for many reasons. The code for generator user-models has been stable for many releases. We believe it can be used to develop new ideas before committing the final model in a traditional DLL user-model." + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The outputs for this notebook should be listed below, but you can also open and then run this notebook on Google Colab for a quick overview if you don't want to set up a local environment: **[Open in Colab](https://colab.research.google.com/github/dss-extensions/dss_python/blob/master/docs/examples/UserModels/PyIndMach012/README.ipynb)**. The next cell installs DSS-Python and dependencies, and downloads the extra files." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os, subprocess\n", + "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", + " import urllib.request\n", + " print(subprocess.check_output('pip install dss-python[plot]', shell=True).decode())\n", + " urllib.request.urlretrieve(\"https://raw.githubusercontent.com/dss-extensions/dss_python/master/docs/examples/UserModels/PyIndMach012/PyIndMach012.py\", \"PyIndMach012.py\")\n", + " urllib.request.urlretrieve(\"https://raw.githubusercontent.com/dss-extensions/dss_python/master/docs/examples/UserModels/PyIndMach012/master.dss\", \"master.dss\")\n" ] }, { @@ -19,7 +42,6 @@ "metadata": {}, "outputs": [], "source": [ - "%matplotlib inline\n", "import os\n", "import numpy as np\n", "from matplotlib import pyplot as plt\n", @@ -28,6 +50,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -439,6 +462,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -446,6 +470,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -494,6 +519,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -551,6 +577,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -558,6 +585,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -585,6 +613,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -592,6 +621,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [