|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
| 5 | + "id": "initial_id", |
5 | 6 | "metadata": {
|
| 7 | + "collapsed": true, |
6 | 8 | "ExecuteTime": {
|
7 |
| - "end_time": "2025-08-12T17:17:12.341315Z", |
8 |
| - "start_time": "2025-08-12T17:17:12.309989Z" |
| 9 | + "end_time": "2025-08-19T16:40:01.862229Z", |
| 10 | + "start_time": "2025-08-19T16:40:01.820265Z" |
9 | 11 | }
|
10 | 12 | },
|
11 | 13 | "source": [
|
| 14 | + "# NBVAL_IGNORE_OUTPUT\n", |
12 | 15 | "# Some jupyter notebook magic to reload modules automatically when they change\n",
|
13 | 16 | "# not necessary for this specific notebook but useful in general\n",
|
14 | 17 | "%load_ext autoreload\n",
|
15 | 18 | "%autoreload 2"
|
16 | 19 | ],
|
17 |
| - "outputs": [ |
18 |
| - { |
19 |
| - "name": "stdout", |
20 |
| - "output_type": "stream", |
21 |
| - "text": [ |
22 |
| - "The autoreload extension is already loaded. To reload it, use:\n", |
23 |
| - " %reload_ext autoreload\n" |
24 |
| - ] |
25 |
| - } |
26 |
| - ], |
27 |
| - "execution_count": 19 |
| 20 | + "outputs": [], |
| 21 | + "execution_count": 1 |
28 | 22 | },
|
29 | 23 | {
|
30 |
| - "cell_type": "code", |
31 | 24 | "metadata": {
|
32 | 25 | "ExecuteTime": {
|
33 |
| - "end_time": "2025-08-12T17:17:12.485196Z", |
34 |
| - "start_time": "2025-08-12T17:17:12.359095Z" |
| 26 | + "end_time": "2025-08-19T16:40:03.565588Z", |
| 27 | + "start_time": "2025-08-19T16:40:01.872411Z" |
35 | 28 | }
|
36 | 29 | },
|
| 30 | + "cell_type": "code", |
37 | 31 | "source": [
|
| 32 | + "# NBVAL_IGNORE_OUTPUT\n", |
38 | 33 | "from definitions import ROOT_DIR\n",
|
39 | 34 | "import os\n",
|
40 | 35 | "\n",
|
|
51 | 46 | "# You can also load a `GridWithResults` container which additionally contains the result\n",
|
52 | 47 | "# data. For more details see the `result_models.ipynb` notebook"
|
53 | 48 | ],
|
| 49 | + "id": "3d08b4fd2b690ca", |
54 | 50 | "outputs": [
|
55 | 51 | {
|
56 | 52 | "name": "stderr",
|
57 | 53 | "output_type": "stream",
|
58 | 54 | "text": [
|
59 |
| - "\u001B[32m2025-08-12 19:17:12.481\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mpypsdm.models.primary_data\u001B[0m:\u001B[36mfrom_csv\u001B[0m:\u001B[36m273\u001B[0m - \u001B[34m\u001B[1mNo primary data in path /home/smdafeis/github/pypsdm/tests/resources/simple_grid/input\u001B[0m\n" |
| 55 | + "\u001B[32m2025-08-19 18:40:03.551\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mpypsdm.models.primary_data\u001B[0m:\u001B[36mfrom_csv\u001B[0m:\u001B[36m273\u001B[0m - \u001B[34m\u001B[1mNo primary data in path /home/smdafeis/github/pypsdm/tests/resources/simple_grid/input\u001B[0m\n" |
60 | 56 | ]
|
61 | 57 | }
|
62 | 58 | ],
|
63 |
| - "execution_count": 20 |
| 59 | + "execution_count": 2 |
64 | 60 | },
|
65 | 61 | {
|
66 |
| - "cell_type": "code", |
67 | 62 | "metadata": {
|
68 | 63 | "ExecuteTime": {
|
69 |
| - "end_time": "2025-08-12T17:17:12.538077Z", |
70 |
| - "start_time": "2025-08-12T17:17:12.491016Z" |
| 64 | + "end_time": "2025-08-19T16:40:05.421736Z", |
| 65 | + "start_time": "2025-08-19T16:40:03.726177Z" |
71 | 66 | }
|
72 | 67 | },
|
| 68 | + "cell_type": "code", |
73 | 69 | "source": [
|
| 70 | + "# NBVAL_SKIP\n", |
74 | 71 | "from pypsdm.plots.grid import grid_plot\n",
|
75 | 72 | "\n",
|
76 | 73 | "# Use the grid_plot method to visualize the grid model\n",
|
77 | 74 | "# only works if the underlying node input files have associated coordinates\n",
|
78 | 75 | "grid_plot(grid)"
|
79 | 76 | ],
|
| 77 | + "id": "38b94c0e439ba698", |
80 | 78 | "outputs": [
|
81 | 79 | {
|
82 | 80 | "data": {
|
|
1015 | 1013 | "output_type": "display_data"
|
1016 | 1014 | }
|
1017 | 1015 | ],
|
1018 |
| - "execution_count": 21 |
| 1016 | + "execution_count": 3 |
1019 | 1017 | },
|
1020 | 1018 | {
|
1021 |
| - "cell_type": "code", |
1022 | 1019 | "metadata": {
|
1023 | 1020 | "ExecuteTime": {
|
1024 |
| - "end_time": "2025-08-12T17:17:12.575596Z", |
1025 |
| - "start_time": "2025-08-12T17:17:12.542626Z" |
| 1021 | + "end_time": "2025-08-19T16:40:05.565587Z", |
| 1022 | + "start_time": "2025-08-19T16:40:05.534817Z" |
1026 | 1023 | }
|
1027 | 1024 | },
|
| 1025 | + "cell_type": "code", |
1028 | 1026 | "source": [
|
| 1027 | + "# NBVAL_IGNORE_OUTPUT\n", |
1029 | 1028 | "# You can get a graph representation of the grid\n",
|
1030 | 1029 | "graph = grid.raw_grid.build_networkx_graph()\n",
|
1031 | 1030 | "# And a list of all the branches in the grid\n",
|
1032 | 1031 | "branches_list = grid.raw_grid.get_branches()\n",
|
1033 | 1032 | "branches_subgraphs = grid.raw_grid.get_branches(as_graphs=True)\n",
|
1034 | 1033 | "branches_list, branches_subgraphs"
|
1035 | 1034 | ],
|
| 1035 | + "id": "3bef89c519ea7a2e", |
1036 | 1036 | "outputs": [
|
1037 | 1037 | {
|
1038 | 1038 | "data": {
|
|
1041 | 1041 | " 'b7a5be0d-2662-41b2-99c6-3b8121a75e9e',\n",
|
1042 | 1042 | " '1dcddd06-f41a-405b-9686-7f7942852196',\n",
|
1043 | 1043 | " 'e3c3c6a3-c383-4dbb-9b3f-a14125615386']],\n",
|
1044 |
| - " [<networkx.classes.graph.Graph at 0x793323fdd790>])" |
| 1044 | + " [<networkx.classes.graph.Graph at 0x7e0971a5a960>])" |
1045 | 1045 | ]
|
1046 | 1046 | },
|
1047 |
| - "execution_count": 22, |
| 1047 | + "execution_count": 4, |
1048 | 1048 | "metadata": {},
|
1049 | 1049 | "output_type": "execute_result"
|
1050 | 1050 | }
|
1051 | 1051 | ],
|
1052 |
| - "execution_count": 22 |
| 1052 | + "execution_count": 4 |
1053 | 1053 | },
|
1054 | 1054 | {
|
1055 |
| - "cell_type": "code", |
1056 | 1055 | "metadata": {
|
1057 | 1056 | "ExecuteTime": {
|
1058 |
| - "end_time": "2025-08-12T17:17:12.618855Z", |
1059 |
| - "start_time": "2025-08-12T17:17:12.589209Z" |
| 1057 | + "end_time": "2025-08-19T16:40:05.612777Z", |
| 1058 | + "start_time": "2025-08-19T16:40:05.585043Z" |
1060 | 1059 | }
|
1061 | 1060 | },
|
| 1061 | + "cell_type": "code", |
1062 | 1062 | "source": [
|
| 1063 | + "# NBVAL_IGNORE_OUTPUT\n", |
1063 | 1064 | "# A grid container consists of a raw grid container\n",
|
1064 | 1065 | "raw_grid = grid.raw_grid\n",
|
1065 | 1066 | "# consisting of lines, transformers and so on\n",
|
|
1075 | 1076 | "# The base data structure of all input model is a pandas DataFrame accessible via .data\n",
|
1076 | 1077 | "pvs.data"
|
1077 | 1078 | ],
|
| 1079 | + "id": "57731ebb07b93950", |
1078 | 1080 | "outputs": [
|
1079 | 1081 | {
|
1080 | 1082 | "data": {
|
|
1246 | 1248 | "</div>"
|
1247 | 1249 | ]
|
1248 | 1250 | },
|
1249 |
| - "execution_count": 23, |
| 1251 | + "execution_count": 5, |
1250 | 1252 | "metadata": {},
|
1251 | 1253 | "output_type": "execute_result"
|
1252 | 1254 | }
|
1253 | 1255 | ],
|
1254 |
| - "execution_count": 23 |
| 1256 | + "execution_count": 5 |
1255 | 1257 | },
|
1256 | 1258 | {
|
1257 |
| - "cell_type": "code", |
1258 | 1259 | "metadata": {
|
1259 | 1260 | "ExecuteTime": {
|
1260 |
| - "end_time": "2025-08-12T17:17:12.661689Z", |
1261 |
| - "start_time": "2025-08-12T17:17:12.639427Z" |
| 1261 | + "end_time": "2025-08-19T16:40:05.663342Z", |
| 1262 | + "start_time": "2025-08-19T16:40:05.642882Z" |
1262 | 1263 | }
|
1263 | 1264 | },
|
| 1265 | + "cell_type": "code", |
1264 | 1266 | "source": [
|
1265 | 1267 | "# You can access the columns via the data frame\n",
|
1266 | 1268 | "pvs.data[\"s_rated\"]"
|
1267 | 1269 | ],
|
| 1270 | + "id": "f588fa60db607ebf", |
1268 | 1271 | "outputs": [
|
1269 | 1272 | {
|
1270 | 1273 | "data": {
|
|
1276 | 1279 | "Name: s_rated, dtype: int64"
|
1277 | 1280 | ]
|
1278 | 1281 | },
|
1279 |
| - "execution_count": 24, |
| 1282 | + "execution_count": 6, |
1280 | 1283 | "metadata": {},
|
1281 | 1284 | "output_type": "execute_result"
|
1282 | 1285 | }
|
1283 | 1286 | ],
|
1284 |
| - "execution_count": 24 |
| 1287 | + "execution_count": 6 |
1285 | 1288 | },
|
1286 | 1289 | {
|
1287 |
| - "cell_type": "code", |
1288 | 1290 | "metadata": {
|
1289 | 1291 | "ExecuteTime": {
|
1290 |
| - "end_time": "2025-08-12T17:17:12.715348Z", |
1291 |
| - "start_time": "2025-08-12T17:17:12.686303Z" |
| 1292 | + "end_time": "2025-08-19T16:40:05.723379Z", |
| 1293 | + "start_time": "2025-08-19T16:40:05.693807Z" |
1292 | 1294 | }
|
1293 | 1295 | },
|
| 1296 | + "cell_type": "code", |
1294 | 1297 | "source": [
|
1295 | 1298 | "# or directly via the property attribute of the class\n",
|
1296 | 1299 | "pvs.s_rated"
|
1297 | 1300 | ],
|
| 1301 | + "id": "ccdd8fd0a1d60968", |
1298 | 1302 | "outputs": [
|
1299 | 1303 | {
|
1300 | 1304 | "data": {
|
|
1306 | 1310 | "Name: s_rated, dtype: int64"
|
1307 | 1311 | ]
|
1308 | 1312 | },
|
1309 |
| - "execution_count": 25, |
| 1313 | + "execution_count": 7, |
1310 | 1314 | "metadata": {},
|
1311 | 1315 | "output_type": "execute_result"
|
1312 | 1316 | }
|
1313 | 1317 | ],
|
1314 |
| - "execution_count": 25 |
| 1318 | + "execution_count": 7 |
1315 | 1319 | },
|
1316 | 1320 | {
|
1317 |
| - "cell_type": "code", |
1318 | 1321 | "metadata": {
|
1319 | 1322 | "ExecuteTime": {
|
1320 |
| - "end_time": "2025-08-12T17:17:12.787361Z", |
1321 |
| - "start_time": "2025-08-12T17:17:12.735393Z" |
| 1323 | + "end_time": "2025-08-19T16:40:05.792223Z", |
| 1324 | + "start_time": "2025-08-19T16:40:05.743618Z" |
1322 | 1325 | }
|
1323 | 1326 | },
|
| 1327 | + "cell_type": "code", |
1324 | 1328 | "source": [
|
| 1329 | + "# NBVAL_IGNORE_OUTPUT\n", |
1325 | 1330 | "# The respective classes implement some useful methods for dealing with the data\n",
|
1326 | 1331 | "# e.g. retrieve all elements connected to one or multiple specified nodes\n",
|
1327 | 1332 | "# (Please check out the classes to see all the implemented methods)\n",
|
1328 | 1333 | "nodal_participants = participants.filter_by_nodes(grid.nodes.uuid.to_list()[::2])\n",
|
1329 | 1334 | "nodal_participants.pvs.data"
|
1330 | 1335 | ],
|
| 1336 | + "id": "be125965fbe013b2", |
1331 | 1337 | "outputs": [
|
1332 | 1338 | {
|
1333 | 1339 | "data": {
|
|
1472 | 1478 | "</div>"
|
1473 | 1479 | ]
|
1474 | 1480 | },
|
1475 |
| - "execution_count": 26, |
| 1481 | + "execution_count": 8, |
1476 | 1482 | "metadata": {},
|
1477 | 1483 | "output_type": "execute_result"
|
1478 | 1484 | }
|
1479 | 1485 | ],
|
1480 |
| - "execution_count": 26 |
| 1486 | + "execution_count": 8 |
1481 | 1487 | },
|
1482 | 1488 | {
|
1483 |
| - "cell_type": "code", |
1484 | 1489 | "metadata": {
|
1485 | 1490 | "ExecuteTime": {
|
1486 |
| - "end_time": "2025-08-12T17:17:13.058337Z", |
1487 |
| - "start_time": "2025-08-12T17:17:12.794784Z" |
| 1491 | + "end_time": "2025-08-19T16:40:06.074600Z", |
| 1492 | + "start_time": "2025-08-19T16:40:05.801528Z" |
1488 | 1493 | }
|
1489 | 1494 | },
|
| 1495 | + "cell_type": "code", |
1490 | 1496 | "source": [
|
| 1497 | + "# NBVAL_IGNORE_OUTPUT\n", |
1491 | 1498 | "from tempfile import TemporaryDirectory\n",
|
1492 | 1499 | "\n",
|
1493 | 1500 | "# You can write data models with their respective to_csv method\n",
|
|
1501 | 1508 | " # the == operator is overloaded to compare the underlying dataframes\n",
|
1502 | 1509 | " assert grid == grid_from_csv"
|
1503 | 1510 | ],
|
| 1511 | + "id": "f0d62146d59403f9", |
1504 | 1512 | "outputs": [
|
1505 | 1513 | {
|
1506 | 1514 | "name": "stderr",
|
1507 | 1515 | "output_type": "stream",
|
1508 | 1516 | "text": [
|
1509 |
| - "\u001B[32m2025-08-12 19:17:12.954\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mpypsdm.models.primary_data\u001B[0m:\u001B[36mfrom_csv\u001B[0m:\u001B[36m273\u001B[0m - \u001B[34m\u001B[1mNo primary data in path /tmp/tmplnxfgc6t\u001B[0m\n" |
| 1517 | + "\u001B[32m2025-08-19 18:40:05.968\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mpypsdm.models.primary_data\u001B[0m:\u001B[36mfrom_csv\u001B[0m:\u001B[36m273\u001B[0m - \u001B[34m\u001B[1mNo primary data in path /tmp/tmp97ev7h7m\u001B[0m\n" |
1510 | 1518 | ]
|
1511 | 1519 | }
|
1512 | 1520 | ],
|
1513 |
| - "execution_count": 27 |
| 1521 | + "execution_count": 9 |
1514 | 1522 | }
|
1515 | 1523 | ],
|
1516 | 1524 | "metadata": {
|
1517 | 1525 | "kernelspec": {
|
1518 |
| - "display_name": "pypsdm-sJkpnJQv-py3.11", |
| 1526 | + "display_name": "Python 3", |
1519 | 1527 | "language": "python",
|
1520 | 1528 | "name": "python3"
|
1521 | 1529 | },
|
1522 | 1530 | "language_info": {
|
1523 | 1531 | "codemirror_mode": {
|
1524 | 1532 | "name": "ipython",
|
1525 |
| - "version": 3 |
| 1533 | + "version": 2 |
1526 | 1534 | },
|
1527 | 1535 | "file_extension": ".py",
|
1528 | 1536 | "mimetype": "text/x-python",
|
1529 | 1537 | "name": "python",
|
1530 | 1538 | "nbconvert_exporter": "python",
|
1531 |
| - "pygments_lexer": "ipython3", |
1532 |
| - "version": "3.11.5" |
| 1539 | + "pygments_lexer": "ipython2", |
| 1540 | + "version": "2.7.6" |
1533 | 1541 | }
|
1534 | 1542 | },
|
1535 | 1543 | "nbformat": 4,
|
1536 |
| - "nbformat_minor": 2 |
| 1544 | + "nbformat_minor": 5 |
1537 | 1545 | }
|
0 commit comments