|
63 | 63 | "osyris.histogram2d(\n",
|
64 | 64 | " data[\"hydro\"][\"density\"], data[\"hydro\"][\"B_field\"],\n",
|
65 | 65 | " {\"data\": data[\"hydro\"][\"mass\"], \"norm\": \"log\"}, # layer 1\n",
|
66 |
| - " {\"data\": data[\"amr\"][\"level\"], \"operation\": \"mean\", \"mode\": \"contour\", \"colors\": \"k\"}, # layer 2\n", |
| 66 | + " {\"data\": data[\"amr\"][\"level\"], \"operation\": \"mean\",\n", |
| 67 | + " \"mode\": \"contour\", \"colors\": \"k\"}, # layer 2\n", |
67 | 68 | " loglog=True)"
|
68 | 69 | ]
|
69 | 70 | },
|
|
215 | 216 | "outputs": [],
|
216 | 217 | "source": [
|
217 | 218 | "# Create figure\n",
|
218 |
| - "fig = plt.figure(figsize=(10, 3.5))\n", |
219 |
| - "ax1 = fig.add_subplot(121)\n", |
220 |
| - "ax2 = fig.add_subplot(122)\n", |
221 |
| - "plt.subplots_adjust(wspace=0.5)\n", |
| 219 | + "fig, ax = plt.subplots(1, 2, figsize=(12, 4.5))\n", |
222 | 220 | "\n",
|
223 | 221 | "# Define region to plot\n",
|
224 | 222 | "dx = 2000.0 * osyris.units(\"au\")\n",
|
|
235 | 233 | " \"linestyles\": [\"solid\",\"dashed\",\"solid\"],\n",
|
236 | 234 | " \"cmap\": None,\n",
|
237 | 235 | " \"labels\": False},\n",
|
238 |
| - " dx=dx,\n", |
239 |
| - " origin=center,\n", |
240 |
| - " direction=\"z\", ax=ax1)\n", |
| 236 | + " dx=dx, origin=center, direction=\"z\", ax=ax[0])\n", |
241 | 237 | "\n",
|
242 | 238 | "osyris.plane({\"data\": data[\"hydro\"][\"temperature\"], \"norm\": \"log\", \"mode\": \"contourf\",\n",
|
243 |
| - " \"levels\": np.logspace(0.9, 2, 21), \"cmap\": \"hot\"},\n", |
244 |
| - " {\"data\": data[\"amr\"][\"level\"], \"mode\": \"contour\", \"colors\": \"w\", \"levels\": [6, 7, 8]},\n", |
245 |
| - " dx=dx,\n", |
246 |
| - " origin=center,\n", |
247 |
| - " direction=\"z\", ax=ax2)" |
| 239 | + " \"levels\": np.logspace(0.9, 2, 11), \"cmap\": \"hot\"},\n", |
| 240 | + " {\"data\": data[\"amr\"][\"level\"], \"mode\": \"contour\", \"colors\": \"w\",\n", |
| 241 | + " \"levels\": [6, 7, 8]},\n", |
| 242 | + " dx=dx, origin=center, direction=\"z\", ax=ax[1])" |
248 | 243 | ]
|
249 | 244 | },
|
250 | 245 | {
|
|
506 | 501 | "source": [
|
507 | 502 | "## Line integral convolution vector field visualizations\n",
|
508 | 503 | "\n",
|
509 |
| - "Osyris now supports line integral convolution (LIC) visualizations of vector fields. This visualization method, although computationally intensive, offers an excellent representation of the vector field (especially near discontinuities) provided we have enough resolution.\n", |
| 504 | + "Osyris now supports line integral convolution (LIC) visualizations of vector fields.\n", |
| 505 | + "This visualization method, although computationally intensive,\n", |
| 506 | + "offers an excellent representation of the vector field (especially near discontinuities).\n", |
510 | 507 | "\n",
|
511 | 508 | "**Note:** This feature requires the [lic](https://pypi.org/project/lic/) package to be installed.\n",
|
512 | 509 | "\n",
|
|
520 | 517 | "outputs": [],
|
521 | 518 | "source": [
|
522 | 519 | "osyris.plane({\"data\": data[\"hydro\"][\"velocity\"], \"mode\": \"lic\"},\n",
|
523 |
| - " dx=2000 * osyris.units(\"au\"),\n", |
524 |
| - " origin=center,\n", |
525 |
| - " direction=\"z\", resolution=1000)" |
| 520 | + " dx=2000 * osyris.units(\"au\"), direction=\"z\",\n", |
| 521 | + " origin=center, cmap=\"binary\")" |
526 | 522 | ]
|
527 | 523 | },
|
528 | 524 | {
|
529 | 525 | "cell_type": "markdown",
|
530 | 526 | "metadata": {},
|
531 | 527 | "source": [
|
532 |
| - "The LIC can be colored by a scalar field using the `color` keyword, and the length of the lines of the LIC can also be modified using the `length` keyword (whose default value is 30):" |
| 528 | + "The LIC can be colored by a scalar field using the `color` keyword,\n", |
| 529 | + "and the length of the lines of the LIC can also be modified using the `length` keyword.\n", |
| 530 | + "\n", |
| 531 | + "In the following example,\n", |
| 532 | + "we use the colors to show the gas density overlayed onto the velocity flow structure on the left,\n", |
| 533 | + "while on the right we use the colors to recover some information on the magnitude of the velocities." |
533 | 534 | ]
|
534 | 535 | },
|
535 | 536 | {
|
|
538 | 539 | "metadata": {},
|
539 | 540 | "outputs": [],
|
540 | 541 | "source": [
|
| 542 | + "fig, ax = plt.subplots(1, 2, figsize=(12, 4))\n", |
| 543 | + "\n", |
| 544 | + "dx = 2000 * osyris.units(\"au\")\n", |
| 545 | + "\n", |
541 | 546 | "osyris.plane({\"data\": data[\"hydro\"][\"velocity\"], \"mode\": \"lic\",\n",
|
542 |
| - " \"color\": data[\"hydro\"][\"density\"], \"norm\": \"log\", \"length\":30},\n", |
543 |
| - " dx=2000 * osyris.units(\"au\"),\n", |
544 |
| - " origin=center,\n", |
545 |
| - " direction=\"z\", resolution=1000)" |
| 547 | + " \"color\": data[\"hydro\"][\"density\"], \"norm\": \"log\",\n", |
| 548 | + " \"length\":60}, ax=ax[0],\n", |
| 549 | + " dx=dx, origin=center, direction=\"z\")\n", |
| 550 | + "osyris.plane({\"data\": data[\"hydro\"][\"velocity\"], \"mode\": \"lic\",\n", |
| 551 | + " \"color\": data[\"hydro\"][\"velocity\"], \"norm\": \"linear\",\n", |
| 552 | + " \"length\":60, \"cmap\": \"plasma\"}, ax=ax[1],\n", |
| 553 | + " dx=dx, origin=center, direction=\"z\")" |
546 | 554 | ]
|
547 | 555 | },
|
548 | 556 | {
|
549 |
| - "cell_type": "markdown", |
| 557 | + "cell_type": "code", |
| 558 | + "execution_count": null, |
550 | 559 | "metadata": {},
|
551 |
| - "source": [ |
552 |
| - "Overlaying this plot with velocity arrows allows us to retrieve some information on the magnitude of the vector field." |
553 |
| - ] |
| 560 | + "outputs": [], |
| 561 | + "source": [] |
554 | 562 | }
|
555 | 563 | ],
|
556 | 564 | "metadata": {
|
|
0 commit comments