|
51 | 51 | }, |
52 | 52 | { |
53 | 53 | "cell_type": "code", |
54 | | - "execution_count": 4, |
| 54 | + "execution_count": null, |
55 | 55 | "metadata": {}, |
56 | 56 | "outputs": [ |
57 | 57 | { |
|
78 | 78 | ], |
79 | 79 | "source": [ |
80 | 80 | "eq = pde.DiffusionPDE()\n", |
81 | | - "movie_file = tempfile.NamedTemporaryFile(delete=False, suffix=\".mov\").name\n", |
82 | | - "plot_tracker = pde.PlotTracker(\n", |
83 | | - " 0.1, title=\"Visible – {time:.2g}\", show=True, movie=movie_file\n", |
84 | | - ")\n", |
85 | | - "_, info = eq.solve(\n", |
86 | | - " field,\n", |
87 | | - " t_range=2,\n", |
88 | | - " dt=0.1,\n", |
89 | | - " backend=\"numpy\",\n", |
90 | | - " ret_info=True,\n", |
91 | | - " tracker=[\"progress\", plot_tracker],\n", |
92 | | - ")" |
| 81 | + "with tempfile.NamedTemporaryFile(delete=False, suffix=\".mov\") as movie_file:\n", |
| 82 | + " plot_tracker = pde.PlotTracker(\n", |
| 83 | + " 0.1, title=\"Visible – {time:.2g}\", show=True, movie=movie_file.name\n", |
| 84 | + " )\n", |
| 85 | + " _, info = eq.solve(\n", |
| 86 | + " field,\n", |
| 87 | + " t_range=2,\n", |
| 88 | + " dt=0.1,\n", |
| 89 | + " backend=\"numpy\",\n", |
| 90 | + " ret_info=True,\n", |
| 91 | + " tracker=[\"progress\", plot_tracker],\n", |
| 92 | + " )" |
93 | 93 | ] |
94 | 94 | }, |
95 | 95 | { |
|
144 | 144 | }, |
145 | 145 | { |
146 | 146 | "cell_type": "code", |
147 | | - "execution_count": 8, |
| 147 | + "execution_count": null, |
148 | 148 | "metadata": {}, |
149 | 149 | "outputs": [ |
150 | 150 | { |
|
164 | 164 | ], |
165 | 165 | "source": [ |
166 | 166 | "eq = pde.DiffusionPDE()\n", |
167 | | - "movie_file = tempfile.NamedTemporaryFile(delete=False, suffix=\".mov\").name\n", |
168 | | - "plot_tracker = pde.PlotTracker(\n", |
169 | | - " 0.1, title=\"Hidden – {time:.2g}\", show=False, movie=movie_file\n", |
170 | | - ")\n", |
171 | | - "_, info = eq.solve(\n", |
172 | | - " field,\n", |
173 | | - " t_range=2,\n", |
174 | | - " dt=0.1,\n", |
175 | | - " backend=\"numpy\",\n", |
176 | | - " ret_info=True,\n", |
177 | | - " tracker=[\"progress\", plot_tracker],\n", |
178 | | - ")" |
| 167 | + "with tempfile.NamedTemporaryFile(delete=False, suffix=\".mov\") as movie_file:\n", |
| 168 | + " plot_tracker = pde.PlotTracker(\n", |
| 169 | + " 0.1, title=\"Hidden – {time:.2g}\", show=False, movie=movie_file.name\n", |
| 170 | + " )\n", |
| 171 | + " _, info = eq.solve(\n", |
| 172 | + " field,\n", |
| 173 | + " t_range=2,\n", |
| 174 | + " dt=0.1,\n", |
| 175 | + " backend=\"numpy\",\n", |
| 176 | + " ret_info=True,\n", |
| 177 | + " tracker=[\"progress\", plot_tracker],\n", |
| 178 | + " )" |
179 | 179 | ] |
180 | 180 | }, |
181 | 181 | { |
|
236 | 236 | }, |
237 | 237 | { |
238 | 238 | "cell_type": "code", |
239 | | - "execution_count": 12, |
| 239 | + "execution_count": null, |
240 | 240 | "metadata": {}, |
241 | 241 | "outputs": [ |
242 | 242 | { |
|
263 | 263 | ], |
264 | 264 | "source": [ |
265 | 265 | "eq = pde.PDE({\"a\": \"laplace(a)\", \"b\": \"laplace(b)\"})\n", |
266 | | - "movie_file = tempfile.NamedTemporaryFile(delete=False, suffix=\".mov\").name\n", |
267 | | - "plot_tracker = pde.PlotTracker(\n", |
268 | | - " 0.5,\n", |
269 | | - " title=\"Visible Plot Collection – {time:.2g}\",\n", |
270 | | - " show=True,\n", |
271 | | - " movie=movie_file,\n", |
272 | | - " plot_args={\"colorbar\": True},\n", |
273 | | - ")\n", |
274 | | - "_, info = eq.solve(\n", |
275 | | - " fc,\n", |
276 | | - " t_range=2,\n", |
277 | | - " dt=0.1,\n", |
278 | | - " backend=\"numpy\",\n", |
279 | | - " ret_info=True,\n", |
280 | | - " tracker=[\"progress\", plot_tracker],\n", |
281 | | - ")" |
| 266 | + "with tempfile.NamedTemporaryFile(delete=False, suffix=\".mov\") as movie_file:\n", |
| 267 | + " plot_tracker = pde.PlotTracker(\n", |
| 268 | + " 0.5,\n", |
| 269 | + " title=\"Visible Plot Collection – {time:.2g}\",\n", |
| 270 | + " show=True,\n", |
| 271 | + " movie=movie_file.name,\n", |
| 272 | + " plot_args={\"colorbar\": True},\n", |
| 273 | + " )\n", |
| 274 | + " _, info = eq.solve(\n", |
| 275 | + " fc,\n", |
| 276 | + " t_range=2,\n", |
| 277 | + " dt=0.1,\n", |
| 278 | + " backend=\"numpy\",\n", |
| 279 | + " ret_info=True,\n", |
| 280 | + " tracker=[\"progress\", plot_tracker],\n", |
| 281 | + " )" |
282 | 282 | ] |
283 | 283 | }, |
284 | 284 | { |
|
0 commit comments