Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/model/grid_extensions_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"\n",
"## Adding columns to the Grid arrays\n",
"\n",
"Output variables are not present in the basic Grid as defined in gpm-ds, since these might or might not be useful to specific projects.\n",
"Output variables are not present in the basic Grid as defined in pgm-ds, since these might or might not be useful to specific projects.\n",
"To add these as you please you can extend the definitions of the arrays in your own project.\n"
]
},
Expand Down
28 changes: 13 additions & 15 deletions docs/examples/utils/grid_from_txt_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -84,29 +84,27 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from power_grid_model_ds import Grid\n",
"\n",
"grid = Grid.from_txt(\n",
" [\n",
" \"S1 2\",\n",
" \"S1 3 open\",\n",
" \"2 7\",\n",
" \"3 5\",\n",
" \"3 6 transformer\",\n",
" \"5 7\",\n",
" \"7 8\",\n",
" \"8 9\",\n",
" ]\n",
" \"S1 2\",\n",
" \"S1 3 open\",\n",
" \"2 7\",\n",
" \"3 5\",\n",
" \"3 6 transformer\",\n",
" \"5 7\",\n",
" \"7 8\",\n",
" \"8 9\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -132,7 +130,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "venv",
"language": "python",
"name": "python3"
},
Expand All @@ -146,7 +144,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
"version": "3.13.0"
}
},
"nbformat": 4,
Expand Down
14 changes: 8 additions & 6 deletions docs/model_interface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,25 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"```py\n",
"target_line = grid.arrays.line.get(1)\n",
"grid.make_active(target_branch_array=target_line)\n"
"grid.make_active(target_branch_array=target_line)\n",
"```\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As seen above you can also make batch modification using the `grid.append` method.\n",
"As seen above, you can also apply multiple modifications in one go using the `grid.append` method.\n",
"\n",
"## Array interface\n",
"\n",
"The array container is build around a extension of numpy arrays with the `FancyArray` class. This allows for easy and consistent definition of array types, recognition of array-type from it's class and features which improve readability such as dot-notation and autocompletion. It contains a `._data` attribute with the base numpy array and extra settings can be provided using `._defaults` and `._str_lengths`. Note these values should only be used in defining the array classes and remain private when using the arrays.\n",
"The array container is build around a extension of numpy arrays with the `FancyArray` class. This allows for easy and consistent definition of array types, recognition of array-type from its class and features which improve readability such as dot-notation and autocompletion. It contains a `._data` attribute with the base numpy array and extra settings can be provided using `._defaults` and `._str_lengths`. Note these values should only be used in defining the array classes and remain private when using the arrays.\n",
"\n",
"### Array definition\n",
"\n",
"You can create your own array by subclassing FancyArray.\n",
"You can create your own array by subclassing `FancyArray`.\n",
"Array-columns can be defined by adding class attributes with the column name and the numpy dtype.\n",
"\n",
"Example:\n"
Expand Down Expand Up @@ -148,7 +150,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"These are used when initializing an array with the .empty method\n"
"These are used when initializing an array with the `.empty` method\n"
]
},
{
Expand Down Expand Up @@ -190,7 +192,7 @@
"\n",
"### Array loops\n",
"\n",
"Looping over large arrays can be a performance hit, this is caused by casting each row to the original `FancyArray` subclass. When you want to implement a faster loop over the array you can choose to access the `array.data` directly and create the loop using\n"
"Looping over large arrays can incur a performance hit caused by conversion of each element to the original `FancyArray` subclass. When you want to implement a faster loop over the array you can choose to access the `array.data` directly and create the loop using\n"
]
},
{
Expand Down