Skip to content

Commit 222adc4

Browse files
committed
Fix example notebooks: remove broken state access and steady-state plots
1 parent 2a4b380 commit 222adc4

File tree

2 files changed

+2
-60
lines changed

2 files changed

+2
-60
lines changed

docs/source/examples/flash_distillation.ipynb

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -154,33 +154,7 @@
154154
"execution_count": null,
155155
"metadata": {},
156156
"outputs": [],
157-
"source": [
158-
"time, signals = scp.read()\n",
159-
"\n",
160-
"fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))\n",
161-
"\n",
162-
"# Dynamic tray composition evolution\n",
163-
"for i in range(N_trays):\n",
164-
" ax1.plot(time, signals[i], label=f\"Tray {i+1}\")\n",
165-
"ax1.set_xlabel(\"Time [s]\")\n",
166-
"ax1.set_ylabel(r\"$x$ (light component)\")\n",
167-
"ax1.set_title(\"Tray Compositions Over Time\")\n",
168-
"ax1.legend()\n",
169-
"ax1.grid(True, alpha=0.3)\n",
170-
"\n",
171-
"# Steady-state composition profile\n",
172-
"x_profile = [tray.engine.state[0] for tray in trays]\n",
173-
"tray_nums = list(range(1, N_trays + 1))\n",
174-
"\n",
175-
"ax2.plot(tray_nums, x_profile, \"o-\", markersize=8)\n",
176-
"ax2.set_xlabel(\"Tray number (top to bottom)\")\n",
177-
"ax2.set_ylabel(r\"$x$ (light component)\")\n",
178-
"ax2.set_title(\"Composition Profile (Steady State)\")\n",
179-
"ax2.grid(True, alpha=0.3)\n",
180-
"\n",
181-
"plt.tight_layout()\n",
182-
"plt.show()"
183-
]
157+
"source": "time, signals = scp.read()\n\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))\n\n# Dynamic tray composition evolution\nfor i in range(N_trays):\n ax1.plot(time, signals[i], label=f\"Tray {i+1}\")\nax1.set_xlabel(\"Time [s]\")\nax1.set_ylabel(r\"$x$ (light component)\")\nax1.set_title(\"Tray Compositions Over Time\")\nax1.legend()\nax1.grid(True, alpha=0.3)\n\n# Steady-state composition profile\nx_profile = [tray.state[0] for tray in trays]\ntray_nums = list(range(1, N_trays + 1))\n\nax2.plot(tray_nums, x_profile, \"o-\", markersize=8)\nax2.set_xlabel(\"Tray number (top to bottom)\")\nax2.set_ylabel(r\"$x$ (light component)\")\nax2.set_title(\"Composition Profile (Steady State)\")\nax2.grid(True, alpha=0.3)\n\nplt.tight_layout()\nplt.show()"
184158
},
185159
{
186160
"cell_type": "markdown",

docs/source/examples/heat_exchanger.ipynb

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -68,39 +68,7 @@
6868
"execution_count": null,
6969
"metadata": {},
7070
"outputs": [],
71-
"source": [
72-
"time, signals = scp.read()\n",
73-
"\n",
74-
"fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))\n",
75-
"\n",
76-
"# Outlet temperatures over time\n",
77-
"ax1.plot(time, signals[0], label=\"Hot outlet\")\n",
78-
"ax1.plot(time, signals[1], label=\"Cold outlet\")\n",
79-
"ax1.axhline(370, color=\"gray\", ls=\"--\", alpha=0.4, label=\"Hot inlet\")\n",
80-
"ax1.axhline(290, color=\"gray\", ls=\"-.\", alpha=0.4, label=\"Cold inlet\")\n",
81-
"ax1.set_xlabel(\"Time [s]\")\n",
82-
"ax1.set_ylabel(\"Temperature [K]\")\n",
83-
"ax1.set_title(\"Outlet Temperatures\")\n",
84-
"ax1.legend()\n",
85-
"ax1.grid(True, alpha=0.3)\n",
86-
"\n",
87-
"# Steady-state temperature profile along the exchanger\n",
88-
"state = hx.engine.x0\n",
89-
"T_h_profile = state[0::2]\n",
90-
"T_c_profile = state[1::2]\n",
91-
"cells = np.arange(1, len(T_h_profile) + 1)\n",
92-
"\n",
93-
"ax2.plot(cells, T_h_profile, \"o-\", label=\"Hot stream\")\n",
94-
"ax2.plot(cells, T_c_profile, \"s-\", label=\"Cold stream\")\n",
95-
"ax2.set_xlabel(\"Cell number\")\n",
96-
"ax2.set_ylabel(\"Temperature [K]\")\n",
97-
"ax2.set_title(\"Temperature Profile (Steady State)\")\n",
98-
"ax2.legend()\n",
99-
"ax2.grid(True, alpha=0.3)\n",
100-
"\n",
101-
"plt.tight_layout()\n",
102-
"plt.show()"
103-
]
71+
"source": "time, signals = scp.read()\n\nfig, ax = plt.subplots(figsize=(8, 5))\n\nax.plot(time, signals[0], label=\"Hot outlet\")\nax.plot(time, signals[1], label=\"Cold outlet\")\nax.axhline(370, color=\"gray\", ls=\"--\", alpha=0.4, label=\"Hot inlet\")\nax.axhline(290, color=\"gray\", ls=\"-.\", alpha=0.4, label=\"Cold inlet\")\nax.set_xlabel(\"Time [s]\")\nax.set_ylabel(\"Temperature [K]\")\nax.set_title(\"Heat Exchanger Outlet Temperatures\")\nax.legend()\nax.grid(True, alpha=0.3)\n\nplt.tight_layout()\nplt.show()"
10472
},
10573
{
10674
"cell_type": "markdown",

0 commit comments

Comments
 (0)