-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from ProjectTorreyPines/add_recipe
Plotting recipes for interferometer data
- Loading branch information
Showing
4 changed files
with
384 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Plotting interferometer using GGDUtils\n", | ||
" \n", | ||
" For running this notebook, you need to install package IJulia in your home environment (that is messy, but that is the only way I know right now). So in your terminal:\n", | ||
" ```\n", | ||
" % julia\n", | ||
" julia > ]\n", | ||
" (@v1.9 pkg) pkg> add IJulia\n", | ||
" ```\n", | ||
"\n", | ||
" After this, Julia kernel would appear in your jupyter notebooks as an option. This also works for julia notebooks directly opened on VSCode. Select the Julia kernel to run this notebook." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"using Pkg\n", | ||
"Pkg.activate(\"./\")\n", | ||
"Pkg.add(url=\"[email protected]:ProjectTorreyPines/OMAS.jl.git\")\n", | ||
"Pkg.develop(path=\"../\")\n", | ||
"Pkg.add(\"Plots\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"using OMAS\n", | ||
"using GGDUtils\n", | ||
"using Plots" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Load the interferometer" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ids = OMAS.json2imas(\"$(@__DIR__)/../samples/time_dep_edge_profiles_with_interferometer.json\")\n", | ||
"grid_ggd = ids.edge_profiles.grid_ggd[1]\n", | ||
"space = grid_ggd.space[1]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Plotting the interferometer geometry on top of SOLPS mesh" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Choose backend\n", | ||
"gr() # Fast and can save pdf\n", | ||
"# plotlyjs() # Use for interactive plot, can only save png\n", | ||
"\n", | ||
"plot(space)\n", | ||
"plot!(ids.interferometer) # Default plot_type is :los \n", | ||
"plot!(legend=true)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"You can provide custom lengthand thickness of mirror to be plotted and linewidth of the laser beams" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Choose backend\n", | ||
"gr() # Fast and can save pdf\n", | ||
"# plotlyjs() # Use for interactive plot, can only save png\n", | ||
"\n", | ||
"plot(space)\n", | ||
"plot!(ids.interferometer, mirror_length=0.7, linewidth=4, mirror_thickness=0.2)\n", | ||
"plot!(legend=true)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Or you can choose to omit the mirror" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Choose backend\n", | ||
"gr() # Fast and can save pdf\n", | ||
"# plotlyjs() # Use for interactive plot, can only save png\n", | ||
"\n", | ||
"plot(space)\n", | ||
"plot!(ids.interferometer, mirror=false)\n", | ||
"plot!(legend=true)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"You can plot a single channel as well. You can override the in-built channel name for the label." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Choose backend\n", | ||
"gr() # Fast and can save pdf\n", | ||
"# plotlyjs() # Use for interactive plot, can only save png\n", | ||
"\n", | ||
"plot(space)\n", | ||
"plot!(ids.interferometer.channel[1], label=\"Channel 1\")\n", | ||
"plot!(legend=true)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Plotting interferometer data vs time\n", | ||
"\n", | ||
" * Use plot_type=:n_e for integrated electron density data\n", | ||
" * Use plot_type=:n_e_average for averaged electron density data\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Choose backend\n", | ||
"gr() # Fast and can save pdf\n", | ||
"# plotlyjs() # Use for interactive plot, can only save png\n", | ||
"\n", | ||
"plot(ids.interferometer, plot_type=:n_e)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Choose backend\n", | ||
"gr() # Fast and can save pdf\n", | ||
"# plotlyjs() # Use for interactive plot, can only save png\n", | ||
"\n", | ||
"plot(ids.interferometer, plot_type=:n_e_average)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Again, to plot an individual channel, just provide the channel with correct plot_type" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Choose backend\n", | ||
"gr() # Fast and can save pdf\n", | ||
"# plotlyjs() # Use for interactive plot, can only save png\n", | ||
"\n", | ||
"plot(ids.interferometer.channel[1], plot_type=:n_e_average)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Julia 1.9.2", | ||
"language": "julia", | ||
"name": "julia-1.9" | ||
}, | ||
"language_info": { | ||
"file_extension": ".jl", | ||
"mimetype": "application/julia", | ||
"name": "julia", | ||
"version": "1.9.2" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/time_dep_edge_profiles_last_step_only.json | ||
/time_dep_edge_profiles_with_interferometer.json |
12 changes: 12 additions & 0 deletions
12
samples/time_dep_edge_profiles_with_interferometer.json.dvc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
md5: fb9792d06bb5d13f3a8803654b78624c | ||
frozen: true | ||
deps: | ||
- path: ITER_Lore_2296_00000/IMAS/time_dep_edge_profiles_with_interferometer.json | ||
repo: | ||
url: [email protected]:ProjectTorreyPines/SOLPSTestSamples.git | ||
rev_lock: 80688afd131b17455c3320a4485bbf2b7a55c80c | ||
outs: | ||
- md5: 610272ceabe4a62dd776e0f3c08d2036 | ||
size: 40662828 | ||
hash: md5 | ||
path: time_dep_edge_profiles_with_interferometer.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters