Skip to content

Commit

Permalink
DOC/FIX: ERL example with 'nostartup'
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-lauer committed Sep 10, 2024
1 parent 4460cde commit 29bd9bb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 52 deletions.
50 changes: 2 additions & 48 deletions docs/examples/plot-bokeh-vars.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,9 @@
"source": [
"init_file = \"$ACC_ROOT_DIR/bmad-doc/tao_examples/cbeta_cell/tao.init\"\n",
"\n",
"tao = Tao(init_file=init_file, plot=\"bokeh\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Show names for our quadrupoles"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"_ = tao.update_plot_shapes(\"quadrupole\", type_label=\"name\", layout=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Configure relevant settings"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tao.bokeh.configure(variables_per_row=2, show_sliders=True);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Show a \"single mode\"-style plot with variables\n",
"tao = Tao(init_file=init_file, plot=\"bokeh\")\n",
"\n",
"Please note that these interactive widgets will **not** display on https://bmad-sim.github.io/pytao documentation. These only work with a live Tao session."
"_ = tao.update_plot_shapes(\"quadrupole\", type_label=\"name\", layout=True)"
]
},
{
Expand All @@ -77,13 +38,6 @@
"tao.plot(\"beta\", vars=True, width=800, height=200, layout_height=75)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Query variable values programmatically"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
19 changes: 17 additions & 2 deletions docs/examples/plot-bokeh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,25 @@
"metadata": {},
"outputs": [],
"source": [
"import pytao\n",
"from pytao.plotting import TaoGraphSettings, TaoAxisSettings\n",
"\n",
"# Let's use SubprocessTao to make an independent Tao instance in a subprocess.\n",
"# Now we can use `tao` from above (`optics_matching`) and `erl` here simultaneously.\n",
"erl = pytao.SubprocessTao(init_file=\"$ACC_ROOT_DIR/bmad-doc/tao_examples/erl/tao.init\", plot=\"bokeh\")\n",
"erl = SubprocessTao(\n",
" init_file=\"$ACC_ROOT_DIR/bmad-doc/tao_examples/erl/tao.init\", \n",
" plot=\"bokeh\", \n",
" # The ERL example startup file customizes plots in a way incompatible with pytao's external plotting.\n",
" # Set \"nostartup=True\" to avoid this.\n",
" nostartup=True,\n",
")\n",
"\n",
"erl.cmds(\n",
" [\n",
" \"set global track_type = beam\",\n",
" \"set var r56[1]|model = 0.234\",\n",
" \"set var t566[1]|model = 0.567\",\n",
" ]\n",
")\n",
"\n",
"erl.plot(\n",
" \"alpha\",\n",
Expand Down Expand Up @@ -320,6 +333,8 @@
" {1: TaoCurveSettings(ele_ref_name=r\"linac.beg\\2\")},\n",
" {1: TaoCurveSettings(ele_ref_name=r\"linac.end\\2\")},\n",
" ],\n",
" xlim=(-3, 3),\n",
" ylim=(-10, 10),\n",
" share_x=False,\n",
" include_layout=False,\n",
" width=350, # per plot\n",
Expand Down
20 changes: 18 additions & 2 deletions docs/examples/plot-matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"outputs": [],
"source": [
"import pytao\n",
"from pytao import Tao\n",
"from pytao import Tao, SubprocessTao\n",
"\n",
"import matplotlib.pyplot as plt"
]
Expand Down Expand Up @@ -292,7 +292,21 @@
"\n",
"# Let's use SubprocessTao to make an independent Tao instance in a subprocess.\n",
"# Now we can use `tao` from above (`optics_matching`) and `erl` here simultaneously.\n",
"erl = pytao.SubprocessTao(init_file=\"$ACC_ROOT_DIR/bmad-doc/tao_examples/erl/tao.init\", plot=\"mpl\")\n",
"erl = SubprocessTao(\n",
" init_file=\"$ACC_ROOT_DIR/bmad-doc/tao_examples/erl/tao.init\", \n",
" plot=\"mpl\", \n",
" # The ERL example startup file customizes plots in a way incompatible with pytao's external plotting.\n",
" # Set \"nostartup=True\" to avoid this.\n",
" nostartup=True,\n",
")\n",
"\n",
"erl.cmds(\n",
" [\n",
" \"set global track_type = beam\",\n",
" \"set var r56[1]|model = 0.234\",\n",
" \"set var t566[1]|model = 0.567\",\n",
" ]\n",
")\n",
"\n",
"erl.plot(\n",
" \"alpha\",\n",
Expand Down Expand Up @@ -341,6 +355,8 @@
" {1: TaoCurveSettings(ele_ref_name=r\"linac.beg\\2\")},\n",
" {1: TaoCurveSettings(ele_ref_name=r\"linac.end\\2\")},\n",
" ],\n",
" xlim=(-3, 3),\n",
" ylim=(-10, 10),\n",
" share_x=False,\n",
" include_layout=False,\n",
" figsize=(6, 6),\n",
Expand Down

0 comments on commit 29bd9bb

Please sign in to comment.