Skip to content

Commit

Permalink
Add stream plot
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherMayes committed Dec 23, 2024
1 parent 2b62e61 commit a7b2ff7
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 192 deletions.
29 changes: 23 additions & 6 deletions docs/examples/fields/field_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# FieldMesh Examples"
"# FieldMesh Examples\n",
"\n",
"This illustrates the basic usage of the `FieldMesh` object."
]
},
{
Expand All @@ -17,10 +19,8 @@
"source": [
"from pmd_beamphysics import FieldMesh\n",
"\n",
"\n",
"import numpy as np\n",
"\n",
"# Nicer plotting\n",
"import matplotlib.pyplot as plt"
]
},
Expand All @@ -32,8 +32,7 @@
},
"outputs": [],
"source": [
"FM = FieldMesh(\"../data/solenoid.h5\")\n",
"FM.geometry"
"FM = FieldMesh(\"../data/solenoid.h5\")"
]
},
{
Expand All @@ -54,6 +53,24 @@
"FM.plot(\"B\", aspect=\"equal\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Stream plotting. This has additional options. \n",
"\n",
"For cylindrical geometry, `mirror='r'` will mirror the r axis about r=0 for a more illustrative plot:\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"FM.plot(stream=True, mirror=\"r\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -980,7 +997,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
"version": "3.13.0"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit a7b2ff7

Please sign in to comment.