Skip to content

Commit

Permalink
Merge pull request #29 from ProjectTorreyPines/2DVis
Browse files Browse the repository at this point in the history
Updated plotting examples to reflect new changes
  • Loading branch information
anchal-physics authored Nov 11, 2023
2 parents bfb3626 + 0dca8c5 commit 211983a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
examples/Project.toml
11 changes: 0 additions & 11 deletions examples/Project.toml

This file was deleted.

60 changes: 23 additions & 37 deletions examples/plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
"using Pkg\n",
"Pkg.activate(\"./\")\n",
"Pkg.add(url=\"[email protected]:ProjectTorreyPines/OMAS.jl.git\")\n",
"Pkg.add(url=\"[email protected]:ProjectTorreyPines/SOLPS2IMAS.jl.git\", rev=\"dev\")\n",
"Pkg.add(path=\"../\")\n",
"Pkg.add(PackageSpec(name=\"GR\", version=\"0.72.9\"))\n",
"Pkg.pin(\"GR\")\n",
"Pkg.develop(path=\"../\")\n",
"Pkg.add(\"Plots\")\n",
"Pkg.add(\"LaTeXStrings\")"
]
Expand All @@ -39,7 +36,7 @@
"metadata": {},
"outputs": [],
"source": [
"using SOLPS2IMAS\n",
"using OMAS\n",
"using GGDUtils\n",
"using Plots\n",
"using LaTeXStrings"
Expand All @@ -51,14 +48,9 @@
"metadata": {},
"outputs": [],
"source": [
"b2gmtry = \"../samples/b2fgmtry\"\n",
"b2output = \"../samples/b2time_red.nc\"\n",
"gsdesc = \"../samples/gridspacedesc.yml\"\n",
"b2mn = \"../samples/b2mn.dat\"\n",
"dd = solps2imas(b2gmtry, b2output, gsdesc, b2mn)\n",
"dd = OMAS.json2imas(\"../samples/time_dep_edge_profiles_last_step_only.json\")\n",
"grid_ggd = dd.edge_profiles.grid_ggd[1]\n",
"space = grid_ggd.space[1]\n",
"dd.edge_profiles.ggd[1].electrons.density[5].grid_subset_index = 5 # This is a bug in SOLPS2IMAS to be fixed"
"space = grid_ggd.space[1]"
]
},
{
Expand All @@ -82,21 +74,21 @@
"\n",
"# You can overlay any subset by giving a second argument\n",
"# Labels \n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 6), markercolor=:chocolate1)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 7), linecolor=:red, linewidth=2)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 8), linecolor=:darkred, linewidth=2)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 9), linecolor=:limegreen, linewidth=2)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 10), linecolor=:darkgreen, linewidth=2)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 11), linecolor=:cyan, linewidth=2)\n",
"# plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 12), linecolor=:teal, linewidth=1)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 13), linecolor=:royalblue1, linewidth=2)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 14), linecolor=:navyblue, linewidth=2)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 15), linecolor=:fuchsia, linewidth=2, linestyle=:dash)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 16), linecolor=:purple4, linewidth=2, linestyle=:dash)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 101), markershape=:rect, markercolor=:royalblue1)\n",
"# plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 102), markershape=:rect, markercolor=:maroon)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 103), markershape=:diamond, markercolor=:fuchsia)\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 104), markershape=:diamond, markercolor=:purple4)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 6), markercolor=:chocolate1)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 7), linecolor=:red, linewidth=2)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 8), linecolor=:darkred, linewidth=2)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 9), linecolor=:limegreen, linewidth=2)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 10), linecolor=:darkgreen, linewidth=2)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 11), linecolor=:cyan, linewidth=2)\n",
"# plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 12), linecolor=:teal, linewidth=1)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 13), linecolor=:royalblue1, linewidth=2)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 14), linecolor=:navyblue, linewidth=2)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 15), linecolor=:fuchsia, linewidth=2, linestyle=:dash)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 16), linecolor=:purple4, linewidth=2, linestyle=:dash)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 101), markershape=:rect, markercolor=:royalblue1)\n",
"# plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 102), markershape=:rect, markercolor=:maroon)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 103), markershape=:diamond, markercolor=:fuchsia)\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 104), markershape=:diamond, markercolor=:purple4)\n",
"\n",
"# Legend is supressed unless asked for specifically\n",
"plot!(legend=true)\n",
Expand All @@ -120,7 +112,8 @@
"gr() # Fast and can save pdf\n",
"# plotlyjs() # Use for interactive plot, can only save png\n",
"\n",
"plot(dd.edge_profiles.grid_ggd, dd.edge_profiles.ggd[1].electrons.density[5], colorbar_title=\"Electrons density / \" * L\"m^{-3}\")"
"n_e = GGDUtils.get_prop_with_grid_subset_index(dd.edge_profiles.ggd[1].electrons.density, 5)\n",
"plot(dd.edge_profiles.grid_ggd, n_e, colorbar_title=\"Electrons density / \" * L\"m^{-3}\")"
]
},
{
Expand All @@ -140,16 +133,9 @@
"gr() # Fast and can save pdf\n",
"# plotlyjs() # Use for interactive plot, can only save png\n",
"\n",
"plot(dd.edge_profiles.grid_ggd, dd.edge_profiles.ggd[1].electrons.density[5]) # Note default label in colorbar\n",
"plot!(space, SOLPS2IMAS.get_grid_subset_with_index(grid_ggd, 16), linecolor=:red, linewidth=2, linestyle=:solid, label=\"Separatix\", legend=true)"
"plot(dd.edge_profiles.grid_ggd, n_e) # Note default label in colorbar\n",
"plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 16), linecolor=:red, linewidth=2, linestyle=:solid, label=\"Separatix\", legend=true)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 211983a

Please sign in to comment.